Merge commit 'mfilej/master'
This commit is contained in:
commit
e4cbf943a9
|
@ -56,7 +56,6 @@ module Webrat
|
|||
|
||||
def to_param
|
||||
return nil if disabled?
|
||||
value = @value.to_s.gsub('&', '%26')
|
||||
param_parser.parse_query_parameters("#{name}=#{value}")
|
||||
end
|
||||
|
||||
|
@ -78,6 +77,10 @@ module Webrat
|
|||
@element["name"]
|
||||
end
|
||||
|
||||
def value
|
||||
CGI.escape(@value.to_s)
|
||||
end
|
||||
|
||||
def labels
|
||||
@labels ||= label_elements.map { |element| Label.new(self, element) }
|
||||
end
|
||||
|
|
|
@ -157,4 +157,17 @@ describe "fills_in" do
|
|||
@session.fills_in :email, :with => "foo@example.com"
|
||||
@session.clicks_button
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue