2014-05-19 149 views
0

我用 gem 'rspec-rails', "~> 2.14.2"和我所有的測試工作。現在我安裝 gem 'rspec', '~> 3.0.0.beta',我得到這個:Rspec 3.0.0 Ruby on rails

[email protected]:~/git/EduWords$ bundle exec rspec 
/home/henio/.rvm/gems/ruby-2.1.1/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `require': cannot load such file -- rspec/rails (LoadError) 
    from /home/henio/.rvm/gems/ruby-2.1.1/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `block in require' 
    from /home/henio/.rvm/gems/ruby-2.1.1/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:214:in `load_dependency' 
    from /home/henio/.rvm/gems/ruby-2.1.1/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `require' 
    from /home/henio/git/EduWords/spec/spec_helper.rb:4:in `<top (required)>' 
    from /home/henio/git/EduWords/spec/features/languages_pages_spec.rb:1:in `require' 
    from /home/henio/git/EduWords/spec/features/languages_pages_spec.rb:1:in `<top (required)>' 
    from /home/henio/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.rc1/lib/rspec/core/configuration.rb:1051:in `load' 
    from /home/henio/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.rc1/lib/rspec/core/configuration.rb:1051:in `block in load_spec_files' 
    from /home/henio/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.rc1/lib/rspec/core/configuration.rb:1051:in `each' 
    from /home/henio/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.rc1/lib/rspec/core/configuration.rb:1051:in `load_spec_files' 
    from /home/henio/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.rc1/lib/rspec/core/runner.rb:97:in `setup' 
    from /home/henio/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.rc1/lib/rspec/core/runner.rb:85:in `run' 
    from /home/henio/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.rc1/lib/rspec/core/runner.rb:70:in `run' 
    from /home/henio/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.rc1/lib/rspec/core/runner.rb:38:in `invoke' 
    from /home/henio/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.rc1/exe/rspec:4:in `<top (required)>' 
    from /home/henio/.rvm/gems/ruby-2.1.1/bin/rspec:23:in `load' 
    from /home/henio/.rvm/gems/ruby-2.1.1/bin/rspec:23:in `<main>' 
    from /home/henio/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval' 
    from /home/henio/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>' 

我用Rails 4.0.3和Ruby 2.1.1p76。我做了bundle install。我在做錯什麼?

回答

4

如果您使用Rails,則應該使用rspec-rails將Rails與RSpec集成。改變你的寶石要求的:

gem 'rspec-rails', '~> 3.0.0.beta' 

RSpec的3 introduces significant changes,所以你必須要更新一些規格。

+0

好的,我改變了它,但現在幾乎所有的測試都失敗了。 f.e rspec ./spec/routing/tags_routing_spec.rb:14#TagsController路由標記路由到#edit – henio180

+0

這是可以預料的,因爲RSpec 3改變了很多事情。你爲什麼升級? –

+0

如果您需要幫助瞭解您的規格現在失敗的原因,則應該提出一個新問題。 –