gpt4 book ai didi

ruby-on-rails - rspec 错误(michael hartl)

转载 作者:行者123 更新时间:2023-12-02 03:11:16 25 4
gpt4 key购买 nike

这是我在使用 bundle exec rspec spec/requests/static_pages_spec.rb 时遇到的错误。

我已经包含了 gem 测试单元。

请帮助我,我是 Rails 的新手。

/home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-rails-2.13.1/lib/rspec/rails/fixture_support.rb:19:in `block (2 levels) in <module:FixtureSupport>': private method `fixture_path' called for #<RSpec::Core::Configuration:0x005584a641b380> (NoMethodError)
Did you mean? fixture_path=
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-rails-2.13.1/lib/rspec/rails/fixture_support.rb:17:in `class_eval'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-rails-2.13.1/lib/rspec/rails/fixture_support.rb:17:in `block in <module:FixtureSupport>'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.0.8/lib/active_support/concern.rb:114:in `class_eval'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.0.8/lib/active_support/concern.rb:114:in `append_features'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:791:in `include'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:791:in `safe_include'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:785:in `block in configure_group'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:783:in `each'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:783:in `configure_group'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/world.rb:47:in `configure_group'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:290:in `set_it_up'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:241:in `subclass'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:228:in `describe'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/dsl.rb:18:in `describe'
from /home/sarfraz/Desktop/Rails Apps/sample_app/spec/requests/static_pages_spec.rb:3:in `<top (required)>'
from /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 `load'
from /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 `block in load_spec_files'
from /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 `each'
from /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 `load_spec_files'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run'
from /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 `run'
from /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'

最佳答案

最简单的解决方案是升级rspec-rails。例如,您可以在 Gemfile 中使用 gem 'rspec-rails', '~>2.13' 并从终端执行 bundle update rspec-rails。它为您设置 2.99.x。此版本至少适用于 ruby​​ 2.3.4,并提供向后兼容性。

关于ruby-on-rails - rspec 错误(michael hartl),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39894696/

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