Adding integration test for field_labeled
This commit is contained in:
parent
9be3f772bf
commit
6676ae2da9
@ -10,6 +10,11 @@
|
|||||||
TOS <input type="checkbox" name="tos" />
|
TOS <input type="checkbox" name="tos" />
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
Prefilled
|
||||||
|
<input type="text" name="prefilled" value="text" />
|
||||||
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
Month
|
Month
|
||||||
<select name="month">
|
<select name="month">
|
||||||
|
@ -20,6 +20,11 @@ describe "Webrat" do
|
|||||||
response.should contain("Webrat Form")
|
response.should contain("Webrat Form")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should check the value of a field" do
|
||||||
|
visit "/"
|
||||||
|
field_labeled("Prefilled").value.should == "text"
|
||||||
|
end
|
||||||
|
|
||||||
it "should not follow external redirects" do
|
it "should not follow external redirects" do
|
||||||
response = visit "/external_redirect"
|
response = visit "/external_redirect"
|
||||||
response.status.should == 302
|
response.status.should == 302
|
||||||
|
@ -9,6 +9,11 @@
|
|||||||
TOS <%= check_box_tag "tos" %>
|
TOS <%= check_box_tag "tos" %>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
Prefilled
|
||||||
|
<input type="text" name="prefilled" value="text" />
|
||||||
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<%= select_tag "month", "<option></option><option>January</option>" %>
|
<%= select_tag "month", "<option></option><option>January</option>" %>
|
||||||
</label>
|
</label>
|
||||||
|
@ -16,6 +16,11 @@ class WebratTest < ActionController::IntegrationTest
|
|||||||
click_button "Test"
|
click_button "Test"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "should check the value of a field" do
|
||||||
|
visit "/"
|
||||||
|
assert field_labeled("Prefilled").value, "text"
|
||||||
|
end
|
||||||
|
|
||||||
test "should follow internal redirects" do
|
test "should follow internal redirects" do
|
||||||
visit internal_redirect_path
|
visit internal_redirect_path
|
||||||
assert response.body.include?("OK")
|
assert response.body.include?("OK")
|
||||||
|
@ -39,6 +39,13 @@ __END__
|
|||||||
@@ home
|
@@ home
|
||||||
<p> visit <a href="/go">there</a></p>
|
<p> visit <a href="/go">there</a></p>
|
||||||
|
|
||||||
|
<form>
|
||||||
|
<label>
|
||||||
|
Prefilled
|
||||||
|
<input type="text" name="prefilled" value="text" />
|
||||||
|
</label>
|
||||||
|
</form>
|
||||||
|
|
||||||
@@ go
|
@@ go
|
||||||
<form method="post" action="/go">
|
<form method="post" action="/go">
|
||||||
<div>
|
<div>
|
||||||
|
@ -19,6 +19,11 @@ class WebratTest < Test::Unit::TestCase
|
|||||||
assert response_body.include?("Your email is: world@example.org")
|
assert response_body.include?("Your email is: world@example.org")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_check_value_of_field
|
||||||
|
visit "/"
|
||||||
|
assert field_labeled("Prefilled").value, "text"
|
||||||
|
end
|
||||||
|
|
||||||
def test_follows_internal_redirects
|
def test_follows_internal_redirects
|
||||||
visit "/internal_redirect"
|
visit "/internal_redirect"
|
||||||
assert response_body.include?("visit")
|
assert response_body.include?("visit")
|
||||||
|
Loading…
Reference in New Issue
Block a user