-
-
Notifications
You must be signed in to change notification settings - Fork 277
Add an option to allow enforcement of verified doubles in nameless doubles #691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an option to allow enforcement of verified doubles in nameless doubles #691
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
Just 2 minor comments on the tests
context 'when configured to ignore nameless doubles' do | ||
let(:cop_config) { { 'IgnoreNameless' => true } } | ||
|
||
it 'ignores doubles whose name is a symbol' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the test description does not match its body
@Darhazer Thanks for the quick review, and sorry for the spec sloppiness. Those are fixed up now. |
@@ -53,14 +53,27 @@ | |||
end | |||
end | |||
|
|||
it 'ignores doubles without a name' do | |||
expect_no_offenses(<<-RUBY) | |||
it 'finds a double when the no name is specified' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one needs improving. Perpahs finds a double without a name
is enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doubles that have no name specified
also works, as it is consistent with the other test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 fixed that up.
…ubles Currently if you have a double/spy with no name (or default stubs) it will never cause a violation according to the `RSpec/VerifiedDoubles` cop. This adds an optional configuration to allow violations to be added for code that looks like: ``` foo = double allow(foo).to receive(:bar) do |arg1| “#{arg1} based result” end ```
Currently if you have a double/spy with no name (or default stubs) it will never cause a violation according to the
RSpec/VerifiedDoubles
cop. This adds an optional configuration to allow violations to be added for code that looks like:I left the default configuration not enforcing this cop on nameless doubles so as to make this a non-breaking change.