Reputation: 4983
Is there any way to avoid the "unresolved ruby reference" warning in RubyMine IDE? for example, when some code in my view calls a method of the view helper, I get the "unresolved ruby reference" warning even though the code works.
The case described above is just one of many. Another example is when using RSpec:
it "should require an email" do
no_email_user = User.new(@attr.merge(:email => ""))
no_email_user.should_not be_valid
end
the parameter "be_valid" is not known to the RubyMine IDE.
My question is - is there any way to solve this? should I require additional files? should I do something differently? Those false positives regarding unresolved ruby methods/constants are really disturbing, and it also affects the results of the "find usages" action in RubyMine.
I'm using RubyMine 3.1 I would really appreciate any help in resolving this issue.
Upvotes: 10
Views: 3539
Reputation: 401877
This issue is already submitted to the RubyMine bug tracker, please watch/vote.
Upvotes: 10
Reputation: 131
To turn off the warning you are getting in RubyMine 3.1, which I think might be your original question, you need to go to File->Preferences. Then, on the left, go to "Inspections". Open up the "Ruby" section and uncheck "Unresolved Ruby Reference." The Preferences is searchable so, if you get others like that, you might try the search. Good luck!
Upvotes: 1
Reputation: 50057
I think in this case this is hard to solve. Ruby allows great magic to happen using method_missing
and as far as i know, the be_valid
is also implemented in this way. Actually there is no be_valid
but it calls the valid?
method and expects it to be true.
In rspec, this work for any method ending in a ?
. So if you have a method ready?
, you can write should be_ready
.
I am a fulltime Rubymine user, but i do not know how they could solve that nor do i expect it.
Upvotes: 2