File: formatter_rss.t

package info (click to toggle)
libmojomojo-perl 1.01%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 4,272 kB
  • ctags: 879
  • sloc: perl: 14,055; sh: 145; xml: 120; ruby: 6; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 1,121 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env perl
use strict;
use warnings;
use MojoMojo::Formatter::RSS;
use Test::More;
use lib 't/lib';
use FakeCatalystObject;

BEGIN {
    plan skip_all => 'Requirements not installed for the RSS formatter'
        unless MojoMojo::Formatter::RSS->module_loaded;
    plan tests => 4;
    $ENV{CATALYST_CONFIG} = 't/var/mojomojo.yml';
    use_ok('Catalyst::Test', 'MojoMojo');
}

my $fake_c = FakeCatalystObject->new;
my ($content);

content_like '/.jsrpc/render?content=%7B%7Bhttp://localhost/.rss%7D%7D', qr'{{http://localhost/.rss}}',
    'invalidate the old "syntax"';

SKIP: {
    skip "set TEST_LIVE to run tests that requires a live Internet connection", 2
        if not $ENV{TEST_LIVE};
        
    content_like '/.jsrpc/render?content=%7B%7Bfeed http://rss.cnn.com/rss/cnn_latest.rss%7D%7D', 
        qr'<div class="feed">[^\n]+cnn\.com/[^\n]+</div>\Z',
        'CNN feed - one entry only';

    content_like '/.jsrpc/render?content=%7B%7Bfeed http://rss.cnn.com/rss/cnn_latest.rss 3%7D%7D', 
        qr'(<div class="feed">[^\n]+cnn\.com/[^\n]+</div>\s*){3}\Z',
        'CNN feed - exactly 3 entries';
}