diff options
author | Edmund von der Burg <evdb@mysociety.org> | 2011-04-15 10:25:46 +0100 |
---|---|---|
committer | Edmund von der Burg <evdb@mysociety.org> | 2011-04-15 10:25:46 +0100 |
commit | 7a366593576587a6b654ea967e8beefb2dba6b1c (patch) | |
tree | 74a0c02116ab5f3f8383578f522481481573bb29 /t | |
parent | 82f853c5abb9788d4c0f16b4dcb1c91dd9eb8337 (diff) |
Proper FakeQ object to interface with old code
Diffstat (limited to 't')
-rw-r--r-- | t/fakeq.t | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/t/fakeq.t b/t/fakeq.t new file mode 100644 index 000000000..ae7c6d98b --- /dev/null +++ b/t/fakeq.t @@ -0,0 +1,24 @@ +use strict; +use warnings; + +use Test::More; + +use_ok 'FixMyStreet::FakeQ'; + +# create a new object and check that it returns what we want. +my $fake_q = FixMyStreet::FakeQ->new( + { + params => { foo => 'bar' }, # + site => 'boing' + } +); + +is $fake_q->{site}, 'boing', 'got site verbatim'; +is $fake_q->param('foo'), 'bar', 'got set param'; +is $fake_q->param('not_set'), undef, 'got undef for not set param'; + +# check that setting site to 'default' gets translated to fixmystreet +is FixMyStreet::FakeQ->new( { site => 'default' } )->{site}, 'fixmystreet', + "'default' site becomes 'fixmystreet'"; + +done_testing(); |