From 6676ae2da9bec182b3ab5ee0a698a99e78fcaadf Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Sat, 17 Jan 2009 17:13:20 -0500 Subject: [PATCH] Adding integration test for field_labeled --- spec/integration/merb/app/views/testing/show_form.html.erb | 5 +++++ spec/integration/merb/spec/webrat_spec.rb | 5 +++++ spec/integration/rails/app/views/webrat/form.html.erb | 5 +++++ spec/integration/rails/test/integration/webrat_test.rb | 5 +++++ spec/integration/sinatra/app.rb | 7 +++++++ spec/integration/sinatra/test/webrat_test.rb | 5 +++++ 6 files changed, 32 insertions(+) diff --git a/spec/integration/merb/app/views/testing/show_form.html.erb b/spec/integration/merb/app/views/testing/show_form.html.erb index cee070b..b4265b3 100644 --- a/spec/integration/merb/app/views/testing/show_form.html.erb +++ b/spec/integration/merb/app/views/testing/show_form.html.erb @@ -10,6 +10,11 @@ TOS + + + diff --git a/spec/integration/rails/test/integration/webrat_test.rb b/spec/integration/rails/test/integration/webrat_test.rb index 5f03230..f31ac24 100644 --- a/spec/integration/rails/test/integration/webrat_test.rb +++ b/spec/integration/rails/test/integration/webrat_test.rb @@ -16,6 +16,11 @@ class WebratTest < ActionController::IntegrationTest click_button "Test" end + test "should check the value of a field" do + visit "/" + assert field_labeled("Prefilled").value, "text" + end + test "should follow internal redirects" do visit internal_redirect_path assert response.body.include?("OK") diff --git a/spec/integration/sinatra/app.rb b/spec/integration/sinatra/app.rb index ba53c76..dd0f439 100644 --- a/spec/integration/sinatra/app.rb +++ b/spec/integration/sinatra/app.rb @@ -39,6 +39,13 @@ __END__ @@ home

visit there

+
+ +
+ @@ go
diff --git a/spec/integration/sinatra/test/webrat_test.rb b/spec/integration/sinatra/test/webrat_test.rb index 534f6eb..e694edb 100644 --- a/spec/integration/sinatra/test/webrat_test.rb +++ b/spec/integration/sinatra/test/webrat_test.rb @@ -19,6 +19,11 @@ class WebratTest < Test::Unit::TestCase assert response_body.include?("Your email is: world@example.org") end + def test_check_value_of_field + visit "/" + assert field_labeled("Prefilled").value, "text" + end + def test_follows_internal_redirects visit "/internal_redirect" assert response_body.include?("visit")