diff options
Diffstat (limited to 'spec/controllers/groups_controller_spec.rb')
-rw-r--r-- | spec/controllers/groups_controller_spec.rb | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb index 4a74eff90dc..aabceda7187 100644 --- a/spec/controllers/groups_controller_spec.rb +++ b/spec/controllers/groups_controller_spec.rb @@ -18,7 +18,6 @@ RSpec.describe GroupsController, factory_default: :keep do let_it_be(:guest) { group.add_guest(create(:user)).user } before do - stub_feature_flags(vue_issues_list: true) enable_admin_mode!(admin_with_admin_mode) end @@ -373,13 +372,26 @@ RSpec.describe GroupsController, factory_default: :keep do end end - it 'displays an error when the reCAPTCHA is not solved' do - allow(controller).to receive(:verify_recaptcha).and_return(false) + context 'when the reCAPTCHA is not solved' do + before do + allow(controller).to receive(:verify_recaptcha).and_return(false) + end - post :create, params: { group: { name: 'new_group', path: "new_group" } } + it 'displays an error' do + post :create, params: { group: { name: 'new_group', path: "new_group" } } + + expect(response).to render_template(:new) + expect(flash[:alert]).to eq(_('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')) + end + + it 'sets gon variables' do + Gon.clear + + post :create, params: { group: { name: 'new_group', path: "new_group" } } - expect(response).to render_template(:new) - expect(flash[:alert]).to eq(_('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')) + expect(response).to render_template(:new) + expect(Gon.all_variables).not_to be_empty + end end it 'allows creating a group when the reCAPTCHA is solved' do |