试图使RR模拟存根起作用时的Nomthod错误



我正在设置一个项目,并一直在尝试使RR模拟工作,但我遇到了Nomethod错误。我也尝试移动所需的方法,但没有任何作用。这是我的仓库

$ rspec spec/views
F
Failures:
  1) home/show.html.haml
     Failure/Error: stub(view).user { user }
     NoMethodError:
       undefined method `stub' for #<RSpec::ExampleGroups::HomeShowHtmlHaml:0x007fc245188f08>
     # ./spec/views/home/show.html.haml_spec.rb:6:in `block (2 levels) in <top (required)>'
     # /Users/saadbinakhlaq/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `load'
     # /Users/saadbinakhlaq/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `kernel_load'
     # /Users/saadbinakhlaq/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:24:in `run'
     # /Users/saadbinakhlaq/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/cli.rb:304:in `exec'
     # /Users/saadbinakhlaq/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/cli.rb:11:in `start'
     # /Users/saadbinakhlaq/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/exe/bundle:27:in `block in <top (required)>'
     # /Users/saadbinakhlaq/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
     # /Users/saadbinakhlaq/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'

我尝试了这里提到的任何RR

# Gemfile
group :test do
  gem 'rr', require: false
end
# test helper
require File.expand_path('../../config/environment', __FILE__)
require 'your/test/framework'  # if you are using something other than MiniTest / Test::Unit
require 'rr'

我最终得到了此功能,我使用了gem 'rr', '1.1.2',而不是1.2.0,它在没有GEM版本的Bundler运行时已安装了自动。

相关内容

  • 没有找到相关文章

最新更新