Priority
Major
Type
Bug 
State
Fixed 
Assignee
Roman Chernyatchik 
Subsystem
Tests 
Affected versions
Fixed in
Fixed in build
93.146  
  • Submitted by   jpalermo
    5 months ago (11 Mar 2010 01:29)
  • Updated by   Dmitry Jemerov
    4 months ago (12 Apr 2010 21:11)
RUBY-5832 Can't run specs, can't click through "require 'spec'" statement under spec directory
0
This issue has been seen before, but the other fixes didn't resolve my problem.

I can't run specs, and I can't even click through the "require 'spec'" statement to get to the source. I CAN click through a "require 'spec'" statement anywhere else in the project, it is only when that statement is in a file under the "spec" directory that I am unable to click through it.

I have both rspec gems attached to the project.

We did a binary search of deleting code until we were able to click through and found four separate files that were causing the problem. All were located under /vendor/plugins and then 2-5 levels further down from that. All of them were classes that extended ActiveRecord::Base. Two of the classes were inside of modules, but two of them were at the top level namespace.

None of them were doing anything fancy. Deleting these files or commenting them out allowed me to click through "require 'spec'" statements under the spec directory.

Attempting to copy one of these offending files into a fresh rails project did not cause the problem to appear. So it is more of a complex interaction than that.

This was in both 2.0.1 and the 2.0.2 RC
Comments (5)
 
History
 
Linked Issues (0)
 
jpalermo
  jpalermo
12 Mar 2010 01:01
(5 months ago)
We've just tested it in version 1.1.1 and the problem does NOT occur there.
Roman Chernyatchik
  Roman Chernyatchik
22 Mar 2010 18:49
(5 months ago)
Could you provide a minimal reproducing scenario on a fresh rails project? Is your project opensource?
jpalermo
  jpalermo
26 Mar 2010 20:19
(5 months ago)
Here are steps to reproduce it on 2.0.1. I'm using ruby 1.8.7-p174 installed using rvm on OSX 10.5.8.

Using rails 2.3.5 installed as a gem, create a new rails project using the 'rails' command

Create a /db/migrate folder, it doesn't need a migration, but the folder must exist.

Use this for the content of /config/initializers/inflections.rb:
ActiveSupport::Inflector.inflections do |inflect|
inflect.uncountable [ 'terms_of_service', 'terms of service' ]
end

Create /vendor/plugins/foo/lib/foo.rb and use this for its content:
class Foo < ActiveRecord::Base
end

If I then have a test file under /test/unit and I have this at the top:
require File.join(File.dirname(__FILE__), '..', 'test_helper')
I am unable to click through to the test_helper.rb file
Roman Chernyatchik
  Roman Chernyatchik
26 Mar 2010 21:55
(5 months ago)
Thanks, it's a great example! I've managed to reproduce the problem. RubyMine incorrectly analyses your inflection rules and cannot build internal caches for code insight features.

Temporary workaround: Don't use arrays with "uncountable" call. Or at least use arrays in %w( bingo ) form. So just split [ 'terms_of_service', 'terms of service' ] array in two lines to avoid the bug:
inflect.uncountable 'terms_of_service'
inflect.uncountable 'terms of service'
Roman Chernyatchik
  Roman Chernyatchik
26 Mar 2010 23:05
(5 months ago)
Or just
 inflect.uncountable  'terms_of_service', 'terms of service'