Commit 583ec932 authored by charlieablett's avatar charlieablett

Tiny refactor of spam tests

parent 3c6ac64e
...@@ -103,7 +103,7 @@ describe Spam::SpamCheckService do ...@@ -103,7 +103,7 @@ describe Spam::SpamCheckService do
issue.description = 'SPAM!' issue.description = 'SPAM!'
end end
context 'when indicated as spam by akismet' do context 'when indicated as spam by Akismet' do
before do before do
allow(Spam::AkismetService).to receive(:new).and_return(double(spam?: true)) allow(Spam::AkismetService).to receive(:new).and_return(double(spam?: true))
end end
...@@ -115,7 +115,7 @@ describe Spam::SpamCheckService do ...@@ -115,7 +115,7 @@ describe Spam::SpamCheckService do
it_behaves_like 'akismet spam' it_behaves_like 'akismet spam'
it 'checks as spam' do it 'marks as spam' do
subject subject
expect(issue.reload.spam).to be_truthy expect(issue.reload.spam).to be_truthy
...@@ -125,7 +125,7 @@ describe Spam::SpamCheckService do ...@@ -125,7 +125,7 @@ describe Spam::SpamCheckService do
context 'when allow_possible_spam feature flag is true' do context 'when allow_possible_spam feature flag is true' do
it_behaves_like 'akismet spam' it_behaves_like 'akismet spam'
it 'does not check as spam' do it 'does not mark as spam' do
subject subject
expect(issue.spam).to be_falsey expect(issue.spam).to be_falsey
...@@ -133,7 +133,7 @@ describe Spam::SpamCheckService do ...@@ -133,7 +133,7 @@ describe Spam::SpamCheckService do
end end
end end
context 'when not indicated as spam by akismet' do context 'when not indicated as spam by Akismet' do
before do before do
allow(Spam::AkismetService).to receive(:new).and_return(double(spam?: false)) allow(Spam::AkismetService).to receive(:new).and_return(double(spam?: false))
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