gpt4 book ai didi

rspec "cannot load such file"

转载 作者:行者123 更新时间:2023-12-04 06:21:48 25 4
gpt4 key购买 nike

第一次使用 Rails 教程运行 rspec,p。 95.
得到这个输出:

    david@david-desktop:~/rails_projects/sample_app1$ bundle exec rspec /spec/requests/static_pages_spec.rb
/home/david/.rvm/gems/ruby-1.9.3-p362@rails3tutorial2nded/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `load': cannot load such file -- /spec/requests/static_pages_spec.rb (LoadError)
from /home/david/.rvm/gems/ruby-1.9.3-p362@rails3tutorial2nded/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `block in load_spec_files'
from /home/david/.rvm/gems/ruby-1.9.3-p362@rails3tutorial2nded/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `map'
from /home/david/.rvm/gems/ruby-1.9.3-p362@rails3tutorial2nded/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `load_spec_files'
from /home/david/.rvm/gems/ruby-1.9.3-p362@rails3tutorial2nded/gems/rspec-core-2.9.0/lib/rspec/core/command_line.rb:22:in `run'
from /home/david/.rvm/gems/ruby-1.9.3-p362@rails3tutorial2nded/gems/rspec-core-2.9.0/lib/rspec/core/runner.rb:69:in `run'
from /home/david/.rvm/gems/ruby-1.9.3-p362@rails3tutorial2nded/gems/rspec-core-2.9.0/lib/rspec/core/runner.rb:10:in `block in autorun'

这是 Gemfile:
    source 'https://rubygems.org'

gem 'rails', '3.2.3'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.9.0'
end


# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.4'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platform => :ruby
end

gem 'jquery-rails'

group :test do
gem 'capybara', '1.1.2'
end

已经完成了 rails 生成 rspec:install 和
rails 生成 integration_test static_pages 命令。想法?

最佳答案

删除文件名中的前导斜杠:

bundle exec rspec spec/requests/static_pages_spec.rb

关于rspec "cannot load such file",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14130673/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com