DBIx-Changeset
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
t/09-Changeset-App.t view on Meta::CPAN
is($cmd->{'config'}->{'test2'}, 'testing', 'Got correct test2 value from test2.yml during array test');
is($cmd->{'config'}->{'test3'}, 1, 'Got correct test3 value from test1.yml during array test');
## test with array
$cmd->config([File::Spec->catfile('t', 'test2.yml'), File::Spec->catfile('t', 'test1.yml')]);
is($cmd->{'config'}->{'test'}, 1, 'Got correct config var for test from reverse array test');
is($cmd->{'config'}->{'test2'}, 'testing', 'Got correct test2 value from test2.yml during reverse array test');
is($cmd->{'config'}->{'test3'}, 1, 'Got correct test3 value from test1.yml during array reverse test');
{
local @ARGV = qw(commands);
my ($output) = Test::Output::output_from(sub { $cmd->run });
for my $name (qw(create update compare applied bootstrap commands help)) {
like($output, qr/^\s+\Q$name\E/sm, "$name command in listing");
}
}
### test create options
{
local @ARGV = qw(help create);
my ($output) = Test::Output::output_from(sub { $cmd->run });
### do we have the default options
for my $name (qw(help prompt)) {
like($output, qr/^\s+\Q--$name\E/sm, "$name default option listed");
}
### do we have the 2 other added options
for my $name (qw(edit editor location template)) {
like($output, qr/^\s+\Q--$name\E/sm, "$name create option listed");
}
}
### test create option validation
{
local @ARGV = qw(create);
eval { $cmd->run; };
### check for complaint about changeset location
like($@, qr/valid changeset location/, 'got complaint about changeset location from create');
}
### test create option validation
{
local @ARGV = qw(create --location=./t/data);
eval { $cmd->run; };
### check for complaint about missing delta name
like($@, qr/valid changeset name/, 'got complaint about delta name from create');
}
### test create
{
local @ARGV = qw(create --location=./t/data --template=./t/add_template.txt moose);
my $output;
eval { ($output) = Test::Output::output_from(sub { $cmd->run }); };
### check that we get the create filename message
my $created;
if ( $output =~ qr/created: (.*_moose.sql)$/ ) {
$created = $1;
}
like($output, qr/created: (.*_moose.sql)$/, 'found filename in output');
### does purported file exists
ok(-e $created, 'reported file exists');
unlink ( $created );
}
### test bootstrap options
{
local @ARGV = qw(help bootstrap);
my ($output) = Test::Output::output_from(sub { $cmd->run });
### do we have the other added options
for my $name (qw(history_db_dsn history_db_user history_db_password)) {
like($output, qr/^\s+\Q--$name\E/sm, "$name compare option listed");
}
}
### test bootstrap option validation
{
local @ARGV = qw(bootstrap);
eval { $cmd->run; };
### check for complaint about missing history_db_dsn
like($@, qr/history_db_dsn/, 'got complaint about history_db_dsn from bootstrap');
}
### test valid bootstrap
{
local @ARGV = ('bootstrap', "--history_db_dsn=".$test_dsn);
my $output;
eval { ($output) = Test::Output::output_from(sub { $cmd->run; }); };
if ( $@ ) { diag($@); }
like($output, qr/complete./, 'can do a valid bootstrap');
}
### test valid bootstrap with DBIX_UPDATE_CONFIG env var
{
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.140 second using v1.00-cache-2.02-grep-82fe00e-cpan-c9a218a2bbc )