0

我正在建立一个项目,并一直试图让 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)>'

我已经尝试过这里提到的任何东西

# 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'
4

1 回答 1

1

我终于得到了这个工作,我在没有 gem 版本的情况下运行 bundler 时使用gem 'rr', '1.1.2'而不是自动安装。1.2.0

于 2016-06-22T11:50:06.990 回答