Enable RSpec/VerifiedDoubles cop, fix issues & stash one
Can't figureout solution for offense at spec/models/verification/management/email_spec.rb so its stashed at .rubocop_todo.yml Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles
This commit is contained in:
@@ -15,8 +15,8 @@ RSpec.describe CommentsHelper, type: :helper do
|
||||
describe '#user_level_class' do
|
||||
|
||||
def comment_double(as_administrator: false, as_moderator: false, official: false)
|
||||
user = double official?: official, official_level: 'Y'
|
||||
double as_administrator?: as_administrator, as_moderator?: as_moderator, user: user
|
||||
user = instance_double('User', official?: official, official_level: 'Y')
|
||||
instance_double('Comment', as_administrator?: as_administrator, as_moderator?: as_moderator, user: user)
|
||||
end
|
||||
|
||||
it 'returns is-admin for comment done as administrator' do
|
||||
@@ -47,14 +47,14 @@ RSpec.describe CommentsHelper, type: :helper do
|
||||
describe '#comment_author_class' do
|
||||
it 'returns is-author if author is the commenting user' do
|
||||
author_id = 42
|
||||
comment = double user_id: author_id
|
||||
comment = instance_double('Comment', user_id: author_id)
|
||||
|
||||
expect(helper.comment_author_class(comment, author_id)).to eq('is-author')
|
||||
end
|
||||
|
||||
it 'returns an empty string if commenter is not the author' do
|
||||
author_id = 42
|
||||
comment = double user_id: author_id - 1
|
||||
comment = instance_double('Comment', user_id: author_id - 1)
|
||||
|
||||
expect(helper.comment_author_class(comment, author_id)).to eq('')
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user