thoughtbot / shoulda-context

Shoulda Context makes it easy to write understandable and maintainable tests under Minitest and Test::Unit within Rails projects or plain Ruby projects.
MIT License
239 stars 58 forks source link

Fatal exception under JRuby: uninitialized constant ActiveSupport #25

Closed brndnblck closed 11 years ago

brndnblck commented 11 years ago

The dependency chain for 3.5.0 under JRuby combined with how active support was being required and used here was causing some issues and completely breaks shoulda under JRuby 1.7.x. Simply requiring shoulda or shoulda-context on the JRuby platform results in a fatal exception.

Steps to reproduce:

rvm use jruby
gem install shoulda
ruby -e "require 'shoulda'"

Result:

NameError: uninitialized constant ActiveSupport
  const_missing at org/jruby/RubyModule.java:2631
         (root) at /Users/brandon/.rvm/gems/jruby-1.7.4@sandbox/gems/shoulda-context-1.1.2/lib/shoulda/context.rb:7
        require at org/jruby/RubyKernel.java:1054
        require at /Users/brandon/.rvm/rubies/jruby-1.7.4/lib/ruby/shared/rubygems/custom_require.rb:36
         (root) at /Users/brandon/.rvm/gems/jruby-1.7.4@sandbox/gems/shoulda-3.5.0/lib/shoulda.rb:3
        require at org/jruby/RubyKernel.java:1054
        require at /Users/brandon/.rvm/rubies/jruby-1.7.4/lib/ruby/shared/rubygems/custom_require.rb:60
         (root) at -e:1

This pull request resolves the issue and all tests pass successfully under:

rmm5t commented 11 years ago

(restarted the erred build)

rmm5t commented 11 years ago

Looks good. Thanks!