【问题标题】:Rspec - bypass strategy on ChewyRspec - Chewy 的绕过策略
【发布时间】:2015-12-23 09:16:56
【问题描述】:

Chewy documentation 建议为测试设置:bypass 策略,其中:

RSpec.configure do |config|
  config.before(:suite) do
    Chewy.strategy(:bypass)
  end
end

但我得到一个:

undefined method `strategy' for Chewy:Module (NoMethodError)

这里是我的spec_helper.rb

require 'devise'
require 'support/controller_macros'
require 'chewy/rspec'


RSpec.configure do |config|

  config.before(:suite) do
    Chewy.strategy(:bypass)
  end

  config.include Devise::TestHelpers, :type => :controller
  config.extend ControllerMacros, :type => :controller

 end

这里有什么建议吗?

提前致谢

耐嚼版本:0.6.2

rails 版本:4.1.7

rspec 版本:3.1.0

【问题讨论】:

    标签: ruby-on-rails rspec chewy-gem


    【解决方案1】:

    似乎直到版本 0.7.0 才添加旁路。您正在查看更高版本的文档。如果您单击 github 上的下拉菜单并选择标签并选择您的版本,您会看到没有提及策略。

    https://github.com/toptal/chewy/blob/v0.7.0/lib/chewy/strategy/bypass.rb

    【讨论】:

      猜你喜欢
      • 2014-03-17
      • 2012-12-30
      • 1970-01-01
      • 2013-09-06
      • 1970-01-01
      • 1970-01-01
      • 2015-07-11
      • 1970-01-01
      • 2013-05-23
      相关资源
      最近更新 更多