From 1cf7bff09f3cad2e1bd29df19f1066a2a409eacb Mon Sep 17 00:00:00 2001
From: Jonas Nicklas
Date: Wed, 11 Nov 2009 21:41:20 +0100
Subject: [PATCH] Submit hidden fields
---
lib/webcat/driver/rack_test_driver.rb | 2 +-
spec/session_spec.rb | 4 ++++
spec/views/form.erb | 4 ++++
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/webcat/driver/rack_test_driver.rb b/lib/webcat/driver/rack_test_driver.rb
index 8a82be3c..0f75c0c3 100644
--- a/lib/webcat/driver/rack_test_driver.rb
+++ b/lib/webcat/driver/rack_test_driver.rb
@@ -49,7 +49,7 @@ class Webcat::Driver::RackTest
class Form < Node
def params(button)
params = []
- params << node.xpath(".//input[@type='text']", ".//input[@type='password']").inject([]) do |agg, input|
+ params << node.xpath(".//input[@type='text']", ".//input[@type='hidden']", ".//input[@type='password']").inject([]) do |agg, input|
agg << param(input['name'].to_s, input['value'].to_s)
agg
end
diff --git a/spec/session_spec.rb b/spec/session_spec.rb
index 0c073169..f0744d77 100644
--- a/spec/session_spec.rb
+++ b/spec/session_spec.rb
@@ -70,6 +70,10 @@ shared_examples_for "session" do
@results['password'].should == 'seeekrit'
end
+ it "should serialize and submit hidden fields" do
+ @results['token'].should == '12345'
+ end
+
it "should not serialize fields from other forms" do
@results['middle_name'].should be_nil
end
diff --git a/spec/views/form.erb b/spec/views/form.erb
index 051fd536..abafd740 100644
--- a/spec/views/form.erb
+++ b/spec/views/form.erb
@@ -15,6 +15,10 @@
+
+
+
+