aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/controller
diff options
context:
space:
mode:
authorEdmund von der Burg <evdb@mysociety.org>2011-04-01 15:45:17 +0100
committerEdmund von der Burg <evdb@mysociety.org>2011-04-01 15:45:17 +0100
commit00f183081599bfbb0b68724d058658123639fb84 (patch)
treecef5c77ba31bb493f89d5b1d34a5407f2bf523f3 /t/app/controller
parent1c80ae13c9f43e7ea68d6cbb3be5263319d24984 (diff)
prefill user's details if logged in
Diffstat (limited to 't/app/controller')
-rw-r--r--t/app/controller/report_new.t25
1 files changed, 24 insertions, 1 deletions
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index 61f009619..dca86db77 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -380,11 +380,35 @@ subtest "test report creation for a user who is logged in" => sub {
$mech->clear_emails_ok;
my $user = $mech->log_in_ok($test_email);
+ # setup the user.
+ ok $user->update(
+ {
+ name => 'Test User',
+ phone => '01234 567 890',
+ }
+ ),
+ "set users details";
+
# submit initial pc form
$mech->get_ok('/report/new');
$mech->submit_form_ok( { with_fields => { pc => 'SW1A 1AA', } },
"submit location" );
+ # check that the fields are correctly prefilled
+ is_deeply(
+ $mech->visible_form_values,
+ {
+ title => '',
+ detail => '',
+ may_show_name => '1',
+ email => $test_email,
+ name => 'Test User',
+ phone => '01234 567 890',
+ photo => '',
+ },
+ "user's details prefilled"
+ );
+
TODO: {
local $TODO =
"'/report/<<id>>' not handled by catalyst yet - form creation redirects to there on success if logged in";
@@ -397,7 +421,6 @@ subtest "test report creation for a user who is logged in" => sub {
photo => '',
name => 'Joe Bloggs',
may_show_name => '1',
- email => $test_email,
phone => '07903 123 456',
}
},