$ 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'
gem'rail','4.0.8'
组:开发,:测试做 宝石'sqlite3' 宝石'rspec-rails','2.13.1' 端
组:测试做 宝石'selenium-webdriver','2.35.1' 宝石'capybara','2.1.0' 端
宝石'sass-rails','〜&gt; 4.0.2'
gem'uglifier','&gt; = 1.3.0'
gem'coffee-rails','〜&gt; 4.0.0'
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' 端
请帮助我不能完全卡住.. 提前致谢
答案 0 :(得分:0)
似乎正在加载测试/单元库而不是RSpec库。查看spec / spec_helper.rb和spec / rails_helper.rb的内容,以及spec文件中的'require'语句,以确保它们符合Hartl教程中的说明。另外,请确保您使用的是当前教程以及推荐的Ruby和Rails版本。