开发者

How to ignore rescue_from in ApplicationController in rspec tests?

开发者 https://www.devze.com 2023-03-20 01:09 出处:网络
By default, Cucumber ignores rescue_from in your ApplicationController and reports any exceptions directly.This is accomplished by the following line in the Cucumber env.rb file

By default, Cucumber ignores rescue_from in your ApplicationController and reports any exceptions directly. This is accomplished by the following line in the Cucumber env.rb file

# in features/support/env.rb
ActionController::Base.allow_rescue = false

Is there a way to get rspec to ignore rescue_from as well? (Specifically, I'm wishing that I could get rspec to ignore rescue_from CanCan::Acce开发者_运维技巧ssDenied.)


Can you not just put the same line into the spec_helper?

Why not just do the setup to have a logged in user present when testing? Will be a better test. You can put a hook into the spec_helper to do something before all your tests so you just put the sign in in one place for all your specs.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号