Issue Details (XML | Word | Printable)

Key: JRUBY-3284
Type: Sub-task Sub-task
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Thomas E Enebo
Reporter: Rich Apodaca
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
JRuby
JRUBY-3256

undefined method `spec' for JRuby::Commands:Class (NoMethodError) with autotest

Created: 05/Jan/09 02:43 PM   Updated: 16/Dec/09 09:50 PM   Resolved: 16/Dec/09 06:17 PM
Return to search
Component/s: Application Error
Affects Version/s: JRuby 1.1.6
Fix Version/s: JRuby 1.5

Time Tracking:
Not Specified

Environment: Ubuntu Linux, JDK 1.5, 1.6


 Description  « Hide

Autotest gives an error in jruby that doesn't occur in MRI when a clean Rails 2.2.2 project is created:

$ jruby -S rails spectest

$ jruby script/generate rspec

$ jruby script/generate rspec_controller test index

$ export RSPEC=true

$ jruby -S autotest
loading autotest/rails_rspec
/home/rich/local/jruby/bin/jruby -S spec/views/test/index.html.erb_spec.rb spec/controllers/test_controller_spec.rb spec/helpers/test_helper_spec.rb -O spec/spec.opts
spec/views/test/index.html.erb_spec.rb:1: undefined method `spec' for JRuby::Commands:Class (NoMethodError)



Thomas E Enebo added a comment - 05/Jan/09 07:04 PM

I am guessing -S spec/views/... is the real problem with this, so I am making it a subtask of the parent issue.


Michael Guymon added a comment - 05/Feb/09 11:00 AM

I have the same problem using JRuby 1.1.6 and Rails 2.2.2 with the rspec_on_rails plugin, where all the specs run under the normal jruby -S rake spec

/home/zinger/devel/src/java/jruby/jruby-1.1.6/bin/jruby -S script/spec -O spec/spec.opts spec/controllers/deploys_controller_spec.rb. . (test list omitted for brevity)
script/spec:1: undefined method `script' for JRuby::Commands:Class (NoMethodError)

The problem appears to be the -S and calling script/spec when executing the autospec. The 'script/spec' appears to be coming from vendor/plugins/rspec_on_rails/lib/autotest/rails_rspec.rb

class Autotest::RailsRspec < Autotest::Rspec

def spec_command
"script/spec"
end

end

I greped around ZenTest and could not figure how a -S is being added for JRuby. If you manually change rails_rspec.rb to "spec" (sans the "script/") the autospec execution runs farther, but died on another error:

/home/zinger/devel/src/java/jruby/jruby-1.1.6/bin/jruby -S spec -O spec/spec.opts spec/controllers/deploys_controller_spec.rb. . ..(test list omitted for brevity)
/home/zinger/devel/src/java/jruby/jruby-1.1.6/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:442:in `load_missing_constant': uninitialized constant Spec::VERSION::BUILD_TIME_UTC (NameError)

that is all the steam I have, hope it helps


Thomas E Enebo added a comment - 16/Dec/09 06:17 PM

This was fixed along with JRUBY-3256. There could be other issues with autotest/ZenTest, but not because of -S (I ran through the steps described and did not get a stack to show up either).


Hiro Asari added a comment - 16/Dec/09 09:50 PM

If OP still wants autotest to work with JRuby, I worked on it a while ago: http://github.com/BanzaiMan/zentest-jruby

The patch has not been taken upstream, since Ryan Davis is planning an overhaul in some parts, apparently.