无法加载--spec_helper

时间:2014-07-11 03:30:43

标签: ruby-on-rails ruby rspec gem rubygems

我正在运行Rspec 3.0.0和Ruby 1.9.3。 我正在阅读测试优先的ruby教程:https://github.com/alexch/learn_ruby 当我通过第一个练习:00_hello并运行rake时,我不断收到以下错误:

c:\learn_ruby\00_hello>rake
(in c:/learn_ruby)
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:
36:in `require': cannot load such file -- spec_helper (LoadError)
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custo
m_require.rb:36:in `require'

我尝试了一些建议,例如将以下内容放在gemfile中:

group :development, :test do gem 'rspec-rails', '~> 3.0.0.beta' 
end 
bundle install
bundle exec 
rails generate rspec:install

这也没有帮助,我也尝试了rspec --init,但我仍然遇到同样的错误。我在hello_spec文件中也放了require spec_helper。有人可以帮帮我吗?

1 个答案:

答案 0 :(得分:1)

$ bundle install
$ bundle exec
$ rails generate rspec:install

应该从终端运行,而不是放在gemfile里面。 在终端中运行bundle,然后再次尝试rake命令。

相关问题