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
fa030cbc
Commit
fa030cbc
authored
Aug 24, 2017
by
Maxim Rydkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace `is_spam?` with `spam?`
parent
1c0def2a
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
26 additions
and
26 deletions
+26
-26
app/services/akismet_service.rb
app/services/akismet_service.rb
+1
-1
app/services/spam_service.rb
app/services/spam_service.rb
+1
-1
spec/controllers/projects/issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+4
-4
spec/controllers/projects/snippets_controller_spec.rb
spec/controllers/projects/snippets_controller_spec.rb
+2
-2
spec/controllers/snippets_controller_spec.rb
spec/controllers/snippets_controller_spec.rb
+2
-2
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+2
-2
spec/requests/api/project_snippets_spec.rb
spec/requests/api/project_snippets_spec.rb
+2
-2
spec/requests/api/snippets_spec.rb
spec/requests/api/snippets_spec.rb
+2
-2
spec/requests/api/v3/issues_spec.rb
spec/requests/api/v3/issues_spec.rb
+2
-2
spec/requests/api/v3/project_snippets_spec.rb
spec/requests/api/v3/project_snippets_spec.rb
+2
-2
spec/requests/api/v3/snippets_spec.rb
spec/requests/api/v3/snippets_spec.rb
+1
-1
spec/services/issues/create_service_spec.rb
spec/services/issues/create_service_spec.rb
+2
-2
spec/services/spam_service_spec.rb
spec/services/spam_service_spec.rb
+3
-3
No files found.
app/services/akismet_service.rb
View file @
fa030cbc
...
...
@@ -7,7 +7,7 @@ class AkismetService
@options
=
options
end
def
is_
spam?
def
spam?
return
false
unless
akismet_enabled?
params
=
{
...
...
app/services/spam_service.rb
View file @
fa030cbc
...
...
@@ -45,7 +45,7 @@ class SpamService
def
check
(
api
)
return
false
unless
request
&&
check_for_spam?
return
false
unless
akismet
.
is_
spam?
return
false
unless
akismet
.
spam?
create_spam_log
(
api
)
true
...
...
spec/controllers/projects/issues_controller_spec.rb
View file @
fa030cbc
...
...
@@ -268,7 +268,7 @@ describe Projects::IssuesController do
context
'when an issue is not identified as spam'
do
before
do
allow_any_instance_of
(
described_class
).
to
receive
(
:verify_recaptcha
).
and_return
(
false
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:
is_
spam?
).
and_return
(
false
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:spam?
).
and_return
(
false
)
end
it
'normally updates the issue'
do
...
...
@@ -278,7 +278,7 @@ describe Projects::IssuesController do
context
'when an issue is identified as spam'
do
before
do
allow_any_instance_of
(
AkismetService
).
to
receive
(
:
is_
spam?
).
and_return
(
true
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:spam?
).
and_return
(
true
)
end
context
'when captcha is not verified'
do
...
...
@@ -672,7 +672,7 @@ describe Projects::IssuesController do
context
'when an issue is not identified as spam'
do
before
do
allow_any_instance_of
(
described_class
).
to
receive
(
:verify_recaptcha
).
and_return
(
false
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:
is_
spam?
).
and_return
(
false
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:spam?
).
and_return
(
false
)
end
it
'does not create an issue'
do
...
...
@@ -682,7 +682,7 @@ describe Projects::IssuesController do
context
'when an issue is identified as spam'
do
before
do
allow_any_instance_of
(
AkismetService
).
to
receive
(
:
is_
spam?
).
and_return
(
true
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:spam?
).
and_return
(
true
)
end
context
'when captcha is not verified'
do
...
...
spec/controllers/projects/snippets_controller_spec.rb
View file @
fa030cbc
...
...
@@ -98,7 +98,7 @@ describe Projects::SnippetsController do
context
'when the snippet is spam'
do
before
do
allow_any_instance_of
(
AkismetService
).
to
receive
(
:
is_
spam?
).
and_return
(
true
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:spam?
).
and_return
(
true
)
end
context
'when the snippet is private'
do
...
...
@@ -176,7 +176,7 @@ describe Projects::SnippetsController do
context
'when the snippet is spam'
do
before
do
allow_any_instance_of
(
AkismetService
).
to
receive
(
:
is_
spam?
).
and_return
(
true
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:spam?
).
and_return
(
true
)
end
context
'when the snippet is private'
do
...
...
spec/controllers/snippets_controller_spec.rb
View file @
fa030cbc
...
...
@@ -217,7 +217,7 @@ describe SnippetsController do
context
'when the snippet is spam'
do
before
do
allow_any_instance_of
(
AkismetService
).
to
receive
(
:
is_
spam?
).
and_return
(
true
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:spam?
).
and_return
(
true
)
end
context
'when the snippet is private'
do
...
...
@@ -289,7 +289,7 @@ describe SnippetsController do
context
'when the snippet is spam'
do
before
do
allow_any_instance_of
(
AkismetService
).
to
receive
(
:
is_
spam?
).
and_return
(
true
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:spam?
).
and_return
(
true
)
end
context
'when the snippet is private'
do
...
...
spec/requests/api/issues_spec.rb
View file @
fa030cbc
...
...
@@ -984,7 +984,7 @@ describe API::Issues, :mailer do
describe
'POST /projects/:id/issues with spam filtering'
do
before
do
allow_any_instance_of
(
SpamService
).
to
receive
(
:check_for_spam?
).
and_return
(
true
)
allow_any_instance_of
(
AkismetService
).
to
receive_messages
(
is_
spam?:
true
)
allow_any_instance_of
(
AkismetService
).
to
receive_messages
(
spam?:
true
)
end
let
(
:params
)
do
...
...
@@ -1114,7 +1114,7 @@ describe API::Issues, :mailer do
it
"does not create a new project issue"
do
allow_any_instance_of
(
SpamService
).
to
receive_messages
(
check_for_spam?:
true
)
allow_any_instance_of
(
AkismetService
).
to
receive_messages
(
is_
spam?:
true
)
allow_any_instance_of
(
AkismetService
).
to
receive_messages
(
spam?:
true
)
put
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
"
,
user
),
params
...
...
spec/requests/api/project_snippets_spec.rb
View file @
fa030cbc
...
...
@@ -117,7 +117,7 @@ describe API::ProjectSnippets do
end
before
do
allow_any_instance_of
(
AkismetService
).
to
receive
(
:
is_
spam?
).
and_return
(
true
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:spam?
).
and_return
(
true
)
end
context
'when the snippet is private'
do
...
...
@@ -179,7 +179,7 @@ describe API::ProjectSnippets do
end
before
do
allow_any_instance_of
(
AkismetService
).
to
receive
(
:
is_
spam?
).
and_return
(
true
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:spam?
).
and_return
(
true
)
end
context
'when the snippet is private'
do
...
...
spec/requests/api/snippets_spec.rb
View file @
fa030cbc
...
...
@@ -137,7 +137,7 @@ describe API::Snippets do
end
before
do
allow_any_instance_of
(
AkismetService
).
to
receive
(
:
is_
spam?
).
and_return
(
true
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:spam?
).
and_return
(
true
)
end
context
'when the snippet is private'
do
...
...
@@ -209,7 +209,7 @@ describe API::Snippets do
end
before
do
allow_any_instance_of
(
AkismetService
).
to
receive
(
:
is_
spam?
).
and_return
(
true
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:spam?
).
and_return
(
true
)
end
context
'when the snippet is private'
do
...
...
spec/requests/api/v3/issues_spec.rb
View file @
fa030cbc
...
...
@@ -884,7 +884,7 @@ describe API::V3::Issues, :mailer do
describe
'POST /projects/:id/issues with spam filtering'
do
before
do
allow_any_instance_of
(
SpamService
).
to
receive
(
:check_for_spam?
).
and_return
(
true
)
allow_any_instance_of
(
AkismetService
).
to
receive_messages
(
is_
spam?:
true
)
allow_any_instance_of
(
AkismetService
).
to
receive_messages
(
spam?:
true
)
end
let
(
:params
)
do
...
...
@@ -1016,7 +1016,7 @@ describe API::V3::Issues, :mailer do
it
"does not create a new project issue"
do
allow_any_instance_of
(
SpamService
).
to
receive_messages
(
check_for_spam?:
true
)
allow_any_instance_of
(
AkismetService
).
to
receive_messages
(
is_
spam?:
true
)
allow_any_instance_of
(
AkismetService
).
to
receive_messages
(
spam?:
true
)
put
v3_api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
id
}
"
,
user
),
params
...
...
spec/requests/api/v3/project_snippets_spec.rb
View file @
fa030cbc
...
...
@@ -80,7 +80,7 @@ describe API::ProjectSnippets do
end
before
do
allow_any_instance_of
(
AkismetService
).
to
receive
(
:
is_
spam?
).
and_return
(
true
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:spam?
).
and_return
(
true
)
end
context
'when the snippet is private'
do
...
...
@@ -140,7 +140,7 @@ describe API::ProjectSnippets do
end
before
do
allow_any_instance_of
(
AkismetService
).
to
receive
(
:
is_
spam?
).
and_return
(
true
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:spam?
).
and_return
(
true
)
end
context
'when the snippet is private'
do
...
...
spec/requests/api/v3/snippets_spec.rb
View file @
fa030cbc
...
...
@@ -107,7 +107,7 @@ describe API::V3::Snippets do
end
before
do
allow_any_instance_of
(
AkismetService
).
to
receive
(
:
is_
spam?
).
and_return
(
true
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:spam?
).
and_return
(
true
)
end
context
'when the snippet is private'
do
...
...
spec/services/issues/create_service_spec.rb
View file @
fa030cbc
...
...
@@ -370,7 +370,7 @@ describe Issues::CreateService do
context
'when recaptcha was not verified'
do
context
'when akismet detects spam'
do
before
do
allow_any_instance_of
(
AkismetService
).
to
receive
(
:
is_
spam?
).
and_return
(
true
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:spam?
).
and_return
(
true
)
end
it
'marks an issue as a spam '
do
...
...
@@ -392,7 +392,7 @@ describe Issues::CreateService do
context
'when akismet does not detect spam'
do
before
do
allow_any_instance_of
(
AkismetService
).
to
receive
(
:
is_
spam?
).
and_return
(
false
)
allow_any_instance_of
(
AkismetService
).
to
receive
(
:spam?
).
and_return
(
false
)
end
it
'does not mark an issue as a spam '
do
...
...
spec/services/spam_service_spec.rb
View file @
fa030cbc
...
...
@@ -23,7 +23,7 @@ describe SpamService do
before
do
issue
.
closed_at
=
Time
.
zone
.
now
allow
(
AkismetService
).
to
receive
(
:new
).
and_return
(
double
(
is_
spam?:
true
))
allow
(
AkismetService
).
to
receive
(
:new
).
and_return
(
double
(
spam?:
true
))
end
it
'returns false'
do
...
...
@@ -43,7 +43,7 @@ describe SpamService do
context
'when indicated as spam by akismet'
do
before
do
allow
(
AkismetService
).
to
receive
(
:new
).
and_return
(
double
(
is_
spam?:
true
))
allow
(
AkismetService
).
to
receive
(
:new
).
and_return
(
double
(
spam?:
true
))
end
it
'doesnt check as spam when request is missing'
do
...
...
@@ -71,7 +71,7 @@ describe SpamService do
context
'when not indicated as spam by akismet'
do
before
do
allow
(
AkismetService
).
to
receive
(
:new
).
and_return
(
double
(
is_
spam?:
false
))
allow
(
AkismetService
).
to
receive
(
:new
).
and_return
(
double
(
spam?:
false
))
end
it
'returns false'
do
...
...
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