Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added tests for site tips
  • Loading branch information
zoffixznet committed Nov 21, 2015
1 parent ad03cd7 commit 4639c48
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
8 changes: 8 additions & 0 deletions web/t/01-models/03-site-tips-TEST-TIPS.txt
@@ -0,0 +1,8 @@
# This is a comment and should be ignored, as are blank lines

Tip 1
Tip 2




27 changes: 27 additions & 0 deletions web/t/01-models/03-site-tips.t
@@ -0,0 +1,27 @@
#!perl

use strict;
use warnings FATAL => 'all';

use Test::Most;
use t::Helper;

use constant MODEL => 'ModulesPerl6::Model::SiteTips';
use constant TEST_TIP_FILE => 't/01-models/03-site-tips-TEST-TIPS.txt';

-r TEST_TIP_FILE
or BAIL_OUT 'Could not find test tip file at ' . TEST_TIP_FILE;

use_ok MODEL;
my $m = MODEL->new( tip_file => TEST_TIP_FILE );
isa_ok $m => MODEL;
can_ok $m => qw/tip tip_file/;

is $m->tip_file, TEST_TIP_FILE, '->tip_file gives correct results';

my $is_wrong = 0;
diag 'Fetching tips many times...';
$m->tip =~ /^Tip \d\z/ or $is_wrong = 1 for 1 .. 2_000_000;
is $is_wrong, 0, '... all fetches were correct';

done_testing;

0 comments on commit 4639c48

Please sign in to comment.