App-Rssfilter

 view release on metacpan or  search on metacpan

t/app/rssfilter/match/abcpreviews.t  view on Meta::CPAN

use Test::Most;

use App::Rssfilter::Match::AbcPreviews;
use Mojo::DOM;

throws_ok(
    sub { App::Rssfilter::Match::AbcPreviews::match },
    qr/missing required argument/,
    'throws error when not given an item to match'
);

throws_ok(
    sub { App::Rssfilter::Match::AbcPreviews::match( qw( one two ) ) },
    qr/too many arguments/,
    'throws error when given more than one item to match'
);

ok(
    App::Rssfilter::Match::AbcPreviews::match( Mojo::DOM->new( '<guid>I am a preview<\guid>' ) ),
    'match item whose guid contains "preview"'
);

ok(
    ! App::Rssfilter::Match::AbcPreviews::match( Mojo::DOM->new( '<guid>I am a human being<\guid>' ) ),
    'does not match item whose guid does not contain "preview"'
);

ok(
    ! App::Rssfilter::Match::AbcPreviews::match( Mojo::DOM->new( '<title>sneak peek preview season</title><guid>http://hoop.de.doo/sneak-preview</guid>' ) ),
    'does not match item whose title and guid contain "preview"'
);

done_testing;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.478 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )