diff options
author | Matthew Somerville <matthew@mysociety.org> | 2013-10-23 22:38:20 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2013-10-24 21:34:46 +0100 |
commit | cd51c26830d4f6ba144874e2f26010f7b6b76636 (patch) | |
tree | 17a0316b6c461e2ba45ac1d462772bf37fddc38e /t/app/controller/reports.t | |
parent | 0b28f2ac1af652c37eda35f944b5eb78f4adf5d1 (diff) |
Fix test suite to run regardless of config setup.
Diffstat (limited to 't/app/controller/reports.t')
-rw-r--r-- | t/app/controller/reports.t | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t index 14a4b2150..42e69fd03 100644 --- a/t/app/controller/reports.t +++ b/t/app/controller/reports.t @@ -42,9 +42,13 @@ is $stats->{'City of Edinburgh Council'}->[2], 1, 'correct number of older repor is $stats->{'Westminster City Council'}->[1], 5, 'correct number of reports for Westminster'; -$mech->follow_link_ok( { text_regex => qr/Birmingham/ } ); +FixMyStreet::override_config { + MAPIT_URL => 'http://mapit.mysociety.org/', +}, sub { + $mech->follow_link_ok( { text_regex => qr/Birmingham/ } ); + $mech->get_ok('/reports/Westminster'); +}; -$mech->get_ok('/reports/Westminster'); $mech->title_like(qr/Westminster City Council/); $mech->content_contains('Westminster City Council'); $mech->content_contains('All reports Test 3 for 2504', 'problem to be marked non public visible'); @@ -55,7 +59,11 @@ is scalar @$problems, 5, 'correct number of problems displayed'; my $private = $westminster_problems[2]; ok $private->update( { non_public => 1 } ), 'problem marked non public'; -$mech->get_ok('/reports/Westminster'); +FixMyStreet::override_config { + MAPIT_URL => 'http://mapit.mysociety.org/', +}, sub { + $mech->get_ok('/reports/Westminster'); +}; $problems = $mech->extract_problem_list; is scalar @$problems, 4, 'only public problems are displayed'; @@ -65,24 +73,30 @@ $mech->get_ok('/reports'); $stats = $mech->extract_report_stats; is $stats->{'Westminster City Council'}->[1], 5, 'non public reports included in stats'; -SKIP: { - skip( "Need 'emptyhomes' in ALLOWED_COBRANDS config", 8 ) - unless FixMyStreet::Cobrand->exists('emptyhomes'); - ok $mech->host("reportemptyhomes.com"), 'change host to reportemptyhomes'; - $mech->get_ok('/reports'); - # EHA lacks one column the others have - $mech->content_lacks('state unknown'); - - skip( "Need 'fiksgatami' in ALLOWED_COBRANDS config", 8 ) - unless FixMyStreet::Cobrand->exists('fiksgatami'); - $mech->create_body_ok(3, 'Oslo'); - mySociety::MaPit::configure('http://mapit.nuug.no/'); - ok $mech->host("fiksgatami.no"), 'change host to fiksgatami'; - $mech->get_ok('/reports'); - # There should only be one Oslo - $mech->content_contains('Oslo'); - $mech->content_unlike(qr{Oslo">Oslo.*Oslo}s); -} +subtest "test emptyhomes all reports page" => sub { + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'emptyhomes' ], + }, sub { + ok $mech->host("reportemptyhomes.com"), 'change host to reportemptyhomes'; + $mech->get_ok('/reports'); + # EHA lacks one column the others have + $mech->content_lacks('state unknown'); + }; +}; + +subtest "test fiksgatami all reports page" => sub { + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'fiksgatami' ], + MAPIT_URL => 'http://mapit.nuug.no/', + }, sub { + $mech->create_body_ok(3, 'Oslo'); + ok $mech->host("fiksgatami.no"), 'change host to fiksgatami'; + $mech->get_ok('/reports'); + # There should only be one Oslo + $mech->content_contains('Oslo'); + $mech->content_unlike(qr{Oslo">Oslo.*Oslo}s); + } +}; done_testing(); |