RUBY-5832
Can't run specs, can't click through "require 'spec'" statement under spec directory
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
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
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: