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
5968a3a5
Commit
5968a3a5
authored
Apr 06, 2020
by
charlieablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small spam tidbits
- Fix some typos - One-line fixes to tighten up tests
parent
852bf484
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
20 deletions
+19
-20
spec/controllers/projects/issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+2
-2
spec/features/issues/spam_issues_spec.rb
spec/features/issues/spam_issues_spec.rb
+2
-2
spec/features/snippets/spam_snippets_spec.rb
spec/features/snippets/spam_snippets_spec.rb
+2
-2
spec/services/issues/create_service_spec.rb
spec/services/issues/create_service_spec.rb
+9
-8
spec/services/snippets/create_service_spec.rb
spec/services/snippets/create_service_spec.rb
+1
-1
spec/services/spam/spam_check_service_spec.rb
spec/services/spam/spam_check_service_spec.rb
+3
-5
No files found.
spec/controllers/projects/issues_controller_spec.rb
View file @
5968a3a5
...
...
@@ -725,7 +725,7 @@ describe Projects::IssuesController do
stub_feature_flags
(
allow_possible_spam:
false
)
end
it
'rejects an issue recognized as
a
spam'
do
it
'rejects an issue recognized as spam'
do
expect
{
update_issue
}.
not_to
change
{
issue
.
reload
.
title
}
end
...
...
@@ -981,7 +981,7 @@ describe Projects::IssuesController do
stub_feature_flags
(
allow_possible_spam:
false
)
end
it
'rejects an issue recognized as
a
spam'
do
it
'rejects an issue recognized as spam'
do
expect
{
post_spam_issue
}.
not_to
change
(
Issue
,
:count
)
end
...
...
spec/features/issues/spam_issues_spec.rb
View file @
5968a3a5
...
...
@@ -23,7 +23,7 @@ describe 'New issue', :js do
sign_in
(
user
)
end
context
'when identified as
a
spam'
do
context
'when identified as spam'
do
before
do
WebMock
.
stub_request
(
:any
,
/.*akismet.com.*/
).
to_return
(
body:
"true"
,
status:
200
)
...
...
@@ -74,7 +74,7 @@ describe 'New issue', :js do
end
end
context
'when not identified as
a
spam'
do
context
'when not identified as spam'
do
before
do
WebMock
.
stub_request
(
:any
,
/.*akismet.com.*/
).
to_return
(
body:
'false'
,
status:
200
)
...
...
spec/features/snippets/spam_snippets_spec.rb
View file @
5968a3a5
...
...
@@ -52,7 +52,7 @@ shared_examples_for 'snippet editor' do
end
end
context
'when identified as
a
spam'
do
context
'when identified as spam'
do
before
do
WebMock
.
stub_request
(
:any
,
/.*akismet.com.*/
).
to_return
(
body:
"true"
,
status:
200
)
end
...
...
@@ -66,7 +66,7 @@ shared_examples_for 'snippet editor' do
end
end
context
'when not identified as
a
spam'
do
context
'when not identified as spam'
do
before
do
WebMock
.
stub_request
(
:any
,
/.*akismet.com.*/
).
to_return
(
body:
"false"
,
status:
200
)
end
...
...
spec/services/issues/create_service_spec.rb
View file @
5968a3a5
...
...
@@ -383,20 +383,21 @@ describe Issues::CreateService do
context
'when recaptcha was verified'
do
let
(
:log_user
)
{
user
}
let
(
:spam_logs
)
{
create_list
(
:spam_log
,
2
,
user:
log_user
,
title:
'Awesome issue'
)
}
let
(
:target_spam_log
)
{
spam_logs
.
last
}
before
do
opts
[
:recaptcha_verified
]
=
true
opts
[
:spam_log_id
]
=
spam_logs
.
last
.
id
opts
[
:spam_log_id
]
=
target_spam_log
.
id
expect
(
Spam
::
AkismetService
).
not_to
receive
(
:new
)
end
it
'does no
mark an issue as a spam
'
do
it
'does no
t mark an issue as spam
'
do
expect
(
issue
).
not_to
be_spam
end
it
'
an
issue is valid '
do
expect
(
issue
.
valid?
).
to
be_truthy
it
'issue is valid '
do
expect
(
issue
).
to
be_valid
end
it
'does not assign a spam_log to an issue'
do
...
...
@@ -431,7 +432,7 @@ describe Issues::CreateService do
end
context
'when issuables_recaptcha_enabled feature flag is true'
do
it
'marks an issue as
a spam
'
do
it
'marks an issue as
spam
'
do
expect
(
issue
).
to
be_spam
end
...
...
@@ -444,7 +445,7 @@ describe Issues::CreateService do
.
to
have_spam_log
(
title:
issue
.
title
,
description:
issue
.
description
,
user_id:
user
.
id
,
noteable_type:
'Issue'
)
end
it
'assigns a spam_log to
an
issue'
do
it
'assigns a spam_log to
the
issue'
do
expect
(
issue
.
spam_log
).
to
eq
(
SpamLog
.
last
)
end
end
...
...
@@ -454,7 +455,7 @@ describe Issues::CreateService do
stub_feature_flags
(
allow_possible_spam:
true
)
end
it
'does not mark an issue as
a spam
'
do
it
'does not mark an issue as
spam
'
do
expect
(
issue
).
not_to
be_spam
end
...
...
@@ -480,7 +481,7 @@ describe Issues::CreateService do
end
end
it
'does not mark an issue as
a spam
'
do
it
'does not mark an issue as
spam
'
do
expect
(
issue
).
not_to
be_spam
end
...
...
spec/services/snippets/create_service_spec.rb
View file @
5968a3a5
...
...
@@ -76,7 +76,7 @@ describe Snippets::CreateService do
shared_examples
'spam check is performed'
do
shared_examples
'marked as spam'
do
it
'marks a snippet as spam
'
do
it
'marks a snippet as spam'
do
expect
(
snippet
).
to
be_spam
end
...
...
spec/services/spam/spam_check_service_spec.rb
View file @
5968a3a5
...
...
@@ -91,9 +91,7 @@ describe Spam::SpamCheckService do
end
it
'updates spam log'
do
subject
expect
(
existing_spam_log
.
reload
.
recaptcha_verified
).
to
be_truthy
expect
{
subject
}.
to
change
{
existing_spam_log
.
reload
.
recaptcha_verified
}.
from
(
false
).
to
(
true
)
end
end
...
...
@@ -137,7 +135,7 @@ describe Spam::SpamCheckService do
it
'marks as spam'
do
subject
expect
(
issue
.
reload
.
spam
).
to
be_truthy
expect
(
issue
).
to
be_spam
end
end
...
...
@@ -147,7 +145,7 @@ describe Spam::SpamCheckService do
it
'does not mark as spam'
do
subject
expect
(
issue
.
spam
).
to
be_falsey
expect
(
issue
).
not_to
be_spam
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