diff --git a/lib/DDG/Goodie/Unicornify.pm b/lib/DDG/Goodie/Unicornify.pm index d2e9abf75..184adc0fa 100644 --- a/lib/DDG/Goodie/Unicornify.pm +++ b/lib/DDG/Goodie/Unicornify.pm @@ -8,8 +8,18 @@ use Unicornify::URL; triggers start => 'unicornify'; + handle remainder => sub { - return img({src=>unicornify_url(email => $_, size => "100")}) if (Email::Valid->address($_)); + my $link = 'http://unicornify.appspot.com/'; + if (Email::Valid->address($_)) { + s/[\s\t]+//g; # strip whitespace from the remainder, we just need the email address. + + return $_ . '\'s unicorn:', + html => '

Learn more at unicornify.appspot.com'; + } return; }; diff --git a/t/Unicornify.t b/t/Unicornify.t new file mode 100644 index 000000000..6ac661dc8 --- /dev/null +++ b/t/Unicornify.t @@ -0,0 +1,24 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use Test::More; +use DDG::Test::Goodie; +use Unicornify::URL; + + +zci answer_type => 'unicornify'; +zci is_cached => 1; +ddg_goodie_test( + [qw( + DDG::Goodie::Unicornify + )], + 'unicornify bob@bob.com' => + test_zci('bob@bob.com\'s unicorn:', + html => '

Learn more at unicornify.appspot.com')); + +done_testing;