From c96213c5bbe9f7a6ca2508df9104fc3a1193e78f Mon Sep 17 00:00:00 2001 From: Thomas Walpole Date: Wed, 28 Dec 2016 16:49:45 -0800 Subject: [PATCH] Change from ArgumentError to TypeError where TypeError makes more sense --- lib/capybara/rack_test/node.rb | 2 +- lib/capybara/session.rb | 4 ++-- spec/session_spec.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/capybara/rack_test/node.rb b/lib/capybara/rack_test/node.rb index 0a142920..3a40de31 100644 --- a/lib/capybara/rack_test/node.rb +++ b/lib/capybara/rack_test/node.rb @@ -18,7 +18,7 @@ class Capybara::RackTest::Node < Capybara::Driver::Node def set(value) if (Array === value) && !multiple? - raise ArgumentError.new "Value cannot be an Array when 'multiple' attribute is not present. Not a #{value.class}" + raise TypeError.new "Value cannot be an Array when 'multiple' attribute is not present. Not a #{value.class}" end if radio? diff --git a/lib/capybara/session.rb b/lib/capybara/session.rb index 7ef343f7..a38f172a 100644 --- a/lib/capybara/session.rb +++ b/lib/capybara/session.rb @@ -67,7 +67,7 @@ module Capybara attr_accessor :synchronized def initialize(mode, app=nil) - raise ArgumentError, "The second parameter to Session::new should be a rack app if passed." if app && !app.respond_to?(:call) + raise TypeError, "The second parameter to Session::new should be a rack app if passed." if app && !app.respond_to?(:call) @mode = mode @app = app if Capybara.run_server and @app and driver.needs_server? @@ -393,7 +393,7 @@ module Capybara idx = args[0] all(:frame, minimum: idx+1)[idx] else - raise ArgumentError + raise TypeError end end diff --git a/spec/session_spec.rb b/spec/session_spec.rb index 5e911033..44755f46 100644 --- a/spec/session_spec.rb +++ b/spec/session_spec.rb @@ -5,6 +5,6 @@ RSpec.describe Capybara::Session do it "verifies a passed app is a rack app" do expect do Capybara::Session.new(:unknown, { random: "hash"}) - end.to raise_error ArgumentError, "The second parameter to Session::new should be a rack app if passed." + end.to raise_error TypeError, "The second parameter to Session::new should be a rack app if passed." end end