App-Rssfilter

 view release on metacpan or  search on metacpan

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

    '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;

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

    'throws error when not given an item to match'
);

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

ok(
    App::Rssfilter::Match::BbcSports::match( Mojo::DOM->new( '<guid>www.bbc.co.uk/sport/<\guid>' ) ),
    'match item whose guid contains the BBC sport URL'
);

ok(
    App::Rssfilter::Match::BbcSports::match( Mojo::DOM->new( '<guid>www.bbc.co.uk/sport1/<\guid>' ) ),
    'match item whose guid contains the variant BBC sport URL'
);

ok(
    ! App::Rssfilter::Match::BbcSports::match( Mojo::DOM->new( '<guid>www.bbc.co.uk/science<\guid>' ) ),
    'does not match item whose guid does not contains the BBC sport URL'
);

ok(
    ! App::Rssfilter::Match::BbcSports::match( Mojo::DOM->new( '<guid>espn.com/sport<\guid>' ) ),
    'does not match item whose guid does not contain a BBC URL'
);

done_testing;



( run in 0.982 second using v1.01-cache-2.11-cpan-d8267643d1d )