Change from ArgumentError to TypeError where TypeError makes more sense

This commit is contained in:
Thomas Walpole 2016-12-28 16:49:45 -08:00
parent f7e537006a
commit c96213c5bb
3 changed files with 4 additions and 4 deletions

View File

@ -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?

View File

@ -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

View File

@ -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