Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

68 lines (57 sloc) 1.691 kb
#!/usr/bin/perl -w
use strict;
use warnings;
use utf8;
#use Test::More tests => 77;
use Test::More 'no_plan';
use App::Sqitch;
use Locale::TextDomain qw(App-Sqitch);
use Test::NoWarnings;
use File::Path qw(make_path remove_tree);
use URI;
use lib 't/lib';
use MockOutput;
my $CLASS = 'App::Sqitch::Command::tag';
ok my $sqitch = App::Sqitch->new(
uri => URI->new('https://github.com/theory/sqitch/'),
top_dir => Path::Class::Dir->new('sql'),
), 'Load a sqitch sqitch object';
my $config = $sqitch->config;
isa_ok my $tag = App::Sqitch::Command->load({
sqitch => $sqitch,
command => 'tag',
config => $config,
}), $CLASS, 'tag command';
can_ok $CLASS, qw(
options
configure
execute
);
is_deeply [$CLASS->options], [], 'Should have no options';
make_path 'sql';
END { remove_tree 'sql' };
my $plan = $sqitch->plan;
ok $plan->add('foo'), 'Add change "foo"';
ok $tag->execute('alpha'), 'Tag @alpha';
is $plan->get('@alpha')->name, 'foo', 'Should have tagged "foo"';
ok $plan->load, 'Reload plan';
is $plan->get('@alpha')->name, 'foo', 'Plan should have been written';
is_deeply +MockOutput->get_info, [
[__x
'Tagged "{change}" with {tag}',
change => 'foo',
tag => '@alpha',
]
], 'The info message should be correct';
# With no arg, should get a list of tags.
ok $tag->execute, 'Execute with no arg';
is_deeply +MockOutput->get_info, [
['@alpha'],
], 'The one tag should have been listed';
# Get a list of tags.
ok $plan->add_tag('@beta'), 'Add tag @beta';
ok $tag->execute, 'Execute with no arg again';
is_deeply +MockOutput->get_info, [
['@alpha'],
['@beta'],
], 'Both tags should have been listed';
Jump to Line
Something went wrong with that request. Please try again.