diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
commit | 9297025d0b7ddf095eb618dfaaab2ff8f2018d8b (patch) | |
tree | 865198c01d1824a9b098127baa3ab980c9cd2c06 /spec/services/service_desk/custom_email_verifications/create_service_spec.rb | |
parent | 6372471f43ee03c05a7c1f8b0c6ac6b8a7431dbe (diff) |
Add latest changes from gitlab-org/gitlab@16-7-stable-eev16.7.0-rc42
Diffstat (limited to 'spec/services/service_desk/custom_email_verifications/create_service_spec.rb')
-rw-r--r-- | spec/services/service_desk/custom_email_verifications/create_service_spec.rb | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/spec/services/service_desk/custom_email_verifications/create_service_spec.rb b/spec/services/service_desk/custom_email_verifications/create_service_spec.rb index 0046213e0b2..03c5743434e 100644 --- a/spec/services/service_desk/custom_email_verifications/create_service_spec.rb +++ b/spec/services/service_desk/custom_email_verifications/create_service_spec.rb @@ -14,7 +14,6 @@ RSpec.describe ServiceDesk::CustomEmailVerifications::CreateService, feature_cat let(:service) { described_class.new(project: project, current_user: user) } - let(:error_feature_flag_disabled) { 'Feature flag service_desk_custom_email is not enabled' } let(:error_user_not_authorized) { s_('ServiceDesk|User cannot manage project.') } let(:error_settings_missing) { s_('ServiceDesk|Service Desk setting missing') } let(:expected_error_message) { error_settings_missing } @@ -45,7 +44,7 @@ RSpec.describe ServiceDesk::CustomEmailVerifications::CreateService, feature_cat end end - shared_examples 'a verification process with ramp up error' do |error, error_identifier| + shared_examples 'a verification process with ramp up error' do it 'aborts verification process', :aggregate_failures do allow(message).to receive(:deliver).and_raise(error) @@ -80,16 +79,6 @@ RSpec.describe ServiceDesk::CustomEmailVerifications::CreateService, feature_cat it_behaves_like 'a verification process that exits early' - context 'when feature flag :service_desk_custom_email is disabled' do - let(:expected_error_message) { error_feature_flag_disabled } - - before do - stub_feature_flags(service_desk_custom_email: false) - end - - it_behaves_like 'a verification process that exits early' - end - context 'when service desk setting exists' do let(:settings) { create(:service_desk_setting, project: project, custom_email: 'user@example.com') } let(:service) { described_class.new(project: settings.project, current_user: user) } @@ -115,7 +104,7 @@ RSpec.describe ServiceDesk::CustomEmailVerifications::CreateService, feature_cat end context 'when user has maintainer role in project' do - before do + before_all do project.add_maintainer(user) end @@ -151,10 +140,25 @@ RSpec.describe ServiceDesk::CustomEmailVerifications::CreateService, feature_cat allow(Notify).to receive(:service_desk_verification_result_email).and_return(message_delivery) end - it_behaves_like 'a verification process with ramp up error', SocketError, 'smtp_host_issue' - it_behaves_like 'a verification process with ramp up error', OpenSSL::SSL::SSLError, 'smtp_host_issue' - it_behaves_like 'a verification process with ramp up error', - Net::SMTPAuthenticationError.new('Invalid username or password'), 'invalid_credentials' + it_behaves_like 'a verification process with ramp up error' do + let(:error) { SocketError } + let(:error_identifier) { 'smtp_host_issue' } + end + + it_behaves_like 'a verification process with ramp up error' do + let(:error) { OpenSSL::SSL::SSLError } + let(:error_identifier) { 'smtp_host_issue' } + end + + it_behaves_like 'a verification process with ramp up error' do + let(:error) { Net::SMTPAuthenticationError.new('Invalid username or password') } + let(:error_identifier) { 'invalid_credentials' } + end + + it_behaves_like 'a verification process with ramp up error' do + let(:error) { Net::ReadTimeout } + let(:error_identifier) { 'read_timeout' } + end end end end |