Skip to content

Commit

Permalink
Always raise Webrat::WebratErrors (or a subclass), not RuntimeErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
brynary committed Nov 23, 2008
1 parent db0488c commit 48e43a2
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/webrat/core/link.rb
Expand Up @@ -106,7 +106,7 @@ def http_method_from_fake_method_param
elsif onclick.include?("m.setAttribute('value', 'put')")
:put
else
raise "No HTTP method for _method param in #{onclick.inspect}"
raise Webrat::WebratError.new("No HTTP method for _method param in #{onclick.inspect}")
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/api/click_link_spec.rb
Expand Up @@ -184,7 +184,7 @@

lambda {
click_link "Link"
}.should raise_error
}.should raise_error(Webrat::WebratError)
end

it "should assert valid response" do
Expand Down Expand Up @@ -212,7 +212,7 @@

lambda {
click_link "Missing link"
}.should raise_error
}.should raise_error(Webrat::NotFoundError)
end

it "should not be case sensitive" do
Expand Down
4 changes: 2 additions & 2 deletions spec/api/fill_in_spec.rb
Expand Up @@ -100,7 +100,7 @@
</form>
HTML

lambda { fill_in "mail", :with => "value" }.should raise_error
lambda { fill_in "mail", :with => "value" }.should raise_error(Webrat::NotFoundError)
end

it "should anchor label matches to word boundaries" do
Expand All @@ -111,7 +111,7 @@
</form>
HTML

lambda { fill_in "Email", :with => "value" }.should raise_error
lambda { fill_in "Email", :with => "value" }.should raise_error(Webrat::NotFoundError)
end

it "should work with inputs nested in labels" do
Expand Down
2 changes: 1 addition & 1 deletion spec/api/selects_date_spec.rb
Expand Up @@ -74,7 +74,7 @@
</form>
HTML

lambda { select_date "December 25, 2003", :from => "date" }.should raise_error
lambda { select_date "December 25, 2003", :from => "date" }.should raise_error(Webrat::NotFoundError)
end

end
2 changes: 1 addition & 1 deletion spec/api/selects_datetime_spec.rb
Expand Up @@ -92,7 +92,7 @@
</form>
HTML

lambda { select_datetime "December 25, 2003 9:30", :from => "Time" }.should raise_error
lambda { select_datetime "December 25, 2003 9:30", :from => "Time" }.should raise_error(Webrat::NotFoundError)
end

end
4 changes: 2 additions & 2 deletions spec/api/selects_spec.rb
Expand Up @@ -30,7 +30,7 @@
</form>
HTML

lambda { select "February", :from => "year" }.should raise_error
lambda { select "February", :from => "year" }.should raise_error(Webrat::NotFoundError)
end


Expand All @@ -42,7 +42,7 @@
</form>
HTML

lambda { select "January", :from => "month" }.should raise_error
lambda { select "January", :from => "month" }.should raise_error(Webrat::DisabledFieldError)
end

it "should send value from option" do
Expand Down
2 changes: 1 addition & 1 deletion spec/api/selects_time_spec.rb
Expand Up @@ -65,7 +65,7 @@
</form>
HTML

lambda { select_time "9:30", :from => "Time" }.should raise_error
lambda { select_time "9:30", :from => "Time" }.should raise_error(Webrat::NotFoundError)
end

end
4 changes: 2 additions & 2 deletions spec/api/visit_spec.rb
Expand Up @@ -14,7 +14,7 @@

it "should assert valid response" do
webrat_session.response_code = 501
lambda { visit("/") }.should raise_error
lambda { visit("/") }.should raise_error(Webrat::PageLoadError)
end

[200, 300, 400, 499].each do |status|
Expand All @@ -25,7 +25,7 @@
end

it "should require a visit before manipulating page" do
lambda { fill_in "foo", :with => "blah" }.should raise_error
lambda { fill_in "foo", :with => "blah" }.should raise_error(Webrat::WebratError)
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/webrat/rails/attaches_file_spec.rb
Expand Up @@ -12,7 +12,7 @@
<form method="post" action="/widgets">
</form>
HTML
lambda { attach_file("Doc", "/some/path") }.should raise_error
lambda { attach_file("Doc", "/some/path") }.should raise_error(Webrat::NotFoundError)
end

it "should submit empty strings for blank file fields" do
Expand Down

0 comments on commit 48e43a2

Please sign in to comment.