Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/spam/spam_action_service_spec.rb')
-rw-r--r--spec/services/spam/spam_action_service_spec.rb95
1 files changed, 37 insertions, 58 deletions
diff --git a/spec/services/spam/spam_action_service_spec.rb b/spec/services/spam/spam_action_service_spec.rb
index 8ddfa7ed3a0..bd8418d7092 100644
--- a/spec/services/spam/spam_action_service_spec.rb
+++ b/spec/services/spam/spam_action_service_spec.rb
@@ -170,26 +170,13 @@ RSpec.describe Spam::SpamActionService do
allow(fake_verdict_service).to receive(:execute).and_return(DISALLOW)
end
- context 'when allow_possible_spam feature flag is false' do
- before do
- stub_feature_flags(allow_possible_spam: false)
- end
+ it_behaves_like 'creates a spam log'
- it 'marks as spam' do
- response = subject
-
- expect(response.message).to match(expected_service_check_response_message)
- expect(issue).to be_spam
- end
- end
-
- context 'when allow_possible_spam feature flag is true' do
- it 'does not mark as spam' do
- response = subject
+ it 'marks as spam' do
+ response = subject
- expect(response.message).to match(expected_service_check_response_message)
- expect(issue).not_to be_spam
- end
+ expect(response.message).to match(expected_service_check_response_message)
+ expect(issue).to be_spam
end
end
@@ -198,26 +185,13 @@ RSpec.describe Spam::SpamActionService do
allow(fake_verdict_service).to receive(:execute).and_return(BLOCK_USER)
end
- context 'when allow_possible_spam feature flag is false' do
- before do
- stub_feature_flags(allow_possible_spam: false)
- end
-
- it 'marks as spam' do
- response = subject
+ it_behaves_like 'creates a spam log'
- expect(response.message).to match(expected_service_check_response_message)
- expect(issue).to be_spam
- end
- end
-
- context 'when allow_possible_spam feature flag is true' do
- it 'does not mark as spam' do
- response = subject
+ it 'marks as spam' do
+ response = subject
- expect(response.message).to match(expected_service_check_response_message)
- expect(issue).not_to be_spam
- end
+ expect(response.message).to match(expected_service_check_response_message)
+ expect(issue).to be_spam
end
end
@@ -226,37 +200,42 @@ RSpec.describe Spam::SpamActionService do
allow(fake_verdict_service).to receive(:execute).and_return(CONDITIONAL_ALLOW)
end
- context 'when allow_possible_spam feature flag is false' do
- before do
- stub_feature_flags(allow_possible_spam: false)
- end
+ it_behaves_like 'creates a spam log'
- it_behaves_like 'creates a spam log'
+ it 'does not mark as spam' do
+ response = subject
- it 'does not mark as spam' do
- response = subject
+ expect(response.message).to match(expected_service_check_response_message)
+ expect(issue).not_to be_spam
+ end
- expect(response.message).to match(expected_service_check_response_message)
- expect(issue).not_to be_spam
- end
+ it 'marks as needing reCAPTCHA' do
+ response = subject
- it 'marks as needing reCAPTCHA' do
- response = subject
+ expect(response.message).to match(expected_service_check_response_message)
+ expect(issue).to be_needs_recaptcha
+ end
+ end
- expect(response.message).to match(expected_service_check_response_message)
- expect(issue).to be_needs_recaptcha
- end
+ context 'when spam verdict service returns OVERRIDE_VIA_ALLOW_POSSIBLE_SPAM' do
+ before do
+ allow(fake_verdict_service).to receive(:execute).and_return(OVERRIDE_VIA_ALLOW_POSSIBLE_SPAM)
end
- context 'when allow_possible_spam feature flag is true' do
- it_behaves_like 'creates a spam log'
+ it_behaves_like 'creates a spam log'
- it 'does not mark as needing reCAPTCHA' do
- response = subject
+ it 'does not mark as spam' do
+ response = subject
+
+ expect(response.message).to match(expected_service_check_response_message)
+ expect(issue).not_to be_spam
+ end
+
+ it 'does not mark as needing CAPTCHA' do
+ response = subject
- expect(response.message).to match(expected_service_check_response_message)
- expect(issue.needs_recaptcha).to be_falsey
- end
+ expect(response.message).to match(expected_service_check_response_message)
+ expect(issue).not_to be_needs_recaptcha
end
end