Commit 631c8ff7 authored by Jarka Košanová's avatar Jarka Košanová

Merge branch 'cablett-spam-rename-verdict' into 'master'

Rename spam_verdict to external_verdict in SpamVerdictService

See merge request gitlab-org/gitlab!36522
parents 3b66458b 7421fef6
......@@ -14,7 +14,7 @@ module Spam
end
def execute
external_spam_check_result = spam_verdict
external_spam_check_result = external_verdict
akismet_result = akismet_verdict
# filter out anything we don't recognise, including nils.
......@@ -38,7 +38,7 @@ module Spam
end
end
def spam_verdict
def external_verdict
return unless Gitlab::CurrentSettings.spam_check_endpoint_enabled
return if endpoint_url.blank?
......
......@@ -27,7 +27,7 @@ RSpec.describe Spam::SpamVerdictService do
before do
allow(service).to receive(:akismet_verdict).and_return(nil)
allow(service).to receive(:spam_verdict_verdict).and_return(nil)
allow(service).to receive(:external_verdict).and_return(nil)
end
context 'if all services return nil' do
......@@ -62,7 +62,7 @@ RSpec.describe Spam::SpamVerdictService do
context 'and they are supported' do
before do
allow(service).to receive(:akismet_verdict).and_return(DISALLOW)
allow(service).to receive(:spam_verdict).and_return(BLOCK_USER)
allow(service).to receive(:external_verdict).and_return(BLOCK_USER)
end
it 'renders the more restrictive verdict' do
......@@ -73,7 +73,7 @@ RSpec.describe Spam::SpamVerdictService do
context 'and one is supported' do
before do
allow(service).to receive(:akismet_verdict).and_return('nonsense')
allow(service).to receive(:spam_verdict).and_return(BLOCK_USER)
allow(service).to receive(:external_verdict).and_return(BLOCK_USER)
end
it 'renders the more restrictive verdict' do
......@@ -84,7 +84,7 @@ RSpec.describe Spam::SpamVerdictService do
context 'and none are supported' do
before do
allow(service).to receive(:akismet_verdict).and_return('nonsense')
allow(service).to receive(:spam_verdict).and_return('rubbish')
allow(service).to receive(:external_verdict).and_return('rubbish')
end
it 'renders the more restrictive verdict' do
......@@ -149,8 +149,8 @@ RSpec.describe Spam::SpamVerdictService do
end
end
describe '#spam_verdict' do
subject { service.send(:spam_verdict) }
describe '#external_verdict' do
subject { service.send(:external_verdict) }
context 'if a Spam Check endpoint enabled and set to a URL' do
let(:spam_check_body) { {} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment