Merge commit 'mfilej/master'

This commit is contained in:
Bryan Helmkamp 2008-10-21 22:02:46 -04:00
commit e4cbf943a9
2 changed files with 18 additions and 2 deletions

View File

@ -56,7 +56,6 @@ module Webrat
def to_param def to_param
return nil if disabled? return nil if disabled?
value = @value.to_s.gsub('&', '%26')
param_parser.parse_query_parameters("#{name}=#{value}") param_parser.parse_query_parameters("#{name}=#{value}")
end end
@ -78,6 +77,10 @@ module Webrat
@element["name"] @element["name"]
end end
def value
CGI.escape(@value.to_s)
end
def labels def labels
@labels ||= label_elements.map { |element| Label.new(self, element) } @labels ||= label_elements.map { |element| Label.new(self, element) }
end end

View File

@ -157,4 +157,17 @@ describe "fills_in" do
@session.fills_in :email, :with => "foo@example.com" @session.fills_in :email, :with => "foo@example.com"
@session.clicks_button @session.clicks_button
end end
it "should escape field values" do
@session.response_body = <<-EOS
<form method="post" action="/users">
<label for="user_phone">Phone</label>
<input id="user_phone" name="user[phone]" type="text" />
<input type="submit" />
</form>
EOS
@session.should_receive(:post).with("/users", "user" => {"phone" => "+1 22 33"})
@session.fills_in 'Phone', :with => "+1 22 33"
@session.clicks_button
end
end end