From: Matt S Trout Date: Sat, 16 May 2009 15:33:16 +0000 (+0100) Subject: inflating post objects from file X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=engit%2FIron-Munger.git;a=commitdiff_plain;h=e4465877b347f4307efec69830be89e73f3a7691 inflating post objects from file --- diff --git a/t/plagger_loader.t b/t/plagger_loader.t index e3bffd4..43405f5 100644 --- a/t/plagger_loader.t +++ b/t/plagger_loader.t @@ -38,8 +38,21 @@ my @postspecs = map at => $_, }, qw(2009-05-13T02:45:00 2009-05-14T16:00:00); -my $specs = $loader->_expand_postspecs_from_file( - io('t/csv/my_Justin_DeVuyst.csv') - ); +my $jdv_file = io('t/csv/my_Justin_DeVuyst.csv'); + +my $specs = $loader->_expand_postspecs_from_file($jdv_file); is_deeply($specs, \@postspecs, 'Post specs from file ok'); + +my $posts = $loader->_expand_posts_from_file($jdv_file); + +cmp_ok(scalar(@$posts), '==', scalar(@postspecs), 'Right number of posts'); + +foreach my $i (0, 1) { + my %spec = %{$postspecs[$i]}; + my $post = $posts->[$i]; + foreach my $key (sort keys %spec) { + is($post->$key, $spec{$key}, "Attribute ${key} ok for post ${i}"); + } +} +