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
2035704a
Commit
2035704a
authored
Jan 29, 2020
by
charlieablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move AkismetService into spam folder
Part of a general tidy of spam logic
parent
a15388de
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
103 additions
and
101 deletions
+103
-101
app/services/akismet_service.rb
app/services/akismet_service.rb
+0
-73
app/services/concerns/akismet_methods.rb
app/services/concerns/akismet_methods.rb
+1
-1
app/services/spam/akismet_service.rb
app/services/spam/akismet_service.rb
+75
-0
spec/controllers/admin/spam_logs_controller_spec.rb
spec/controllers/admin/spam_logs_controller_spec.rb
+1
-1
spec/controllers/projects/issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+6
-6
spec/controllers/projects/snippets_controller_spec.rb
spec/controllers/projects/snippets_controller_spec.rb
+3
-3
spec/controllers/snippets_controller_spec.rb
spec/controllers/snippets_controller_spec.rb
+3
-3
spec/requests/api/issues/post_projects_issues_spec.rb
spec/requests/api/issues/post_projects_issues_spec.rb
+1
-1
spec/requests/api/issues/put_projects_issues_spec.rb
spec/requests/api/issues/put_projects_issues_spec.rb
+1
-1
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/services/issues/create_service_spec.rb
spec/services/issues/create_service_spec.rb
+3
-3
spec/services/snippets/create_service_spec.rb
spec/services/snippets/create_service_spec.rb
+1
-1
spec/services/spam/akismet_service_spec.rb
spec/services/spam/akismet_service_spec.rb
+1
-1
spec/services/spam/spam_check_service_spec.rb
spec/services/spam/spam_check_service_spec.rb
+3
-3
No files found.
app/services/akismet_service.rb
deleted
100644 → 0
View file @
a15388de
# frozen_string_literal: true
class
AkismetService
attr_accessor
:text
,
:options
def
initialize
(
owner_name
,
owner_email
,
text
,
options
=
{})
@owner_name
=
owner_name
@owner_email
=
owner_email
@text
=
text
@options
=
options
end
def
spam?
return
false
unless
akismet_enabled?
params
=
{
type:
'comment'
,
text:
text
,
created_at:
DateTime
.
now
,
author:
owner_name
,
author_email:
owner_email
,
referrer:
options
[
:referrer
]
}
begin
is_spam
,
is_blatant
=
akismet_client
.
check
(
options
[
:ip_address
],
options
[
:user_agent
],
params
)
is_spam
||
is_blatant
rescue
=>
e
Rails
.
logger
.
error
(
"Unable to connect to Akismet:
#{
e
}
, skipping check"
)
# rubocop:disable Gitlab/RailsLogger
false
end
end
def
submit_ham
submit
(
:ham
)
end
def
submit_spam
submit
(
:spam
)
end
private
attr_accessor
:owner_name
,
:owner_email
def
akismet_client
@akismet_client
||=
::
Akismet
::
Client
.
new
(
Gitlab
::
CurrentSettings
.
akismet_api_key
,
Gitlab
.
config
.
gitlab
.
url
)
end
def
akismet_enabled?
Gitlab
::
CurrentSettings
.
akismet_enabled
end
def
submit
(
type
)
return
false
unless
akismet_enabled?
params
=
{
type:
'comment'
,
text:
text
,
author:
owner_name
,
author_email:
owner_email
}
begin
akismet_client
.
public_send
(
type
,
options
[
:ip_address
],
options
[
:user_agent
],
params
)
# rubocop:disable GitlabSecurity/PublicSend
true
rescue
=>
e
Rails
.
logger
.
error
(
"Unable to connect to Akismet:
#{
e
}
, skipping!"
)
# rubocop:disable Gitlab/RailsLogger
false
end
end
end
app/services/concerns/akismet_methods.rb
View file @
2035704a
...
@@ -6,7 +6,7 @@ module AkismetMethods
...
@@ -6,7 +6,7 @@ module AkismetMethods
end
end
def
akismet
def
akismet
@akismet
||=
AkismetService
.
new
(
@akismet
||=
Spam
::
AkismetService
.
new
(
spammable_owner
.
name
,
spammable_owner
.
name
,
spammable_owner
.
email
,
spammable_owner
.
email
,
spammable
.
spammable_text
,
spammable
.
spammable_text
,
...
...
app/services/spam/akismet_service.rb
0 → 100644
View file @
2035704a
# frozen_string_literal: true
module
Spam
class
AkismetService
attr_accessor
:text
,
:options
def
initialize
(
owner_name
,
owner_email
,
text
,
options
=
{})
@owner_name
=
owner_name
@owner_email
=
owner_email
@text
=
text
@options
=
options
end
def
spam?
return
false
unless
akismet_enabled?
params
=
{
type:
'comment'
,
text:
text
,
created_at:
DateTime
.
now
,
author:
owner_name
,
author_email:
owner_email
,
referrer:
options
[
:referrer
]
}
begin
is_spam
,
is_blatant
=
akismet_client
.
check
(
options
[
:ip_address
],
options
[
:user_agent
],
params
)
is_spam
||
is_blatant
rescue
=>
e
Rails
.
logger
.
error
(
"Unable to connect to Akismet:
#{
e
}
, skipping check"
)
# rubocop:disable Gitlab/RailsLogger
false
end
end
def
submit_ham
submit
(
:ham
)
end
def
submit_spam
submit
(
:spam
)
end
private
attr_accessor
:owner_name
,
:owner_email
def
akismet_client
@akismet_client
||=
::
Akismet
::
Client
.
new
(
Gitlab
::
CurrentSettings
.
akismet_api_key
,
Gitlab
.
config
.
gitlab
.
url
)
end
def
akismet_enabled?
Gitlab
::
CurrentSettings
.
akismet_enabled
end
def
submit
(
type
)
return
false
unless
akismet_enabled?
params
=
{
type:
'comment'
,
text:
text
,
author:
owner_name
,
author_email:
owner_email
}
begin
akismet_client
.
public_send
(
type
,
options
[
:ip_address
],
options
[
:user_agent
],
params
)
# rubocop:disable GitlabSecurity/PublicSend
true
rescue
=>
e
Rails
.
logger
.
error
(
"Unable to connect to Akismet:
#{
e
}
, skipping!"
)
# rubocop:disable Gitlab/RailsLogger
false
end
end
end
end
spec/controllers/admin/spam_logs_controller_spec.rb
View file @
2035704a
...
@@ -39,7 +39,7 @@ describe Admin::SpamLogsController do
...
@@ -39,7 +39,7 @@ describe Admin::SpamLogsController do
describe
'#mark_as_ham'
do
describe
'#mark_as_ham'
do
before
do
before
do
allow_next_instance_of
(
AkismetService
)
do
|
instance
|
allow_next_instance_of
(
Spam
::
AkismetService
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:submit_ham
).
and_return
(
true
)
allow
(
instance
).
to
receive
(
:submit_ham
).
and_return
(
true
)
end
end
end
end
...
...
spec/controllers/projects/issues_controller_spec.rb
View file @
2035704a
...
@@ -422,7 +422,7 @@ describe Projects::IssuesController do
...
@@ -422,7 +422,7 @@ describe Projects::IssuesController do
context
'when Akismet is enabled and the issue is identified as spam'
do
context
'when Akismet is enabled and the issue is identified as spam'
do
before
do
before
do
stub_application_setting
(
recaptcha_enabled:
true
)
stub_application_setting
(
recaptcha_enabled:
true
)
expect_next_instance_of
(
AkismetService
)
do
|
akismet_service
|
expect_next_instance_of
(
Spam
::
AkismetService
)
do
|
akismet_service
|
expect
(
akismet_service
).
to
receive_messages
(
spam?:
true
)
expect
(
akismet_service
).
to
receive_messages
(
spam?:
true
)
end
end
end
end
...
@@ -702,7 +702,7 @@ describe Projects::IssuesController do
...
@@ -702,7 +702,7 @@ describe Projects::IssuesController do
context
'when an issue is not identified as spam'
do
context
'when an issue is not identified as spam'
do
before
do
before
do
expect_next_instance_of
(
AkismetService
)
do
|
akismet_service
|
expect_next_instance_of
(
Spam
::
AkismetService
)
do
|
akismet_service
|
expect
(
akismet_service
).
to
receive_messages
(
spam?:
false
)
expect
(
akismet_service
).
to
receive_messages
(
spam?:
false
)
end
end
end
end
...
@@ -715,7 +715,7 @@ describe Projects::IssuesController do
...
@@ -715,7 +715,7 @@ describe Projects::IssuesController do
context
'when an issue is identified as spam'
do
context
'when an issue is identified as spam'
do
context
'when captcha is not verified'
do
context
'when captcha is not verified'
do
before
do
before
do
expect_next_instance_of
(
AkismetService
)
do
|
akismet_service
|
expect_next_instance_of
(
Spam
::
AkismetService
)
do
|
akismet_service
|
expect
(
akismet_service
).
to
receive_messages
(
spam?:
true
)
expect
(
akismet_service
).
to
receive_messages
(
spam?:
true
)
end
end
end
end
...
@@ -954,7 +954,7 @@ describe Projects::IssuesController do
...
@@ -954,7 +954,7 @@ describe Projects::IssuesController do
before
do
before
do
stub_feature_flags
(
allow_possible_spam:
false
)
stub_feature_flags
(
allow_possible_spam:
false
)
expect_next_instance_of
(
AkismetService
)
do
|
akismet_service
|
expect_next_instance_of
(
Spam
::
AkismetService
)
do
|
akismet_service
|
expect
(
akismet_service
).
to
receive_messages
(
spam?:
false
)
expect
(
akismet_service
).
to
receive_messages
(
spam?:
false
)
end
end
end
end
...
@@ -971,7 +971,7 @@ describe Projects::IssuesController do
...
@@ -971,7 +971,7 @@ describe Projects::IssuesController do
end
end
before
do
before
do
expect_next_instance_of
(
AkismetService
)
do
|
akismet_service
|
expect_next_instance_of
(
Spam
::
AkismetService
)
do
|
akismet_service
|
expect
(
akismet_service
).
to
receive_messages
(
spam?:
true
)
expect
(
akismet_service
).
to
receive_messages
(
spam?:
true
)
end
end
end
end
...
@@ -1096,7 +1096,7 @@ describe Projects::IssuesController do
...
@@ -1096,7 +1096,7 @@ describe Projects::IssuesController do
describe
'POST #mark_as_spam'
do
describe
'POST #mark_as_spam'
do
context
'properly submits to Akismet'
do
context
'properly submits to Akismet'
do
before
do
before
do
expect_next_instance_of
(
AkismetService
)
do
|
akismet_service
|
expect_next_instance_of
(
Spam
::
AkismetService
)
do
|
akismet_service
|
expect
(
akismet_service
).
to
receive_messages
(
submit_spam:
true
)
expect
(
akismet_service
).
to
receive_messages
(
submit_spam:
true
)
end
end
expect_next_instance_of
(
ApplicationSetting
)
do
|
setting
|
expect_next_instance_of
(
ApplicationSetting
)
do
|
setting
|
...
...
spec/controllers/projects/snippets_controller_spec.rb
View file @
2035704a
...
@@ -92,7 +92,7 @@ describe Projects::SnippetsController do
...
@@ -92,7 +92,7 @@ describe Projects::SnippetsController do
context
'when the snippet is spam'
do
context
'when the snippet is spam'
do
before
do
before
do
allow_next_instance_of
(
AkismetService
)
do
|
instance
|
allow_next_instance_of
(
Spam
::
AkismetService
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:spam?
).
and_return
(
true
)
allow
(
instance
).
to
receive
(
:spam?
).
and_return
(
true
)
end
end
end
end
...
@@ -172,7 +172,7 @@ describe Projects::SnippetsController do
...
@@ -172,7 +172,7 @@ describe Projects::SnippetsController do
context
'when the snippet is spam'
do
context
'when the snippet is spam'
do
before
do
before
do
allow_next_instance_of
(
AkismetService
)
do
|
instance
|
allow_next_instance_of
(
Spam
::
AkismetService
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:spam?
).
and_return
(
true
)
allow
(
instance
).
to
receive
(
:spam?
).
and_return
(
true
)
end
end
end
end
...
@@ -282,7 +282,7 @@ describe Projects::SnippetsController do
...
@@ -282,7 +282,7 @@ describe Projects::SnippetsController do
let
(
:snippet
)
{
create
(
:project_snippet
,
:private
,
project:
project
,
author:
user
)
}
let
(
:snippet
)
{
create
(
:project_snippet
,
:private
,
project:
project
,
author:
user
)
}
before
do
before
do
allow_next_instance_of
(
AkismetService
)
do
|
instance
|
allow_next_instance_of
(
Spam
::
AkismetService
)
do
|
instance
|
allow
(
instance
).
to
receive_messages
(
submit_spam:
true
)
allow
(
instance
).
to
receive_messages
(
submit_spam:
true
)
end
end
stub_application_setting
(
akismet_enabled:
true
)
stub_application_setting
(
akismet_enabled:
true
)
...
...
spec/controllers/snippets_controller_spec.rb
View file @
2035704a
...
@@ -275,7 +275,7 @@ describe SnippetsController do
...
@@ -275,7 +275,7 @@ describe SnippetsController do
context
'when the snippet is spam'
do
context
'when the snippet is spam'
do
before
do
before
do
allow_next_instance_of
(
AkismetService
)
do
|
instance
|
allow_next_instance_of
(
Spam
::
AkismetService
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:spam?
).
and_return
(
true
)
allow
(
instance
).
to
receive
(
:spam?
).
and_return
(
true
)
end
end
end
end
...
@@ -349,7 +349,7 @@ describe SnippetsController do
...
@@ -349,7 +349,7 @@ describe SnippetsController do
context
'when the snippet is spam'
do
context
'when the snippet is spam'
do
before
do
before
do
allow_next_instance_of
(
AkismetService
)
do
|
instance
|
allow_next_instance_of
(
Spam
::
AkismetService
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:spam?
).
and_return
(
true
)
allow
(
instance
).
to
receive
(
:spam?
).
and_return
(
true
)
end
end
end
end
...
@@ -459,7 +459,7 @@ describe SnippetsController do
...
@@ -459,7 +459,7 @@ describe SnippetsController do
let
(
:snippet
)
{
create
(
:personal_snippet
,
:public
,
author:
user
)
}
let
(
:snippet
)
{
create
(
:personal_snippet
,
:public
,
author:
user
)
}
before
do
before
do
allow_next_instance_of
(
AkismetService
)
do
|
instance
|
allow_next_instance_of
(
Spam
::
AkismetService
)
do
|
instance
|
allow
(
instance
).
to
receive_messages
(
submit_spam:
true
)
allow
(
instance
).
to
receive_messages
(
submit_spam:
true
)
end
end
stub_application_setting
(
akismet_enabled:
true
)
stub_application_setting
(
akismet_enabled:
true
)
...
...
spec/requests/api/issues/post_projects_issues_spec.rb
View file @
2035704a
...
@@ -392,7 +392,7 @@ describe API::Issues do
...
@@ -392,7 +392,7 @@ describe API::Issues do
expect_next_instance_of
(
Spam
::
SpamCheckService
)
do
|
spam_service
|
expect_next_instance_of
(
Spam
::
SpamCheckService
)
do
|
spam_service
|
expect
(
spam_service
).
to
receive_messages
(
check_for_spam?:
true
)
expect
(
spam_service
).
to
receive_messages
(
check_for_spam?:
true
)
end
end
expect_next_instance_of
(
AkismetService
)
do
|
akismet_service
|
expect_next_instance_of
(
Spam
::
AkismetService
)
do
|
akismet_service
|
expect
(
akismet_service
).
to
receive_messages
(
spam?:
true
)
expect
(
akismet_service
).
to
receive_messages
(
spam?:
true
)
end
end
end
end
...
...
spec/requests/api/issues/put_projects_issues_spec.rb
View file @
2035704a
...
@@ -197,7 +197,7 @@ describe API::Issues do
...
@@ -197,7 +197,7 @@ describe API::Issues do
expect_next_instance_of
(
Spam
::
SpamCheckService
)
do
|
spam_service
|
expect_next_instance_of
(
Spam
::
SpamCheckService
)
do
|
spam_service
|
expect
(
spam_service
).
to
receive_messages
(
check_for_spam?:
true
)
expect
(
spam_service
).
to
receive_messages
(
check_for_spam?:
true
)
end
end
expect_next_instance_of
(
AkismetService
)
do
|
akismet_service
|
expect_next_instance_of
(
Spam
::
AkismetService
)
do
|
akismet_service
|
expect
(
akismet_service
).
to
receive_messages
(
spam?:
true
)
expect
(
akismet_service
).
to
receive_messages
(
spam?:
true
)
end
end
end
end
...
...
spec/requests/api/project_snippets_spec.rb
View file @
2035704a
...
@@ -179,7 +179,7 @@ describe API::ProjectSnippets do
...
@@ -179,7 +179,7 @@ describe API::ProjectSnippets do
end
end
before
do
before
do
allow_next_instance_of
(
AkismetService
)
do
|
instance
|
allow_next_instance_of
(
Spam
::
AkismetService
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:spam?
).
and_return
(
true
)
allow
(
instance
).
to
receive
(
:spam?
).
and_return
(
true
)
end
end
end
end
...
@@ -271,7 +271,7 @@ describe API::ProjectSnippets do
...
@@ -271,7 +271,7 @@ describe API::ProjectSnippets do
end
end
before
do
before
do
allow_next_instance_of
(
AkismetService
)
do
|
instance
|
allow_next_instance_of
(
Spam
::
AkismetService
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:spam?
).
and_return
(
true
)
allow
(
instance
).
to
receive
(
:spam?
).
and_return
(
true
)
end
end
end
end
...
...
spec/requests/api/snippets_spec.rb
View file @
2035704a
...
@@ -238,7 +238,7 @@ describe API::Snippets do
...
@@ -238,7 +238,7 @@ describe API::Snippets do
end
end
before
do
before
do
allow_next_instance_of
(
AkismetService
)
do
|
instance
|
allow_next_instance_of
(
Spam
::
AkismetService
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:spam?
).
and_return
(
true
)
allow
(
instance
).
to
receive
(
:spam?
).
and_return
(
true
)
end
end
end
end
...
@@ -327,7 +327,7 @@ describe API::Snippets do
...
@@ -327,7 +327,7 @@ describe API::Snippets do
end
end
before
do
before
do
allow_next_instance_of
(
AkismetService
)
do
|
instance
|
allow_next_instance_of
(
Spam
::
AkismetService
)
do
|
instance
|
allow
(
instance
).
to
receive
(
:spam?
).
and_return
(
true
)
allow
(
instance
).
to
receive
(
:spam?
).
and_return
(
true
)
end
end
end
end
...
...
spec/services/issues/create_service_spec.rb
View file @
2035704a
...
@@ -355,7 +355,7 @@ describe Issues::CreateService do
...
@@ -355,7 +355,7 @@ describe Issues::CreateService do
opts
[
:recaptcha_verified
]
=
true
opts
[
:recaptcha_verified
]
=
true
opts
[
:spam_log_id
]
=
spam_logs
.
last
.
id
opts
[
:spam_log_id
]
=
spam_logs
.
last
.
id
expect
(
AkismetService
).
not_to
receive
(
:new
)
expect
(
Spam
::
AkismetService
).
not_to
receive
(
:new
)
end
end
it
'does no mark an issue as a spam '
do
it
'does no mark an issue as a spam '
do
...
@@ -392,7 +392,7 @@ describe Issues::CreateService do
...
@@ -392,7 +392,7 @@ describe Issues::CreateService do
context
'when akismet detects spam'
do
context
'when akismet detects spam'
do
before
do
before
do
expect_next_instance_of
(
AkismetService
)
do
|
akismet_service
|
expect_next_instance_of
(
Spam
::
AkismetService
)
do
|
akismet_service
|
expect
(
akismet_service
).
to
receive_messages
(
spam?:
true
)
expect
(
akismet_service
).
to
receive_messages
(
spam?:
true
)
end
end
end
end
...
@@ -442,7 +442,7 @@ describe Issues::CreateService do
...
@@ -442,7 +442,7 @@ describe Issues::CreateService do
context
'when akismet does not detect spam'
do
context
'when akismet does not detect spam'
do
before
do
before
do
expect_next_instance_of
(
AkismetService
)
do
|
akismet_service
|
expect_next_instance_of
(
Spam
::
AkismetService
)
do
|
akismet_service
|
expect
(
akismet_service
).
to
receive_messages
(
spam?:
false
)
expect
(
akismet_service
).
to
receive_messages
(
spam?:
false
)
end
end
end
end
...
...
spec/services/snippets/create_service_spec.rb
View file @
2035704a
...
@@ -99,7 +99,7 @@ describe Snippets::CreateService do
...
@@ -99,7 +99,7 @@ describe Snippets::CreateService do
end
end
before
do
before
do
expect_next_instance_of
(
AkismetService
)
do
|
akismet_service
|
expect_next_instance_of
(
Spam
::
AkismetService
)
do
|
akismet_service
|
expect
(
akismet_service
).
to
receive_messages
(
spam?:
true
)
expect
(
akismet_service
).
to
receive_messages
(
spam?:
true
)
end
end
end
end
...
...
spec/services/akismet_service_spec.rb
→
spec/services/
spam/
akismet_service_spec.rb
View file @
2035704a
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
require
'spec_helper'
require
'spec_helper'
describe
AkismetService
do
describe
Spam
::
AkismetService
do
let
(
:fake_akismet_client
)
{
double
(
:akismet_client
)
}
let
(
:fake_akismet_client
)
{
double
(
:akismet_client
)
}
let_it_be
(
:text
)
{
"Would you like to buy some tinned meat product?"
}
let_it_be
(
:text
)
{
"Would you like to buy some tinned meat product?"
}
...
...
spec/services/spam/spam_check_service_spec.rb
View file @
2035704a
...
@@ -85,7 +85,7 @@ describe Spam::SpamCheckService do
...
@@ -85,7 +85,7 @@ describe Spam::SpamCheckService do
before
do
before
do
issue
.
closed_at
=
Time
.
zone
.
now
issue
.
closed_at
=
Time
.
zone
.
now
allow
(
AkismetService
).
to
receive
(
:new
).
and_return
(
double
(
spam?:
true
))
allow
(
Spam
::
AkismetService
).
to
receive
(
:new
).
and_return
(
double
(
spam?:
true
))
end
end
it
'returns false'
do
it
'returns false'
do
...
@@ -105,7 +105,7 @@ describe Spam::SpamCheckService do
...
@@ -105,7 +105,7 @@ describe Spam::SpamCheckService do
context
'when indicated as spam by akismet'
do
context
'when indicated as spam by akismet'
do
before
do
before
do
allow
(
AkismetService
).
to
receive
(
:new
).
and_return
(
double
(
spam?:
true
))
allow
(
Spam
::
AkismetService
).
to
receive
(
:new
).
and_return
(
double
(
spam?:
true
))
end
end
context
'when allow_possible_spam feature flag is false'
do
context
'when allow_possible_spam feature flag is false'
do
...
@@ -135,7 +135,7 @@ describe Spam::SpamCheckService do
...
@@ -135,7 +135,7 @@ describe Spam::SpamCheckService do
context
'when not indicated as spam by akismet'
do
context
'when not indicated as spam by akismet'
do
before
do
before
do
allow
(
AkismetService
).
to
receive
(
:new
).
and_return
(
double
(
spam?:
false
))
allow
(
Spam
::
AkismetService
).
to
receive
(
:new
).
and_return
(
double
(
spam?:
false
))
end
end
it
'returns false'
do
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