Serialize and submit password fields

This commit is contained in:
Jonas Nicklas and Kevin Fitzpatrick 2009-11-10 23:08:26 +01:00 committed by Jonas Nicklas
parent c15c17451b
commit c697d21da3
3 changed files with 10 additions and 1 deletions

View File

@ -42,7 +42,7 @@ class Webcat::Driver::RackTest
class Form < Node
def params(button)
params = []
params << node.xpath(".//input[@type='text']").inject([]) do |agg, input|
params << node.xpath(".//input[@type='text']", ".//input[@type='password']").inject([]) do |agg, input|
agg << param(input['name'].to_s, input['value'].to_s)
agg
end

View File

@ -66,6 +66,10 @@ shared_examples_for "session" do
@results['first_name'].should == 'John'
end
it "should serialize and submit password fields" do
@results['password'].should == 'seeekrit'
end
it "should not serialize fields from other forms" do
@results['middle_name'].should be_nil
end

View File

@ -11,6 +11,11 @@
<input type="text" name="form[last_name]" value="Smith" id="form_last_name"/>
</p>
<p>
<label for="form_password">Password</label>
<input type="password" name="form[password]" value="seeekrit" id="form_password"/>
</p>
<p>
<label for="form_locale">Locale</label>
<select name="form[locale]" id="form_locale">