aboutsummaryrefslogtreecommitdiffstats
path: root/t/fixmystreet.t
diff options
context:
space:
mode:
Diffstat (limited to 't/fixmystreet.t')
-rw-r--r--t/fixmystreet.t23
1 files changed, 22 insertions, 1 deletions
diff --git a/t/fixmystreet.t b/t/fixmystreet.t
index c1b3f0075..d7f00b047 100644
--- a/t/fixmystreet.t
+++ b/t/fixmystreet.t
@@ -2,7 +2,8 @@ use strict;
use warnings;
use Path::Class;
-use Test::More tests => 4;
+use Test::More;
+use Test::Exception;
use_ok 'FixMyStreet';
@@ -14,3 +15,23 @@ isa_ok $path_to_path, 'Path::Class::File';
ok $path_to_path->is_absolute, "path is absolute";
is "$path_to_path", $file_path, "got $file_path";
+# check that the config gets loaded and is immutable
+my $config = FixMyStreet->config;
+isa_ok $config, 'HASH';
+is $config->{GAZE_URL}, 'http://gaze.mysociety.org/gaze',
+ "got GAZE_URL correctly";
+throws_ok(
+ sub { $config->{GAZE_URL} = 'some other value'; },
+ qr/Modification of a read-only value attempted/,
+ 'attempt to change config caught'
+);
+is $config->{GAZE_URL}, 'http://gaze.mysociety.org/gaze', "GAZE_URL unchanged";
+
+# check that we can get the value by key as well
+is FixMyStreet->config('GAZE_URL'), 'http://gaze.mysociety.org/gaze',
+ "GAZE_URL correct when got by key";
+is FixMyStreet->config('BAD_KEY_DOES_NOT_EXIST'), undef, "config miss is undef";
+
+# all done
+done_testing();
+