From a4cd737ebb14b8f53d96119adf28d3055d4b2a78 Mon Sep 17 00:00:00 2001 From: Dan Mace Date: Tue, 22 Apr 2014 12:06:34 -0400 Subject: [PATCH] Use Ruby 2.x compatible rescue clauses Ruby 2.x doesn't support non-class/module arguments to rescue clauses. Ruby 1.9 only supported it due to what is now considered a regression: https://bugs.ruby-lang.org/issues/4438 Remove string arguments from rescue clauses to prevent TypeErrors from being raised during rescue attempts. --- lib/capybara/driver/node.rb | 2 +- lib/capybara/node/element.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/capybara/driver/node.rb b/lib/capybara/driver/node.rb index 8cc2eeff9..017b390d9 100644 --- a/lib/capybara/driver/node.rb +++ b/lib/capybara/driver/node.rb @@ -87,7 +87,7 @@ def trigger(event) def inspect %(#<#{self.class} tag="#{tag_name}" path="#{path}">) - rescue NotSupportedByDriverError, 'Capybara::Driver::Node#inspect' + rescue NotSupportedByDriverError %(#<#{self.class} tag="#{tag_name}">) end diff --git a/lib/capybara/node/element.rb b/lib/capybara/node/element.rb index 3eb693edf..21cbe2091 100644 --- a/lib/capybara/node/element.rb +++ b/lib/capybara/node/element.rb @@ -240,7 +240,7 @@ def reload def inspect %(#) - rescue NotSupportedByDriverError, 'Capybara::Node::Element#inspect' + rescue NotSupportedByDriverError %(#) end end