【发布时间】:2017-06-13 15:48:15
【问题描述】:
我是 Rails 新手,我想使用 Mac 运行 Rspec。
当我跑步时:
bundle exec rspec spec/00_hello_spec.rb
我收到以下回复:
bundler: failed to load command: rspec (/Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/bin/rspec)
LoadError: cannot load such file -- spec_helper
/Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1181:in `require'
/Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1181:in `block in requires='
/Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1181:in `each'
/Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1181:in `requires='
/Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration_options.rb:110:in `block in process_options_into'
/Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration_options.rb:109:in `each'
/Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration_options.rb:109:in `process_options_into'
/Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration_options.rb:22:in `configure'
/Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:96:in `setup'
/Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:85:in `run'
/Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:70:in `run'
/Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:38:in `invoke'
/Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/gems/rspec-core-3.2.3/exe/rspec:4:in `<top (required)>'
/Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/bin/rspec:22:in `load'
/Users/OumouKaba/Downloads/test-first-ruby-master/vendor/bundle/ruby/2.4.0/bin/rspec:22:in `<top (required)>'
请提供有关此问题的任何建议或说明。补充一点,我已经在文件系统的各个级别从根向上完成了此操作。我非常感谢任何帮助我摆脱困境的澄清。
【问题讨论】:
-
你跑
rails generate rspec:install了吗? -
文件
spec/spec_helper.rb是否存在?该文件通常是自动生成的,但如果您可以轻松地手动添加它。 -
文件
spec/00_hello_spec.rb的第一行可能是require "spec_helper",并且该文件不存在。这就是错误消息告诉您的内容。 -
> 我能够让它工作 完成此操作的命令是什么?
-
这种评论——“哦,没关系,我想通了”——对于其他在搜索错误消息后发现这个问题的人来说毫无帮助。