Merge pull request #3030 from duckduckgo/gd/birth-stone-cleanup

BirthStone: Clean up
master
Zaahir Moolla 2016-06-23 17:10:51 -04:00 committed by GitHub
commit 6e92ddad15
2 changed files with 14 additions and 16 deletions

View File

@ -30,15 +30,15 @@ handle remainder => sub {
return unless $month; return unless $month;
my $stone = $birthstones{$month}; my $stone = $birthstones{$month};
return unless $stone; return unless $stone;
return $month . " birthstone: $stone", return "$month birthstone: $stone",
structured_answer => { structured_answer => {
data => { data => {
title => $stone, title => $stone,
subtitle => 'Birthstone for '.$month subtitle => "Birthstone for $month",
}, },
templates => { templates => {
group => "text", group => 'text',
} }
} }
}; };

View File

@ -9,23 +9,21 @@ use DDG::Test::Goodie;
zci answer_type => "birth_stone"; zci answer_type => "birth_stone";
zci is_cached => 1; zci is_cached => 1;
sub get_structured_answer { sub build_structured_answer {
my($month, $birthstone) = @_; my ($month, $birthstone) = @_;
return $month . " birthstone: $birthstone", return "$month birthstone: $birthstone",
structured_answer => { structured_answer => {
data => { data => {
title => $birthstone, title => $birthstone,
subtitle => 'Birthstone for '.$month subtitle => "Birthstone for $month",
}, },
templates => { templates => {
group => "text", group => 'text',
} }
} }
} }
sub build_test { sub build_test { test_zci(build_structured_answer(@_)) }
test_zci(get_structured_answer(@_));
}
ddg_goodie_test( ddg_goodie_test(
[qw( DDG::Goodie::BirthStone )], [qw( DDG::Goodie::BirthStone )],