Skip to content

Commit

Permalink
Fixed double-escaping of form fields with :rack_test.
Browse files Browse the repository at this point in the history
  • Loading branch information
djanowski committed Jun 24, 2009
1 parent 5eeceff commit 04c3ff5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/webrat/core/elements/field.rb
Expand Up @@ -90,7 +90,7 @@ def to_param
when :mechanize
{ name => value }
else
{ name => escaped_value }
{ name => value }
end
end

Expand Down
17 changes: 17 additions & 0 deletions spec/integration/rack/rack_app.rb
Expand Up @@ -13,4 +13,21 @@ class RackApp < Sinatra::Default
get "/foo" do
"spam"
end

get "/go" do
return <<-EOS
<form action="/go" method="post">
<input type="text" name="Name" />
<input type="text" name="Email" />
<input type="submit" value="Submit" />
</form>
EOS
end

post "/go" do
return <<-EOS
Hello, #{params[:Name]}
Your email is: #{params[:Email]}
EOS
end
end
18 changes: 9 additions & 9 deletions spec/integration/rack/test/webrat_rack_test.rb
Expand Up @@ -40,15 +40,15 @@ def test_assertions_after_visit
# assert response_body.include?('<form method="post" action="/go">')
# end
#
# def test_submits_form
# visit "/go"
# fill_in "Name", :with => "World"
# fill_in "Email", :with => "world@example.org"
# click_button "Submit"
#
# assert response_body.include?("Hello, World")
# assert response_body.include?("Your email is: world@example.org")
# end
def test_submits_form
visit "/go"
fill_in "Name", :with => "World"
fill_in "Email", :with => "world@example.org"
click_button "Submit"

assert response_body.include?("Hello, World")
assert response_body.include?("Your email is: world@example.org")
end
#
# def test_check_value_of_field
# visit "/"
Expand Down

0 comments on commit 04c3ff5

Please sign in to comment.