I'm getting uninitialized constant Test
when running rails console
in terminal. I'm not sure why I just set it up and using the command rails server
works.
This is the error I get:
/usr/lib/ruby/vendor_ruby/active_support/test_case.rb:12:in `<module:ActiveSupport>': uninitialized constant Test (NameError)
I ran into this same problem on my Ubuntu 14.04 desktop. Solved in the following way:
sudo apt-get install ruby-test-unit echo require 'test/unit' >> /usr/lib/ruby/vendor_ruby/active_support/test_case.rb
see this link: https://bugs.launchpad.net/ubuntu/+source/ruby-activesupport-3.2/+bug/1319101
I had this issue when copied and pasted the config from shoulda-matchers getting started guide . But I wasn't removing the unused tests frameworks.
To use with RSpec it will be as:
Shoulda::Matchers.configure do |config|
config.integrate do |with|
# Choose a test framework:
with.test_framework :rspec
# with.test_framework :minitest
# with.test_framework :minitest_4
# with.test_framework :test_unit
# Choose one or more libraries:
with.library :active_record
with.library :active_model
with.library :action_controller
# Or, choose the following (which implies all of the above):
with.library :rails
end
end
the echo command above may not work on all installs of Ubuntu 14.04. You can do a sudo vi and physically edit the test_case.rb file and put the require 'test/unit' after the existing require(s).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.