App-JESP

 view release on metacpan or  search on metacpan

t/deploy.t  view on Meta::CPAN

# Test deployment in SQLite

# use Log::Any::Adapter qw/Stderr/;

# A home that is there.
my $jesp = App::JESP->new({ dsn => 'dbi:SQLite:dbname=:memory:',
                            username => undef,
                            password => undef,
                            home => './t/home/'
                        });
throws_ok(sub{ $jesp->deploy() } , qr/ERROR querying meta/ );

# Time to install
$jesp->install();
 my $status = $jesp->status();
is( scalar( @{$status->{plan_patches}} ) , 4, "Ok 4 patches in plan");
is( $jesp->deploy(), 4, "Ok applied 4 patches");

$status = $jesp->status();
is( scalar( @{$status->{plan_patches}} ) , 4, "Ok 4 patches in plan");
map{ ok( $_->applied_datetime() )  } @{$status->{plan_patches}};

t/deploy_mysql.t  view on Meta::CPAN

    push @mysqls , Test::mysqld->new( my_cnf => { port => Net::EmptyPort::empty_port() } );
}

foreach my $mysql ( @mysqls ){
    # A home that is there.
    my $jesp = App::JESP->new({ dsn => $mysql->dsn(),
                                password => '',
                                username => '',
                                home => './t/home_mysql/'
                            });
    throws_ok(sub{ $jesp->deploy() } , qr/ERROR querying meta/ );

    # Time to install
    $jesp->install();
    # And deploy
    is( $jesp->deploy(), 2, "Ok applied 2 patches");
    is( $jesp->deploy(), 0, "Ok applied 0 patches on the second call");
}

done_testing();

t/deploy_pgsql.t  view on Meta::CPAN


use App::JESP;

my $pgsql = eval{ Test::PostgreSQL->new({ port => Net::EmptyPort::empty_port() }) } or plan skip_all => $@.' - '.$Test::PostgreSQL::errstr;

my $jesp = App::JESP->new({ dsn => $pgsql->dsn(),
                            password => '',
                            username => 'postgres',
                            home => './t/home_pgsql/'
                        });
throws_ok(sub{ $jesp->deploy() } , qr/ERROR querying meta/ );

# Time to install
$jesp->install();
# And deploy
is( $jesp->deploy(), 2, "Ok applied 2 patches");
is( $jesp->deploy(), 0, "Ok applied 0 patches on the second call");

# Now let's insert one country. This should work just fine.
{
    $jesp->dbix_simple()->insert('country', { country => 'Groland' });

t/plan.t  view on Meta::CPAN


# use Log::Any::Adapter qw/Stderr/;

{
    # A home that is not there.
    my $jesp = App::JESP->new({ dsn => 'dbi:SQLite:dbname=:memory:',
                                username => undef,
                                password => undef,
                                home => 'bla'
                            });
    throws_ok(sub{ my $plan = $jesp->plan() } , qr/does not exists/ );
}

{
    # A home that is there.
    my $jesp = App::JESP->new({ dsn => 'dbi:SQLite:dbname=:memory:',
                                username => undef,
                                password => undef,
                                home => './t/home/'
                            });
    ok( my $plan = $jesp->plan() );



( run in 0.289 second using v1.01-cache-2.11-cpan-496ff517765 )