Always raise Webrat::WebratErrors (or a subclass), not RuntimeErrors
This commit is contained in:
parent
db0488c0e2
commit
48e43a257c
@ -106,7 +106,7 @@ module Webrat
|
|||||||
elsif onclick.include?("m.setAttribute('value', 'put')")
|
elsif onclick.include?("m.setAttribute('value', 'put')")
|
||||||
:put
|
:put
|
||||||
else
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ describe "click_link" do
|
|||||||
|
|
||||||
lambda {
|
lambda {
|
||||||
click_link "Link"
|
click_link "Link"
|
||||||
}.should raise_error
|
}.should raise_error(Webrat::WebratError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should assert valid response" do
|
it "should assert valid response" do
|
||||||
@ -212,7 +212,7 @@ describe "click_link" do
|
|||||||
|
|
||||||
lambda {
|
lambda {
|
||||||
click_link "Missing link"
|
click_link "Missing link"
|
||||||
}.should raise_error
|
}.should raise_error(Webrat::NotFoundError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should not be case sensitive" do
|
it "should not be case sensitive" do
|
||||||
|
@ -100,7 +100,7 @@ describe "fill_in" do
|
|||||||
</form>
|
</form>
|
||||||
HTML
|
HTML
|
||||||
|
|
||||||
lambda { fill_in "mail", :with => "value" }.should raise_error
|
lambda { fill_in "mail", :with => "value" }.should raise_error(Webrat::NotFoundError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should anchor label matches to word boundaries" do
|
it "should anchor label matches to word boundaries" do
|
||||||
@ -111,7 +111,7 @@ describe "fill_in" do
|
|||||||
</form>
|
</form>
|
||||||
HTML
|
HTML
|
||||||
|
|
||||||
lambda { fill_in "Email", :with => "value" }.should raise_error
|
lambda { fill_in "Email", :with => "value" }.should raise_error(Webrat::NotFoundError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should work with inputs nested in labels" do
|
it "should work with inputs nested in labels" do
|
||||||
|
@ -74,7 +74,7 @@ describe "select_date" do
|
|||||||
</form>
|
</form>
|
||||||
HTML
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -92,7 +92,7 @@ describe "select_datetime" do
|
|||||||
</form>
|
</form>
|
||||||
HTML
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -30,7 +30,7 @@ describe "select" do
|
|||||||
</form>
|
</form>
|
||||||
HTML
|
HTML
|
||||||
|
|
||||||
lambda { select "February", :from => "year" }.should raise_error
|
lambda { select "February", :from => "year" }.should raise_error(Webrat::NotFoundError)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ describe "select" do
|
|||||||
</form>
|
</form>
|
||||||
HTML
|
HTML
|
||||||
|
|
||||||
lambda { select "January", :from => "month" }.should raise_error
|
lambda { select "January", :from => "month" }.should raise_error(Webrat::DisabledFieldError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should send value from option" do
|
it "should send value from option" do
|
||||||
|
@ -65,7 +65,7 @@ describe "select_time" do
|
|||||||
</form>
|
</form>
|
||||||
HTML
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -14,7 +14,7 @@ describe "visit" do
|
|||||||
|
|
||||||
it "should assert valid response" do
|
it "should assert valid response" do
|
||||||
webrat_session.response_code = 501
|
webrat_session.response_code = 501
|
||||||
lambda { visit("/") }.should raise_error
|
lambda { visit("/") }.should raise_error(Webrat::PageLoadError)
|
||||||
end
|
end
|
||||||
|
|
||||||
[200, 300, 400, 499].each do |status|
|
[200, 300, 400, 499].each do |status|
|
||||||
@ -25,7 +25,7 @@ describe "visit" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "should require a visit before manipulating page" do
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ describe "attach_file" do
|
|||||||
<form method="post" action="/widgets">
|
<form method="post" action="/widgets">
|
||||||
</form>
|
</form>
|
||||||
HTML
|
HTML
|
||||||
lambda { attach_file("Doc", "/some/path") }.should raise_error
|
lambda { attach_file("Doc", "/some/path") }.should raise_error(Webrat::NotFoundError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should submit empty strings for blank file fields" do
|
it "should submit empty strings for blank file fields" do
|
||||||
|
Loading…
Reference in New Issue
Block a user