Rails 4.1.1 - NameError: uninitialized class variable @@installed_at_exit in Test::Unit::Runner
Closed this issue · 5 comments
I am developing test for a Rails 4.1.1 application and after I included shoulda-context as a gem, my tests no longer start. This is what I get when I try to run a single test:
/home/vashtakala/jruby-1.7.11/bin/jruby --1.9 -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /home/vashtakala/railsapps/lmd_bix/test/integration/cas/test_is_authentication_working.rb
include_class is deprecated. Use java_import.
log4j:WARN No appenders could be found for logger (mondrian.olap.MondrianProperties).
log4j:WARN Please initialize the log4j system properly.
MiniTest::Unit::TestCase is now Minitest::Test. From /home/vashtakala/jruby-1.7.11/lib/ruby/1.9/test/unit/testcase.rb:8:in `Unit'
NameError: uninitialized class variable @@installed_at_exit in Test::Unit::Runner
autorun at /home/vashtakala/jruby-1.7.11/lib/ruby/1.9/test/unit.rb:324
(root) at /home/vashtakala/jruby-1.7.11/lib/ruby/1.9/test/unit.rb:640
require at org/jruby/RubyKernel.java:1085
require at /home/vashtakala/jruby-1.7.11/lib/ruby/gems/shared/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247
load_dependency at /home/vashtakala/jruby-1.7.11/lib/ruby/gems/shared/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232
require at /home/vashtakala/jruby-1.7.11/lib/ruby/gems/shared/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247
(root) at /home/vashtakala/jruby-1.7.11/lib/ruby/gems/shared/gems/thoughtbot-shoulda-2.11.1/lib/shoulda/integrations/test_unit.rb:1
require at org/jruby/RubyKernel.java:1085
require at /home/vashtakala/jruby-1.7.11/lib/ruby/gems/shared/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247
load_dependency at /home/vashtakala/jruby-1.7.11/lib/ruby/gems/shared/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232
require at /home/vashtakala/jruby-1.7.11/lib/ruby/gems/shared/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247
(root) at /home/vashtakala/jruby-1.7.11/lib/ruby/gems/shared/gems/thoughtbot-shoulda-2.11.1/lib/shoulda/integrations/test_unit.rb:1
require at org/jruby/RubyKernel.java:1085
(root) at /home/vashtakala/jruby-1.7.11/lib/ruby/gems/shared/gems/thoughtbot-shoulda-2.11.1/lib/shoulda.rb:1
each at org/jruby/RubyArray.java:1613
(root) at /home/vashtakala/jruby-1.7.11/lib/ruby/gems/shared/gems/thoughtbot-shoulda-2.11.1/lib/shoulda.rb:9
each at org/jruby/RubyArray.java:1613
(root) at /home/vashtakala/jruby-1.7.11/lib/ruby/gems/shared/gems/bundler-1.6.3/lib/bundler/runtime.rb:1
require at /home/vashtakala/jruby-1.7.11/lib/ruby/gems/shared/gems/bundler-1.6.3/lib/bundler/runtime.rb:76
require at /home/vashtakala/jruby-1.7.11/lib/ruby/gems/shared/gems/bundler-1.6.3/lib/bundler/runtime.rb:72
require at org/jruby/RubyKernel.java:1085
require at /home/vashtakala/jruby-1.7.11/lib/ruby/gems/shared/gems/bundler-1.6.3/lib/bundler/runtime.rb:61
require at org/jruby/RubyKernel.java:1085
require at /home/vashtakala/jruby-1.7.11/lib/ruby/gems/shared/gems/bundler-1.6.3/lib/bundler.rb:132
require at org/jruby/RubyKernel.java:1085
(root) at /home/vashtakala/railsapps/lmd_bix/config/application.rb:8
(root) at /home/vashtakala/railsapps/lmd_bix/config/environment.rb:1
load at org/jruby/RubyKernel.java:1101
(root) at -e:1
Process finished with exit code 1
Here is my Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
# Use mysql as the database for Active Record
gem 'activerecord-jdbcmysql-adapter', '~>1.3.0', :require => false, :platform => :jruby
gem 'jdbc-mysql', '5.1.13' # the current version gives an error
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyrhino'
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'puma'
gem 'activerecord-session_store', github: 'rails/activerecord-session_store'
group :nitc do
gem 'torquebox', '3.1.0'
end
group :autotest do
gem 'capybara'
gem 'shoulda'
gem 'thoughtbot-shoulda'
gem 'selenium-webdriver'
end
After googling, it appears that the solution is to specify in the Gemfile that I use minitest version 4, but, when I tried to do that, bundler told me that rails 4.1.1 required minitest 5.
Bundler error:
Fetching gem metadata from https://rubygems.org/........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies............
Bundler could not find compatible versions for gem "minitest":
In Gemfile:
minitest (~> 4.0) java
rails (= 4.1.1) java depends on
activesupport (= 4.1.1) java depends on
minitest (5.1.0)
I don't think i was able to resolve this issue.
The 'test-unit-rails' gem solved the problem in my case, which involved hitting NameError: uninitialized class variable @@installed_at_exit in Test::Unit::Runner
after upgrading to Rails 4.2. (I also had to upgrade mocha, but that's probably not relevant to your case.)
We don't plan on supporting Rails 4.1 anymore since it's EOL, and we also don't plan on supporting versions of Test::Unit prior to 2. Considering this issue is so old, I'm going to close this.