aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorZarino Zappia <mail@zarino.co.uk>2017-07-18 16:42:49 +0100
committerZarino Zappia <mail@zarino.co.uk>2017-07-28 14:35:48 +0100
commit405cf67716a5d6ec835973d7093e3a71f9b52879 (patch)
tree3f3a993eb8c34c955b8dc2bd84a066369460ca13 /t/app/controller
parent9d5e44842fdac0d3894ed82885a4079df85ba890 (diff)
Option to redirect to custom URL from Contact form
If a `success_url` parameter is provided along with the contact form fields, the user will be redirected to that URL upon successful form submission. We use it for the first time on the (UK) FixMyStreet Pro marketing page.
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/contact.t35
1 files changed, 35 insertions, 0 deletions
diff --git a/t/app/controller/contact.t b/t/app/controller/contact.t
index 0e87eb4cc..c1039d15b 100644
--- a/t/app/controller/contact.t
+++ b/t/app/controller/contact.t
@@ -380,6 +380,41 @@ for my $test (
};
}
+for my $test (
+ {
+ fields => {
+ em => 'test@example.com',
+ name => 'A name',
+ subject => 'A subject',
+ message => 'A message',
+ dest => 'from_council',
+ success_url => '/faq',
+ },
+ url_should_be => 'http://localhost/faq',
+ },
+ {
+ fields => {
+ em => 'test@example.com',
+ name => 'A name',
+ subject => 'A subject',
+ message => 'A message',
+ dest => 'from_council',
+ success_url => 'http://www.example.com',
+ },
+ url_should_be => 'http://www.example.com',
+ },
+ )
+{
+ subtest 'check user can be redirected to a custom URL after contact form is submitted' => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'fixmystreet' ],
+ }, sub {
+ $mech->post('/contact/submit', $test->{fields});
+ is $mech->uri->as_string, $test->{url_should_be};
+ }
+ };
+}
+
$problem_main->delete;
done_testing();