用于ActionDispatch路由的Rspec undefined方法’helpers’

我正在将旧的rails 3应用程序升级到rails 5,并在此过程中升级Rspec。 运行测试时,出现错误:

NoMethodError Exception: undefined method `helpers' for # 

每当我在响应上调用be_success时。 见例子:

  it "renders 'OK' text when request is html" do get :ping expect(response).to be_success response.body.should == 'OK' end 

我在运行此测试时遇到错误。 插入断点后,我看到每当调用be_success时都会抛出错误…

 (byebug) be_success *** NoMethodError Exception: undefined method `helpers' for # Did you mean? helper_names 

我在我的spec_helper文件中包含了config.include Rails.application.routes.url_helpers(使用rails路径路径时遇到了类似的问题),但它对此错误没有帮助。