I am new to rails and this is stopping me. I am trying to run rspec spec/ and I get errors. Can anyone help me?
This is the code I am getting:
/Library/Ruby/Gems/1.8/gems/rspec-rails-2.0.0.a6/lib/rspec/rails/transactional_database_support.rb:33: uninitialized constant Rspec::Core (NameError)
from /Library/Ruby/Gems/1.8/gems/rspec-rails-2.0.0.a6/lib/rspec/rails.rb:1 from /Users/Kendall/Sites/sample_app/spec/spec_helper.rb:4 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' from /Users/Kendall/Sites/sample_app/spec/controllers/pages_controller_spec.rb:1 from /Library/Ruby/Gems/1.8/gems/rspec-core-2.1.0/lib/rspec/core/configuration.rb:334:in `load' from /Library/Ruby/Gems/1.8/gems/rspec-core-2.1.0/lib/rspec/core/configuration.rb:334:in `load_spec_files' from /Library/Ruby/Gems/1.8/gems/rspec-core-2.1.0/lib/rspec/core/configuration.rb:334:in `map' from开发者_StackOverflow中文版 /Library/Ruby/Gems/1.8/gems/rspec-core-2.1.0/lib/rspec/core/configuration.rb:334:in `load_spec_files' from /Library/Ruby/Gems/1.8/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:18:in `run' from /Library/Ruby/Gems/1.8/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:55:in `run_in_process' from /Library/Ruby/Gems/1.8/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:46:in `run' from /Library/Ruby/Gems/1.8/gems/rspec-core-2.1.0/lib/rspec/core/runner.rb:10:in `autorun' from /usr/bin/rspec:19
Use
sudo gem update rspec-rails
It looks like you have an older version of the rspec-rails gem installed. Try updating it (2.1.0 is the current version at the time of writing):
gem update rspec-rails
Updated following comments:
You will need to specify the name of one or more spec files or a directory containing your spec files. For example if your spec files are in a folder called spec then this will run them all:
rspec spec
In a Rails project using Bundler:
bundle exec rspec spec
For more info on the rspec command:
rspec -h
Maybe is late, but for the error:
No examples were matched. Perhaps {:unless=>#<Proc:0x00000001005b7790@/Library/Ruby/Gems/1.8/gems/rspec-core-2.1.0/lib/rspec/core/configuration.rb:53>, :if=>#<Proc:0x00000001005b7970@/Library/Ruby/Gems/1.8/gems/rspec-core-2.1.0/lib/rspec/core/configuration.rb:52>} is excluding everything? Finished in 0.00003 seconds 0 examples, 0 failures
Like it says, a test wasn't found in your test_spec file. You should add an "it" expression with your test case.
精彩评论