diff options
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/import/fogbugz_controller_spec.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/spec/controllers/import/fogbugz_controller_spec.rb b/spec/controllers/import/fogbugz_controller_spec.rb index 386bfcb8b3a..ed2a588eadf 100644 --- a/spec/controllers/import/fogbugz_controller_spec.rb +++ b/spec/controllers/import/fogbugz_controller_spec.rb @@ -29,12 +29,21 @@ RSpec.describe Import::FogbugzController do expect(response).to redirect_to(new_user_map_import_fogbugz_path) end - it 'preserves namespace_id query param' do + it 'preserves namespace_id query param on success' do post :callback, params: { uri: uri, email: 'test@example.com', password: 'mypassword', namespace_id: namespace_id } expect(response).to redirect_to(new_user_map_import_fogbugz_path(namespace_id: namespace_id)) end + it 'redirects to new page maintaining namespace_id when client raises standard error' do + namespace_id = 5 + allow(::Gitlab::FogbugzImport::Client).to receive(:new).and_raise(StandardError) + + post :callback, params: { uri: uri, email: 'test@example.com', password: 'mypassword', namespace_id: namespace_id } + + expect(response).to redirect_to(new_import_fogbugz_url(namespace_id: namespace_id)) + end + it 'redirects to new page form when client raises authentication exception' do allow(::Gitlab::FogbugzImport::Client).to receive(:new).and_raise(::Fogbugz::AuthenticationException) |