Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2405 from swapagarwal/beam-me-up-scotty
Browse files Browse the repository at this point in the history
New Star Trek Code Phrase
  • Loading branch information
moollaza committed Mar 29, 2016
2 parents bbd15d3 + 61eda51 commit f92c75c
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/DDG/Goodie/BeamMeUpScotty.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package DDG::Goodie::BeamMeUpScotty;
# ABSTRACT: A Star Trek catchphrase

use DDG::Goodie;
use strict;

zci answer_type => 'beam_me_up_scotty';
zci is_cached => 1;

triggers start => 'beam me up scotty', 'beam us up scotty';

handle remainder => sub {
return unless $_ eq '';

my $answer = 'Aye, aye, captain.';

return $answer,
structured_answer => {
input => ['Beam me up, Scotty'],
operation => 'Code phrase',
result => $answer
};
};

1;
33 changes: 33 additions & 0 deletions t/BeamMeUpScotty.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env perl

use strict;
use warnings;
use Test::More;
use DDG::Test::Goodie;

zci answer_type => "beam_me_up_scotty";
zci is_cached => 1;

ddg_goodie_test(
[qw( DDG::Goodie::BeamMeUpScotty )],
'beam me up scotty' => test_zci(
'Aye, aye, captain.',
structured_answer => {
input => ['Beam me up, Scotty'],
operation => 'Code phrase',
result => 'Aye, aye, captain.'
}
),
'beam us up scotty' => test_zci(
'Aye, aye, captain.',
structured_answer => {
input => ['Beam me up, Scotty'],
operation => 'Code phrase',
result => 'Aye, aye, captain.'
}
),
'beam me up' => undef,
'scotty beam us up' => undef,
);

done_testing;

0 comments on commit f92c75c

Please sign in to comment.