0
我已经使用了自定义设计失败应用程序。使用rspec测试设计CustomFailure应用程序
class CustomFailure < Devise::FailureApp
protected
def redirect_url
LOGIN_URL
end
末
我使用默认故障应用程序,并根据环境变量的自定义应用程序失败的。
我想用rspec测试这个功能。以下是我想在rspec的
If env['var'] = value
expect redirect_url to return 'hostname/customlogin/'
else
expect redirect_url to return 'hostname/sign_in/'
做的,但问题是,只有当我已经设置ENV [“变种”] CustomeFailure应用会存在。
if ENV["var"] == value
config.warden do |manager|
manager.failure_app = CustomFailure
end
end
那么我该如何测试呢?