From a090efc7ea377827b048a020fe4c031891a9e995 Mon Sep 17 00:00:00 2001 From: Pedro Moreira Date: Mon, 7 Mar 2016 12:50:57 +0000 Subject: [PATCH] Make check conditional to Rails version This PR depends on action_dispatch.show_detailed_exceptions being set, which was only introduced in Rails 3.2.1. Here we introduce a conditional check based on the required Rails version in order to ensure backwards compatibility. --- lib/cucumber/rails/action_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/cucumber/rails/action_controller.rb b/lib/cucumber/rails/action_controller.rb index 705089b1..9a93ca28 100644 --- a/lib/cucumber/rails/action_controller.rb +++ b/lib/cucumber/rails/action_controller.rb @@ -7,7 +7,9 @@ class ActionDispatch::ShowExceptions def call(env) env['action_dispatch.show_exceptions'] = !!ActionController::Base.allow_rescue - env['action_dispatch.show_detailed_exceptions'] = !ActionController::Base.allow_rescue + if Rails.version >= "3.2.1" + env['action_dispatch.show_detailed_exceptions'] = !ActionController::Base.allow_rescue + end __cucumber_orig_call__(env) end end