-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Interesting interaction with RSpec let
inside a block
#1184
Comments
That's a bug that we'll have to fix. |
I think the underlying problem is that the Also, it's difficult to differentiate |
@yujinakayama Good point; I'd forgotten about |
Fixes rubocop#934. This PR fixes a false negative for `Rails/Output` when print methods without arguments. rubocop/rubocop#1184 reported the following problem, but it seems that it was mistakenly updated to allow no argument cases. ```console expect(p.arity).to be 1 ^ spec/models/cco/blog_cco2_spec.rb:46:16: C: Do not write to stdout. Use Rails' logger if you want to log. ``` It seems that rubocop/rubocop#6829 has since used that mistake. So this PR steers `Rails/Output` back to its original intent.
Fixes rubocop#934. This PR fixes a false negative for `Rails/Output` when print methods without arguments. rubocop/rubocop#1184 reported the following problem, but it seems that it was mistakenly updated to allow no argument cases. ```console expect(p.arity).to be 1 ^ spec/models/cco/blog_cco2_spec.rb:46:16: C: Do not write to stdout. Use Rails' logger if you want to log. ``` It seems that rubocop/rubocop#6829 has since used that mistake. So this PR steers `Rails/Output` back to its original intent.
Given the following RSpec spec file (which passes):
running RuboCop with the command line
rubocop -R spec/models/cco/blog_cco2_spec.rb
yields the outputNote that every reference to
p
triggers a RuboCop offense, including the first (at line 17), but theexpect
call at line 16 (which checksfrom.receiver
rather thanp.receiver
) is not flagged.Why? Again, RSpec gives me a green bar; no failures.
Behaviour observed in Rubocop 0.23.0 and 0.24.0, with Rails 4.1.2 under Ruby 2.0.0p481. The RSpec version is 2.99.1.
The text was updated successfully, but these errors were encountered: