Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
970cc541
Commit
970cc541
authored
Mar 30, 2020
by
charlieablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small spam_check_service test refactor
parent
cdf6a458
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
20 deletions
+19
-20
spec/services/spam/spam_check_service_spec.rb
spec/services/spam/spam_check_service_spec.rb
+19
-0
spec/support/shared_examples/spam_check_shared_examples.rb
spec/support/shared_examples/spam_check_shared_examples.rb
+0
-20
No files found.
spec/services/spam/spam_check_service_spec.rb
View file @
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
)
}
...
...
spec/support/shared_examples/spam_check_shared_examples.rb
deleted
100644 → 0
View file @
cdf6a458
# 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment