Commit | Line | Data |
cb69249e |
1 | use strict; |
2 | use warnings; |
3 | |
5d50f369 |
4 | use Test::More tests => 4; |
cb69249e |
5 | |
5d50f369 |
6 | use Catalyst::Utils; |
cb69249e |
7 | |
8 | ############################################################################## |
9 | ### No env vars defined |
10 | ############################################################################## |
11 | { |
12 | ok( !Catalyst::Utils::env_value( 'MyApp', 'Key' ), |
13 | 'No env values defined returns false' |
14 | ); |
15 | } |
16 | |
17 | ############################################################################## |
18 | ### App env var defined |
19 | ############################################################################## |
20 | { |
21 | $ENV{'MYAPP2_KEY'} = 'Env value 2'; |
22 | is( Catalyst::Utils::env_value( 'MyApp2', 'Key' ), |
23 | 'Env value 2', 'Got the right value from the application var' ); |
24 | } |
25 | |
26 | ############################################################################## |
27 | ### Catalyst env var defined |
28 | ############################################################################## |
29 | { |
30 | $ENV{'CATALYST_KEY'} = 'Env value 3'; |
31 | is( Catalyst::Utils::env_value( 'MyApp3', 'Key' ), |
32 | 'Env value 3', 'Got the right value from the catalyst var' ); |
33 | } |
34 | |
35 | ############################################################################## |
36 | ### Catalyst and Application env vars defined |
37 | ############################################################################## |
38 | { |
39 | $ENV{'CATALYST_KEY'} = 'Env value bad'; |
40 | $ENV{'MYAPP4_KEY'} = 'Env value 4'; |
41 | is( Catalyst::Utils::env_value( 'MyApp4', 'Key' ), |
42 | 'Env value 4', 'Got the right value from the application var' ); |
43 | } |
44 | |