rspec错误michael hartl第3课

时间:2016-10-06 14:02:52

标签: ruby-on-rails rspec rubygems

执行命令时

$ bundle exec rspec spec / requests / static_pages_spec.rb

我收到此错误 /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in require': cannot load such file -- test/unit/assertions (LoadError) from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in阻止要求'     来自/home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:214:in load_dependency' from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in要求“     来自/home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-rails-2.13.1/lib/rspec/rails/adapters.rb:3:in {{ 1}}需要”     来自/home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in <top (required)>' from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in load_dependency “     来自/home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in block in require' from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:214:in'     来自/home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in require' from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-rails-2.13.1/lib/rspec/rails.rb:11:in块in require'     来自/home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:214:in require' from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in要求“     来自/ home / sarfraz / Desktop / Rails Apps / sample_app / spec / spec_helper.rb:4:in load_dependency' from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in require'     来自/ home / sarfraz / Desktop / Rails Apps / sample_app / spec / requests / static_pages_spec.rb:1:in <top (required)>' from /home/sarfraz/Desktop/Rails Apps/sample_app/spec/requests/static_pages_spec.rb:1:in load'     来自/home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in {{ 1}}每个”     来自/home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in {{ 1}}运行”     来自/home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in {{ 1}}在自动运行'

中阻止

这是我的gemfile: 来源'https://rubygems.org'

捆绑边缘Rails代替:gem'rail',github:'rails / rails'

gem'rail','4.0.8'

使用sqlite3作为Active Record

的数据库

组:开发,:测试做     宝石'sqlite3'     宝石'rspec-rails','2.13.1' 端

组:测试做   宝石'selenium-webdriver','2.35.1'   宝石'capybara','2.1.0' 端

将SCSS用于样式表

宝石'sass-rails','〜&gt; 4.0.2'

使用Uglifier作为JavaScript资源的压缩器

gem'uglifier','&gt; = 1.3.0'

将CoffeeScript用于.js.coffee资产和视图

gem'coffee-rails','〜&gt; 4.0.0'

gem'therubyracer',平台:: ruby​​

使用jquery作为JavaScript库

gem'jquery-rails'

宝石'turbolinks'

gem'jbuilder','〜&gt; 1.2'

组:doc do   #s bundle exec rake doc:rails在doc / api下生成API。   gem'sdd',require:false 端

组:生产做   宝石'pg','0.15.1'   宝石'rails_12factor','0.0.2' 端

使用ActiveModel has_secure_password

gem'bcrypt','〜&gt; 3.1.7'

使用独角兽作为应用服务器

gem'unicorn'

使用Capistrano进行部署

gem'capistrano',group :: development

使用调试器

gem'debugger',group:[:development,:test]

请帮助我不能完全卡住.. 提前致谢

1 个答案:

答案 0 :(得分:0)

似乎正在加载测试/单元库而不是RSpec库。查看spec / spec_helper.rb和spec / rails_helper.rb的内容,以及spec文件中的'require'语句,以确保它们符合Hartl教程中的说明。另外,请确保您使用的是当前教程以及推荐的Ruby和Rails版本。