aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/model/problem.t
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-10-23 22:38:20 +0100
committerMatthew Somerville <matthew@mysociety.org>2013-10-24 21:34:46 +0100
commitcd51c26830d4f6ba144874e2f26010f7b6b76636 (patch)
tree17a0316b6c461e2ba45ac1d462772bf37fddc38e /t/app/model/problem.t
parent0b28f2ac1af652c37eda35f944b5eb78f4adf5d1 (diff)
Fix test suite to run regardless of config setup.
Diffstat (limited to 't/app/model/problem.t')
-rw-r--r--t/app/model/problem.t18
1 files changed, 12 insertions, 6 deletions
diff --git a/t/app/model/problem.t b/t/app/model/problem.t
index 9138c11a8..18c210f6f 100644
--- a/t/app/model/problem.t
+++ b/t/app/model/problem.t
@@ -497,7 +497,7 @@ foreach my $test ( {
dear => qr'Dear Staffordshire County Council,',
body => '2240',
cobrand => 'lichfielddc',
- url => '',
+ url => 'www.',
}, {
%common,
desc => 'directs NI correctly, 1',
@@ -526,8 +526,13 @@ foreach my $test ( {
},
) {
subtest $test->{ desc } => sub {
- if ( $test->{cobrand} && $test->{cobrand} =~ /lichfielddc/ && !FixMyStreet::Cobrand->exists('lichfielddc') ) {
- plan skip_all => 'Skipping Lichfield tests without Lichfield cobrand';
+ my $override = {
+ ALLOWED_COBRANDS => [ 'fixmystreet' ],
+ BASE_URL => 'http://www.fixmystreet.com',
+ MAPIT_URL => 'http://mapit.mysociety.org/',
+ };
+ if ( $test->{cobrand} && $test->{cobrand} =~ /lichfielddc/ ) {
+ $override->{ALLOWED_COBRANDS} = [ 'lichfielddc' ];
}
$mech->clear_emails_ok;
@@ -549,7 +554,9 @@ foreach my $test ( {
cobrand => $test->{ cobrand } || 'fixmystreet',
} );
- FixMyStreet::App->model('DB::Problem')->send_reports();
+ FixMyStreet::override_config $override, sub {
+ FixMyStreet::App->model('DB::Problem')->send_reports();
+ };
$mech->email_count_is( $test->{ email_count } );
if ( $test->{ email_count } ) {
@@ -568,9 +575,8 @@ foreach my $test ( {
}
if ( $test->{url} ) {
- (my $base_url = FixMyStreet->config('BASE_URL')) =~ s{http://}{};
my $id = $problem->id;
- like $email->body, qr[$test->{url}$base_url/report/$id], 'URL present is correct';
+ like $email->body, qr[$test->{url}fixmystreet.com/report/$id], 'URL present is correct';
}
$problem->discard_changes;