mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Change from ArgumentError to TypeError where TypeError makes more sense
This commit is contained in:
parent
f7e537006a
commit
c96213c5bb
3 changed files with 4 additions and 4 deletions
|
@ -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?
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue