Skip to content

Commit

Permalink
Change from ArgumentError to TypeError where TypeError makes more sense
Browse files Browse the repository at this point in the history
  • Loading branch information
twalpole committed Dec 29, 2016
1 parent f7e5370 commit c96213c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/capybara/rack_test/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def value

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?
Expand Down
4 changes: 2 additions & 2 deletions lib/capybara/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Session
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?
Expand Down Expand Up @@ -393,7 +393,7 @@ def within_frame(*args)
idx = args[0]
all(:frame, minimum: idx+1)[idx]
else
raise ArgumentError
raise TypeError
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/session_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
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

0 comments on commit c96213c

Please sign in to comment.