Always raise Webrat::WebratErrors (or a subclass), not RuntimeErrors

This commit is contained in:
Bryan Helmkamp 2008-11-23 14:08:34 -05:00
parent db0488c0e2
commit 48e43a257c
9 changed files with 13 additions and 13 deletions

View File

@ -106,7 +106,7 @@ module Webrat
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

View File

@ -184,7 +184,7 @@ describe "click_link" do
lambda {
click_link "Link"
}.should raise_error
}.should raise_error(Webrat::WebratError)
end
it "should assert valid response" do
@ -212,7 +212,7 @@ describe "click_link" do
lambda {
click_link "Missing link"
}.should raise_error
}.should raise_error(Webrat::NotFoundError)
end
it "should not be case sensitive" do

View File

@ -100,7 +100,7 @@ describe "fill_in" do
</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
@ -111,7 +111,7 @@ describe "fill_in" do
</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

View File

@ -74,7 +74,7 @@ describe "select_date" do
</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

View File

@ -92,7 +92,7 @@ describe "select_datetime" do
</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

View File

@ -30,7 +30,7 @@ describe "select" do
</form>
HTML
lambda { select "February", :from => "year" }.should raise_error
lambda { select "February", :from => "year" }.should raise_error(Webrat::NotFoundError)
end
@ -42,7 +42,7 @@ describe "select" do
</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

View File

@ -65,7 +65,7 @@ describe "select_time" do
</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

View File

@ -14,7 +14,7 @@ describe "visit" do
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|
@ -25,7 +25,7 @@ describe "visit" do
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

View File

@ -12,7 +12,7 @@ describe "attach_file" do
<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