Bug #2650
closedRails console doesn't load: cannot load such file -- minitest/unit
Description
On a 1.2.0-RC2 install on EL6, we don't have any test related packages. This causes the Rails console to fail:
/opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require': cannot load such file -- minitest/unit (LoadError) from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require' from /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require' from /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency' from /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require' from /opt/rh/ruby193/root/usr/share/ruby/test/unit/assertions.rb:1:in `<top (required)>' from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require' from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require' from /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require' from /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency' from /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require' from /opt/rh/ruby193/root/usr/share/ruby/test/unit/testcase.rb:1:in `<top (required)>' from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require' from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require' from /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require' from /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency' from /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require' from /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/test_case.rb:1:in `<top (required)>' from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require' from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require' from /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require' from /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency' from /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require' from /opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.8/lib/rails/console/app.rb:2:in `<top (required)>' from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require' from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:36:in `require' from /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require' from /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency' from /opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require' from /opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.8/lib/rails/application.rb:302:in `initialize_console' from /opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.8/lib/rails/application.rb:152:in `load_console' from /opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.8/lib/rails/commands/console.rb:27:in `start' from /opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.8/lib/rails/commands/console.rb:8:in `start' from /opt/rh/ruby193/root/usr/share/gems/gems/railties-3.2.8/lib/rails/commands.rb:41:in `<top (required)>' from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:60:in `require' from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:60:in `rescue in require' from /opt/rh/ruby193/root/usr/share/rubygems/rubygems/custom_require.rb:35:in `require' from script/rails:6:in `<main>'
Updated by Lukas Zapletal over 11 years ago
- Status changed from New to Assigned
- Assignee set to Lukas Zapletal
Yami yami
Updated by Ohad Levy over 11 years ago
this would require a couple of line patches to rails itself, its fixed in rails 4.0
see https://github.com/rails/rails/issues/6907
Updated by Ohad Levy over 11 years ago
more specifically https://github.com/rails/rails/pull/7349/files
Updated by Lukas Zapletal over 11 years ago
Ok this was hard to find. But it seems to be easy fix. Anyway, interesting subject:
It looks like Ruby deveopers bundles some libraries (like minitest) which they use for internal stuff (e.g. implementation for test-unit). Unfortunately the way they do that (standard rubygem) allows users to use those libraries (they export public API). There are couple of problems with this approach - it is being discussed on Fedora and Ruby lists.
The main issue is some projects, including activesupport, do use minitest and do rely on minitest being bundled with Ruby 1.9+ but this will hopefully change in future.
Resolution: To add minitest as Foreman require in SPEC and add it to main Gemfile until this gets sorted in the upstream projects. Fixing this upstream would be challenging since there are two opinions: one group (me) says it's not official API (it's not documented) and should not be used, the other group says "they bundle it, we will use it"-
Updated by Lukas Zapletal over 11 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
Applied in changeset 95234b21bc9fba36206274f8996a0f933b2d4d33.
Updated by Gaël Chamoulaud over 11 years ago
Hi guys,
I got this error this morning after a yum update (EL6 and 1.2.0-0.4.RC3).
The bundler.d/console.rb seems to be ok and contains the Lukas patch.
Gaël
Updated by Dominic Cleal over 11 years ago
Gaël Chamoulaud wrote:
Hi guys,
I got this error this morning after a yum update (EL6 and 1.2.0-0.4.RC3).
The bundler.d/console.rb seems to be ok and contains the Lukas patch.
Gaël
When using the console, or doing something else? In theory it shouldn't be needed for normal operations.
Updated by Gaël Chamoulaud over 11 years ago
The console is not available anymore for me. I've just the passenger error page with the ruby stack message!
Updated by Dominic Cleal over 11 years ago
It's a bug in the console.rb change, it should read like this I think:
gem 'minitest', '~> 4.7', :require => 'minitest/unit'
Filed as #2701.