When I open a spec like it_behaves_like
method is not recognized by RubyMine with error message can't find 'it_behaves_like'
.
The RSpec test itself works fine, so somehow RubyMine can't find the method.
In the Preference rspec-rails
is listed.
How can I find where the problem stand?
It seems RubyMine
can't recognize dynamically defined method.
https://youtrack.jetbrains.com/issue/RUBY-13950
Yes, RubyMine, even latest version has a problem recognising these generated methods. You have the option of "tricking" RubyMine into recognising it though. Simply add the following empty method to the end of your spec_helper.rb:
def it_behaves_like(*args) ; end
This will make RubyMine see a method with the correct signature, but it will still be overriden by rspec, so it will not affect your tests.
Even better, you can put it in a require from spec_helper.rb, e.g. rubymine_signatures.rb
require 'rubymine_signatures'
No matter where it is placed, however, it will still be polluting your codebase to 'fix' the IDE, which I don't recommend doing. Since it is only for tests though, it can be defended.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With