Alien-Build
view release on metacpan or search on metacpan
t/alien_build_plugin_fetch_lwp.t view on Meta::CPAN
use 5.008004;
use Test2::V0 -no_srand => 1;
use Test::Alien::Build;
use Alien::Build::Plugin::Fetch::LWP;
use lib 't/lib';
use Path::Tiny qw( path );
use MyTest::HTTP;
use MyTest::FTP;
use MyTest::File;
use MyTest::CaptureNote;
use Alien::Build::Util qw( _dump );
use JSON::PP qw( decode_json );
subtest 'updates requires' => sub {
my $plugin = Alien::Build::Plugin::Fetch::LWP->new( url => 'file://localhost/' );
my $build = alienfile filename => 'corpus/blank/alienfile';
my $meta = $build->meta;
$plugin->init($meta);
is( $build->requires('share')->{'LWP::UserAgent'}, 0 );
note _dump $meta;
};
subtest 'use start_url' => sub {
subtest 'sets start_url' => sub {
my $build = alienfile_ok q{
use alienfile;
plugin 'Fetch::LWP' => 'http://foo.bar.baz';
};
is $build->meta_prop->{start_url}, 'http://foo.bar.baz';
};
subtest 'uses start_url' => sub {
my $mock = mock 'Alien::Build::Plugin::Fetch::LWP';
my $plugin;
$mock->after(init => sub {
my($self, $meta) = @_;
$plugin = $self;
});
my $build = alienfile_ok q{
use alienfile;
meta->prop->{start_url} = 'http://baz.bar.foo';
plugin 'Fetch::LWP';
};
is $plugin->url, 'http://baz.bar.foo';
( run in 2.010 seconds using v1.01-cache-2.11-cpan-cdf2f3d4e48 )