File tree Expand file tree Collapse file tree 2 files changed +31
-3
lines changed
Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Original file line number Diff line number Diff line change 3636 but_i_do_not_see_the_move_link
3737 and_i_cannot_visit_the_move_form_page
3838 end
39+
40+ scenario "not choosing a form" do
41+ given_i_am_logged_in_as_an_organisation_admin
42+ and_i_see_the_move_form_page
43+ when_i_do_not_choose_a_group
44+ then_i_see_an_error_message
45+ end
3946 end
4047
4148 def given_i_am_logged_in_as_an_organisation_admin
@@ -75,6 +82,8 @@ def then_i_see_the_move_form_page
7582 expect ( page ) . to have_content ( another_group . name )
7683 end
7784
85+ alias_method :and_i_see_the_move_form_page , :then_i_see_the_move_form_page
86+
7887 def when_i_change_the_group
7988 choose ( another_group . name )
8089 click_button "Continue"
@@ -92,4 +101,13 @@ def and_the_other_group_has_the_form
92101
93102 expect ( page ) . to have_content ( form . name )
94103 end
104+
105+ def when_i_do_not_choose_a_group
106+ click_button "Continue"
107+ end
108+
109+ def then_i_see_an_error_message
110+ expect ( page ) . to have_content ( "There is a problem" )
111+ expect ( page ) . to have_content ( "Select a group" )
112+ end
95113end
Original file line number Diff line number Diff line change 7272 describe "PATCH /update" do
7373 let ( :other_group ) { create ( :group , organisation : organisation_admin_user . organisation ) }
7474
75- it "redirects to the group" do
76- patch group_form_url ( group , id : form . id ) , params : { forms_group_select : { group : other_group . id } }
75+ context "with valid parameters" do
76+ it "redirects to the group" do
77+ patch group_form_url ( group , id : form . id ) , params : { forms_group_select : { group : other_group . id } }
7778
78- expect ( response ) . to redirect_to ( group_url ( group ) )
79+ expect ( response ) . to redirect_to ( group_url ( group ) )
80+ end
81+ end
82+
83+ context "with missing form group parameter" do
84+ it "re-renders the form with an error" do
85+ patch group_form_url ( group , id : form . id ) , params : { forms_group_select : { group : nil } }
86+
87+ expect ( response ) . to have_http_status :see_other
88+ end
7989 end
8090 end
8191 end
You can’t perform that action at this time.
0 commit comments