Commit e6421fb6 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'cablett-spam-service-test-refactor' into 'master'

Small spam_check_service test refactor

See merge request gitlab-org/gitlab!28306
parents be275e00 970cc541
......@@ -49,6 +49,25 @@ describe Spam::SpamCheckService do
end
end
shared_examples 'akismet spam' do
context 'when request is missing' do
let(:request) { nil }
it "doesn't check as spam" do
subject
expect(issue).not_to be_spam
end
end
context 'when request exists' do
it 'creates a spam log' do
expect { subject }
.to log_spam(title: issue.title, description: issue.description, noteable_type: 'Issue')
end
end
end
describe '#execute' do
let(:request) { double(:request, env: env) }
......
# frozen_string_literal: true
shared_examples 'akismet spam' do
context 'when request is missing' do
subject { described_class.new(spammable: issue, request: nil) }
it "doesn't check as spam" do
subject
expect(issue).not_to be_spam
end
end
context 'when request exists' do
it 'creates a spam log' do
expect { subject }
.to log_spam(title: issue.title, description: issue.description, noteable_type: 'Issue')
end
end
end
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