Skip to content

Commit

Permalink
tests working
Browse files Browse the repository at this point in the history
  • Loading branch information
tempire committed Aug 28, 2011
1 parent e0a4565 commit a64eb7c
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/Msync.pm
Expand Up @@ -3,7 +3,7 @@ package Msync;
use App::Cmd::Setup -app;
use File::Slurp 'slurp';
use Nempire::Schema;
use Net::Riak;
#use Net::Riak;

use Mojo::Base -base;

Expand Down
1 change: 1 addition & 0 deletions lib/Msync/Command/Flickr.pm
Expand Up @@ -63,6 +63,7 @@ sub execute {

delete $set->{primary};

warn Dwarn $set;
my $photoset =
$schema->resultset('Photoset')->update_or_create($set);

Expand Down
2 changes: 1 addition & 1 deletion lib/Nempire.pm
Expand Up @@ -12,7 +12,7 @@ use Devel::Dwarn;
sub startup {
my $self = shift;

$self->plugin('pod_renderer');
$self->plugin('PODRenderer');

$self->helper(
db => sub {
Expand Down
3 changes: 2 additions & 1 deletion script/generate_schema.pl
Expand Up @@ -4,7 +4,8 @@
use DBIx::Class::Schema::Loader 'make_schema_at';

print $DBIx::Class::Schema::Loader::VERSION;
my @dsn = qw/ dbi:mysql:dbname=nempire /;
#my @dsn = qw/ dbi:mysql:dbname=nempire /;
my @dsn = qw/ dbi:SQLite:dbname=nempire.db /;

my $options = {
debug => 1,
Expand Down
2 changes: 1 addition & 1 deletion t/blogs.t
Expand Up @@ -7,7 +7,7 @@ $ENV{TEST_DB} = 'test.db';
Test::Database->new_test;

use Nempire;
my $t = Test::Mojo->new(app => 'Nempire');
my $t = Test::Mojo->new('Nempire');

# Blog not found
$t->get_ok('/blogs/bad_title')->status_is(302)
Expand Down
6 changes: 3 additions & 3 deletions t/empirex/flickr.t
@@ -1,8 +1,8 @@
use Modern::Perl;
use EmpireX::Flickr;
use Devel::Dwarn;

use Test::Most;
use Mock::Quick;
use EmpireX::Flickr;

ok my $f = EmpireX::Flickr->new;
ok $f->login;
Expand All @@ -18,7 +18,7 @@ isnt ref $sets[0]->{description} => 'hash';

# Photo list
ok my @photos = $f->photos($sets[0]->{id});
cmp_ok @photos, '>', 10;
cmp_ok @photos, '>', 5;
ok $photos[0]->{title};

# Photo sizes
Expand Down
2 changes: 1 addition & 1 deletion t/home.t
Expand Up @@ -7,7 +7,7 @@ $ENV{TEST_DB} = 'test.db';
Test::Database->new_test;

use Nempire;
my $t = Test::Mojo->new(app => 'Nempire');
my $t = Test::Mojo->new('Nempire');

$t->get_ok('/')->status_is(200)->element_exists('h3')
->text_is('a.more' => 'Tech');
Expand Down
2 changes: 1 addition & 1 deletion t/nempire/schema/photo.t
Expand Up @@ -32,7 +32,7 @@ ok $photo->update({idx => undef}), 'clear idx';
ok !$photo->previous, 'returns false';
ok !$photo->next, 'returns false';

like $photo->time_since => qr/\d+ days and \d+ hours ago/, 'time since';
like $photo->time_since => qr/\d+ \w+ and \d+ \w+ ago/, 'time since';
ok $photo->update({taken => undef}), 'clear taken';
ok $photo = $schema->resultset('Photo')->find($photo_id), 'refresh';
ok !$photo->time_since, 'no time since';
Expand Down
4 changes: 2 additions & 2 deletions t/nempire/schema/photoset.t
Expand Up @@ -26,11 +26,11 @@ is $set->primary->id => $set->primary_photo->id, 'primary photo alias';
is $set->region => 'Texas';
is $set->url_title => $photoset_title;
is $set->location => 'League City, Texas';
like $set->time_since => qr/\d+ days and \d+ hours ago/;
like $set->time_since => qr/\d+ \w+ and \d+ \w+ ago/;

is $set->previous->id => $prev_photoset_id, 'previous photoset';
is $set->next->id => $next_photoset_id, 'next photoset';

like $set->time_since => qr/\d+ days and \d+ hours ago/, 'time since';
like $set->time_since => qr/\d+ \w+ and \d+ \w+ ago/, 'time since';

done_testing;

0 comments on commit a64eb7c

Please sign in to comment.