aboutsummaryrefslogtreecommitdiffstats
path: root/t/app
diff options
context:
space:
mode:
Diffstat (limited to 't/app')
-rw-r--r--t/app/01app.t10
-rw-r--r--t/app/02pod.t10
-rw-r--r--t/app/03podcoverage.t14
-rw-r--r--t/app/controller/about.t24
-rw-r--r--t/app/load_general_config.t13
-rw-r--r--t/app/page_not_found.t20
-rw-r--r--t/app/view_Web.t8
7 files changed, 99 insertions, 0 deletions
diff --git a/t/app/01app.t b/t/app/01app.t
new file mode 100644
index 000000000..02ffcd217
--- /dev/null
+++ b/t/app/01app.t
@@ -0,0 +1,10 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+use Catalyst::Test 'FixMyStreet::App';
+
+ok( request('/')->is_success, 'Request should succeed' );
+
+done_testing();
diff --git a/t/app/02pod.t b/t/app/02pod.t
new file mode 100644
index 000000000..ababc2eaa
--- /dev/null
+++ b/t/app/02pod.t
@@ -0,0 +1,10 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+eval "use Test::Pod 1.14";
+plan skip_all => 'Test::Pod 1.14 required' if $@;
+
+all_pod_files_ok();
diff --git a/t/app/03podcoverage.t b/t/app/03podcoverage.t
new file mode 100644
index 000000000..6ddc5c6b6
--- /dev/null
+++ b/t/app/03podcoverage.t
@@ -0,0 +1,14 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
+
+eval "use Pod::Coverage 0.20";
+plan skip_all => 'Pod::Coverage 0.20 required' if $@;
+
+all_pod_coverage_ok();
diff --git a/t/app/controller/about.t b/t/app/controller/about.t
new file mode 100644
index 000000000..adbce8f25
--- /dev/null
+++ b/t/app/controller/about.t
@@ -0,0 +1,24 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::WWW::Mechanize::Catalyst 'FixMyStreet::App';
+
+ok( my $mech = Test::WWW::Mechanize::Catalyst->new, 'Created mech object' );
+
+# check that we can get the page
+$mech->get_ok('/about');
+$mech->content_contains('FixMyStreet.com');
+
+# check that geting the page as EHA produces a different page
+ok $mech->host("reportemptyhomes.co.uk"), 'change host to reportemptyhomes';
+$mech->get_ok('/about');
+$mech->content_contains('The Empty Homes Agency');
+
+# check that geting the page as EHA in welsh produces a different page
+ok $mech->host("cy.reportemptyhomes.co.uk"),
+ 'change host to cy.reportemptyhomes';
+$mech->get_ok('/about');
+$mech->content_contains('Yr Asiantaeth Tai Gwag');
+
+done_testing();
diff --git a/t/app/load_general_config.t b/t/app/load_general_config.t
new file mode 100644
index 000000000..3855c2565
--- /dev/null
+++ b/t/app/load_general_config.t
@@ -0,0 +1,13 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+
+use_ok 'FixMyStreet::App';
+
+# GAZE_URL chosen as it is unlikely to change
+is FixMyStreet::App->config->{GAZE_URL}, #
+ 'http://gaze.mysociety.org/gaze', #
+ "check that known config param is loaded";
diff --git a/t/app/page_not_found.t b/t/app/page_not_found.t
new file mode 100644
index 000000000..9c8d7e5a6
--- /dev/null
+++ b/t/app/page_not_found.t
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+
+use Test::WWW::Mechanize::Catalyst 'FixMyStreet::App';
+
+my $mech = Test::WWW::Mechanize::Catalyst->new;
+
+# homepage ok
+$mech->get_ok('/');
+
+# get 404 page
+my $path_to_404 = '/bad/path/page_not_found';
+my $res = $mech->get($path_to_404);
+ok !$res->is_success(), "want a bad response";
+is $res->code, 404, "got 404";
+$mech->content_contains($path_to_404);
diff --git a/t/app/view_Web.t b/t/app/view_Web.t
new file mode 100644
index 000000000..0f49b986b
--- /dev/null
+++ b/t/app/view_Web.t
@@ -0,0 +1,8 @@
+use strict;
+use warnings;
+use Test::More;
+use Test::More;
+
+BEGIN { use_ok 'FixMyStreet::App::View::Web' }
+
+done_testing();