-
-
Notifications
You must be signed in to change notification settings - Fork 282
Closed
Labels
Description
As described in #321, if a user has some custom DSL in their specs then a handful of cops produce false positives. For example
RSpec.describe Authentication do
role :user do
it 'accepts the request' do
expect(request).to be_accepted
end
end
role :admin do
it 'accepts the request' do
expect(request).to be_accepted
end
end
end
In RSpec you can do something like this
RSpec.configure do |c|
c.alias_example_group_to :detail, :detailed => true
end
and of course since it is plain old ruby you can do something like this (not sure if this would specifically work)
module AuthenticationSpecs
def role(type)
context "when user is a #{type}" do
let(:user) { create(type) }
yield
end
end
end
RSpec.configure do |config|
config.extend(AuthenticationSpecs)
end
To handle stuff like this properly, we should support something like this
AllCops:
RSpec:
CustomExampleGroups:
- detail
- role
which all cops would respect.
pirj, kassi and denys-husiev