Beam-Wire

 view release on metacpan or  search on metacpan

t/exception.t  view on Meta::CPAN

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
subtest "get a service that doesn't exist" => sub {
    my $wire = Beam::Wire->new;
    throws_ok { $wire->get( 'foo' ) } 'Beam::Wire::Exception::NotFound';
    is $@->name, 'foo';
    like $@, qr{\QService 'foo' not found}, 'stringifies';
 
    subtest 'not found with file shows file name' => sub {
        my $path = $SHARE_DIR->child( 'file.yml' )->stringify;
        my $wire = Beam::Wire->new( file => $path );
        throws_ok { $wire->get( 'does_not_exist' ) } 'Beam::Wire::Exception::NotFound';
        is $@->name, 'does_not_exist';
        like $@, qr{\QService 'does_not_exist' not found in file '$path'}, 'stringifies';
    };
};
 
subtest "extend a service that doesn't exist" => sub {
    my $wire = Beam::Wire->new(
        config => {
            foo => {
                extends => 'bar',
            },
        },



( run in 0.288 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )