webrat 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +37 -0
- data/MIT-LICENSE.txt +19 -0
- data/Manifest.txt +20 -0
- data/README.txt +86 -0
- data/Rakefile +27 -0
- data/TODO.txt +4 -0
- data/init.rb +3 -0
- data/install.rb +1 -0
- data/lib/webrat.rb +6 -0
- data/lib/webrat/rails_extensions.rb +27 -0
- data/lib/webrat/session.rb +523 -0
- data/test/checks_test.rb +121 -0
- data/test/chooses_test.rb +74 -0
- data/test/clicks_button_test.rb +308 -0
- data/test/clicks_link_test.rb +193 -0
- data/test/fills_in_test.rb +139 -0
- data/test/helper.rb +21 -0
- data/test/reloads_test.rb +26 -0
- data/test/selects_test.rb +93 -0
- data/test/visits_test.rb +31 -0
- metadata +104 -0
data/test/checks_test.rb
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/helper"
|
2
|
+
|
3
|
+
class ChecksTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@session = ActionController::Integration::Session.new
|
6
|
+
@session.stubs(:assert_response)
|
7
|
+
@session.stubs(:get_via_redirect)
|
8
|
+
@session.stubs(:response).returns(@response=mock)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_should_fail_if_no_checkbox_found
|
12
|
+
@response.stubs(:body).returns(<<-EOS)
|
13
|
+
<form method="post" action="/login">
|
14
|
+
</form>
|
15
|
+
EOS
|
16
|
+
@session.expects(:flunk)
|
17
|
+
@session.checks "remember_me"
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_should_fail_if_input_is_not_a_checkbox
|
21
|
+
@response.stubs(:body).returns(<<-EOS)
|
22
|
+
<form method="post" action="/login">
|
23
|
+
<input type="text" name="remember_me" />
|
24
|
+
</form>
|
25
|
+
EOS
|
26
|
+
@session.expects(:flunk)
|
27
|
+
@session.checks "remember_me"
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_should_check_rails_style_checkboxes
|
31
|
+
@response.stubs(:body).returns(<<-EOS)
|
32
|
+
<form method="get" action="/login">
|
33
|
+
<input id="user_tos" name="user[tos]" type="checkbox" value="1" />
|
34
|
+
<input name="user[tos]" type="hidden" value="0" />
|
35
|
+
<label for="user_tos">TOS</label>
|
36
|
+
<input type="submit" />
|
37
|
+
</form>
|
38
|
+
EOS
|
39
|
+
@session.expects(:get_via_redirect).with("/login", "user" => {"tos" => "1"})
|
40
|
+
@session.checks "TOS"
|
41
|
+
@session.clicks_button
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_should_result_in_the_value_on_being_posted_if_not_specified
|
45
|
+
@response.stubs(:body).returns(<<-EOS)
|
46
|
+
<form method="post" action="/login">
|
47
|
+
<input type="checkbox" name="remember_me" />
|
48
|
+
<input type="submit" />
|
49
|
+
</form>
|
50
|
+
EOS
|
51
|
+
@session.expects(:post_via_redirect).with("/login", "remember_me" => "on")
|
52
|
+
@session.checks "remember_me"
|
53
|
+
@session.clicks_button
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_should_result_in_a_custom_value_being_posted
|
57
|
+
@response.stubs(:body).returns(<<-EOS)
|
58
|
+
<form method="post" action="/login">
|
59
|
+
<input type="checkbox" name="remember_me" value="yes" />
|
60
|
+
<input type="submit" />
|
61
|
+
</form>
|
62
|
+
EOS
|
63
|
+
@session.expects(:post_via_redirect).with("/login", "remember_me" => "yes")
|
64
|
+
@session.checks "remember_me"
|
65
|
+
@session.clicks_button
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
class UnchecksTest < Test::Unit::TestCase
|
70
|
+
def setup
|
71
|
+
@session = ActionController::Integration::Session.new
|
72
|
+
@session.stubs(:assert_response)
|
73
|
+
@session.stubs(:get_via_redirect)
|
74
|
+
@session.stubs(:response).returns(@response=mock)
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_should_fail_if_no_checkbox_found
|
78
|
+
@response.stubs(:body).returns(<<-EOS)
|
79
|
+
<form method="post" action="/login">
|
80
|
+
</form>
|
81
|
+
EOS
|
82
|
+
@session.expects(:flunk)
|
83
|
+
@session.unchecks "remember_me"
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_should_fail_if_input_is_not_a_checkbox
|
87
|
+
@response.stubs(:body).returns(<<-EOS)
|
88
|
+
<form method="post" action="/login">
|
89
|
+
<input type="text" name="remember_me" />
|
90
|
+
</form>
|
91
|
+
EOS
|
92
|
+
@session.expects(:flunk)
|
93
|
+
@session.unchecks "remember_me"
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_should_uncheck_rails_style_checkboxes
|
97
|
+
@response.stubs(:body).returns(<<-EOS)
|
98
|
+
<form method="get" action="/login">
|
99
|
+
<input id="user_tos" name="user[tos]" type="checkbox" value="1" checked="checked" />
|
100
|
+
<input name="user[tos]" type="hidden" value="0" />
|
101
|
+
<label for="user_tos">TOS</label>
|
102
|
+
<input type="submit" />
|
103
|
+
</form>
|
104
|
+
EOS
|
105
|
+
@session.expects(:get_via_redirect).with("/login", "user" => {"tos" => "0"})
|
106
|
+
@session.unchecks "TOS"
|
107
|
+
@session.clicks_button
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_should_result_in_value_not_being_posted
|
111
|
+
@response.stubs(:body).returns(<<-EOS)
|
112
|
+
<form method="post" action="/login">
|
113
|
+
<input type="checkbox" name="remember_me" value="yes" checked="checked" />
|
114
|
+
<input type="submit" />
|
115
|
+
</form>
|
116
|
+
EOS
|
117
|
+
@session.expects(:post_via_redirect).with("/login", {})
|
118
|
+
@session.unchecks "remember_me"
|
119
|
+
@session.clicks_button
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/helper"
|
2
|
+
|
3
|
+
class ChoosesTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@session = ActionController::Integration::Session.new
|
7
|
+
@session.stubs(:assert_response)
|
8
|
+
@session.stubs(:get_via_redirect)
|
9
|
+
@session.stubs(:response).returns(@response=mock)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_should_fail_if_no_radio_buttons_found
|
13
|
+
@response.stubs(:body).returns(<<-EOS)
|
14
|
+
<form method="post" action="/login">
|
15
|
+
</form>
|
16
|
+
EOS
|
17
|
+
@session.expects(:flunk)
|
18
|
+
@session.chooses "first option"
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_should_fail_if_input_is_not_a_radio_button
|
22
|
+
@response.stubs(:body).returns(<<-EOS)
|
23
|
+
<form method="post" action="/login">
|
24
|
+
<input type="text" name="first_option" />
|
25
|
+
</form>
|
26
|
+
EOS
|
27
|
+
@session.expects(:flunk)
|
28
|
+
@session.chooses "first_option"
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_should_check_rails_style_radio_buttons
|
32
|
+
@response.stubs(:body).returns(<<-EOS)
|
33
|
+
<form method="get" action="/login">
|
34
|
+
<input id="user_gender_male" name="user[gender]" type="radio" value="M" />
|
35
|
+
<label for="user_gender_male">Male</label>
|
36
|
+
<input id="user_gender_female" name="user[gender]" type="radio" value="F" />
|
37
|
+
<label for="user_gender_female">Female</label>
|
38
|
+
<input type="submit" />
|
39
|
+
</form>
|
40
|
+
EOS
|
41
|
+
@session.expects(:get_via_redirect).with("/login", "user" => {"gender" => "M"})
|
42
|
+
@session.chooses "Male"
|
43
|
+
@session.clicks_button
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_should_only_submit_last_chosen_value
|
47
|
+
@response.stubs(:body).returns(<<-EOS)
|
48
|
+
<form method="get" action="/login">
|
49
|
+
<input id="user_gender_male" name="user[gender]" type="radio" value="M" />
|
50
|
+
<label for="user_gender_male">Male</label>
|
51
|
+
<input id="user_gender_female" name="user[gender]" type="radio" value="F" />
|
52
|
+
<label for="user_gender_female">Female</label>
|
53
|
+
<input type="submit" />
|
54
|
+
</form>
|
55
|
+
EOS
|
56
|
+
@session.expects(:get_via_redirect).with("/login", "user" => {"gender" => "M"})
|
57
|
+
@session.chooses "Female"
|
58
|
+
@session.chooses "Male"
|
59
|
+
@session.clicks_button
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_should_result_in_the_value_on_being_posted_if_not_specified
|
63
|
+
@response.stubs(:body).returns(<<-EOS)
|
64
|
+
<form method="post" action="/login">
|
65
|
+
<input type="radio" name="first_option" />
|
66
|
+
<input type="submit" />
|
67
|
+
</form>
|
68
|
+
EOS
|
69
|
+
@session.expects(:post_via_redirect).with("/login", "first_option" => "on")
|
70
|
+
@session.chooses "first_option"
|
71
|
+
@session.clicks_button
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
@@ -0,0 +1,308 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/helper"
|
2
|
+
|
3
|
+
class ClicksButtonTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@session = ActionController::Integration::Session.new
|
6
|
+
@session.stubs(:assert_response)
|
7
|
+
@session.stubs(:get_via_redirect)
|
8
|
+
@response = mock
|
9
|
+
@session.stubs(:response).returns(@response)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_should_fail_if_no_buttons
|
13
|
+
@response.stubs(:body).returns(<<-EOS)
|
14
|
+
<form method="get" action="/login"></form>
|
15
|
+
EOS
|
16
|
+
@session.expects(:flunk)
|
17
|
+
@session.clicks_button
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_should_fail_if_input_is_not_a_submit_button
|
21
|
+
@response.stubs(:body).returns(<<-EOS)
|
22
|
+
<form method="get" action="/login">
|
23
|
+
<input type="reset" />
|
24
|
+
</form>
|
25
|
+
EOS
|
26
|
+
@session.expects(:flunk)
|
27
|
+
@session.clicks_button
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_should_default_to_get_method
|
31
|
+
@response.stubs(:body).returns(<<-EOS)
|
32
|
+
<form action="/login">
|
33
|
+
<input type="submit" />
|
34
|
+
</form>
|
35
|
+
EOS
|
36
|
+
@session.expects(:get_via_redirect)
|
37
|
+
@session.clicks_button
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_should_assert_valid_response
|
41
|
+
@response.stubs(:body).returns(<<-EOS)
|
42
|
+
<form action="/login">
|
43
|
+
<input type="submit" />
|
44
|
+
</form>
|
45
|
+
EOS
|
46
|
+
@session.expects(:assert_response).with(:success)
|
47
|
+
@session.clicks_button
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_should_default_to_current_url
|
51
|
+
@response.stubs(:body).returns(<<-EOS)
|
52
|
+
<form method="get">
|
53
|
+
<input type="submit" />
|
54
|
+
</form>
|
55
|
+
EOS
|
56
|
+
@session.expects(:current_url).returns("/current")
|
57
|
+
@session.expects(:get_via_redirect).with("/current", {})
|
58
|
+
@session.clicks_button
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_should_submit_the_first_form_by_default
|
62
|
+
@response.stubs(:body).returns(<<-EOS)
|
63
|
+
<form method="get" action="/form1">
|
64
|
+
<input type="submit" />
|
65
|
+
</form>
|
66
|
+
<form method="get" action="/form2">
|
67
|
+
<input type="submit" />
|
68
|
+
</form>
|
69
|
+
EOS
|
70
|
+
@session.expects(:get_via_redirect).with("/form1", {})
|
71
|
+
@session.clicks_button
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_should_submit_the_form_with_the_specified_button
|
75
|
+
@response.stubs(:body).returns(<<-EOS)
|
76
|
+
<form method="get" action="/form1">
|
77
|
+
<input type="submit" />
|
78
|
+
</form>
|
79
|
+
<form method="get" action="/form2">
|
80
|
+
<input type="submit" value="Form2" />
|
81
|
+
</form>
|
82
|
+
EOS
|
83
|
+
@session.expects(:get_via_redirect).with("/form2", {})
|
84
|
+
@session.clicks_button "Form2"
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_should_use_action_from_form
|
88
|
+
@response.stubs(:body).returns(<<-EOS)
|
89
|
+
<form method="get" action="/login">
|
90
|
+
<input type="submit" />
|
91
|
+
</form>
|
92
|
+
EOS
|
93
|
+
@session.expects(:get_via_redirect).with("/login", {})
|
94
|
+
@session.clicks_button
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_should_use_method_from_form
|
98
|
+
@response.stubs(:body).returns(<<-EOS)
|
99
|
+
<form method="post" action="/login">
|
100
|
+
<input type="submit" />
|
101
|
+
</form>
|
102
|
+
EOS
|
103
|
+
@session.expects(:post_via_redirect)
|
104
|
+
@session.clicks_button
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_should_send_button_as_param_if_it_has_a_name
|
108
|
+
@response.stubs(:body).returns(<<-EOS)
|
109
|
+
<form method="post" action="/login">
|
110
|
+
<input type="submit" name="cancel" value="Cancel" />
|
111
|
+
<input type="submit" name="login" value="Login" />
|
112
|
+
</form>
|
113
|
+
EOS
|
114
|
+
@session.expects(:post_via_redirect).with("/login", "login" => "Login")
|
115
|
+
@session.clicks_button("Login")
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_should_not_send_button_as_param_if_it_has_no_name
|
119
|
+
@response.stubs(:body).returns(<<-EOS)
|
120
|
+
<form method="post" action="/login">
|
121
|
+
<input type="submit" name="cancel" value="Cancel" />
|
122
|
+
<input type="submit" value="Login" />
|
123
|
+
</form>
|
124
|
+
EOS
|
125
|
+
@session.expects(:post_via_redirect).with("/login", {})
|
126
|
+
@session.clicks_button("Login")
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_should_send_default_hidden_field_values
|
130
|
+
@response.stubs(:body).returns(<<-EOS)
|
131
|
+
<form method="get" action="/login">
|
132
|
+
<input id="user_email" name="user[email]" value="test@example.com" type="hidden" />
|
133
|
+
<input type="submit" />
|
134
|
+
</form>
|
135
|
+
EOS
|
136
|
+
@session.expects(:get_via_redirect).with("/login", "user" => {"email" => "test@example.com"})
|
137
|
+
@session.clicks_button
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_should_send_default_text_field_values
|
141
|
+
@response.stubs(:body).returns(<<-EOS)
|
142
|
+
<form method="get" action="/login">
|
143
|
+
<input id="user_email" name="user[email]" value="test@example.com" type="text" />
|
144
|
+
<input type="submit" />
|
145
|
+
</form>
|
146
|
+
EOS
|
147
|
+
@session.expects(:get_via_redirect).with("/login", "user" => {"email" => "test@example.com"})
|
148
|
+
@session.clicks_button
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_should_send_default_checked_fields
|
152
|
+
@response.stubs(:body).returns(<<-EOS)
|
153
|
+
<form method="get" action="/login">
|
154
|
+
<input id="user_tos" name="user[tos]" value="1" type="checkbox" checked="checked" />
|
155
|
+
<input type="submit" />
|
156
|
+
</form>
|
157
|
+
EOS
|
158
|
+
@session.expects(:get_via_redirect).with("/login", "user" => {"tos" => "1"})
|
159
|
+
@session.clicks_button
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_should_send_default_radio_options
|
163
|
+
@response.stubs(:body).returns(<<-EOS)
|
164
|
+
<form method="get" action="/login">
|
165
|
+
<input id="user_gender_male" name="user[gender]" type="radio" value="M" />
|
166
|
+
<label for="user_gender_male">Male</label>
|
167
|
+
<input id="user_gender_female" name="user[gender]" type="radio" value="F" checked="checked" />
|
168
|
+
<label for="user_gender_female">Female</label>
|
169
|
+
<input type="submit" />
|
170
|
+
</form>
|
171
|
+
EOS
|
172
|
+
@session.expects(:get_via_redirect).with("/login", "user" => {"gender" => "F"})
|
173
|
+
@session.clicks_button
|
174
|
+
end
|
175
|
+
|
176
|
+
def test_should_send_correct_data_for_rails_style_unchecked_fields
|
177
|
+
@response.stubs(:body).returns(<<-EOS)
|
178
|
+
<form method="get" action="/login">
|
179
|
+
<input id="user_tos" name="user[tos]" type="checkbox" value="1" />
|
180
|
+
<input name="user[tos]" type="hidden" value="0" /> TOS
|
181
|
+
<input type="submit" />
|
182
|
+
</form>
|
183
|
+
EOS
|
184
|
+
@session.expects(:get_via_redirect).with("/login", "user" => {"tos" => "0"})
|
185
|
+
@session.clicks_button
|
186
|
+
end
|
187
|
+
|
188
|
+
def test_should_send_correct_data_for_rails_style_checked_fields
|
189
|
+
@response.stubs(:body).returns(<<-EOS)
|
190
|
+
<form method="get" action="/login">
|
191
|
+
<input id="user_tos" name="user[tos]" type="checkbox" value="1" checked="checked" />
|
192
|
+
<input name="user[tos]" type="hidden" value="0" /> TOS
|
193
|
+
<input type="submit" />
|
194
|
+
</form>
|
195
|
+
EOS
|
196
|
+
@session.expects(:get_via_redirect).with("/login", "user" => {"tos" => "1"})
|
197
|
+
@session.clicks_button
|
198
|
+
end
|
199
|
+
|
200
|
+
def test_should_send_default_collection_fields
|
201
|
+
@response.stubs(:body).returns(<<-EOS)
|
202
|
+
<form method="post" action="/login">
|
203
|
+
<input type="checkbox" name="options[]" value="burger" checked="checked" />
|
204
|
+
<input type="radio" name="options[]" value="fries" checked="checked" />
|
205
|
+
<input type="text" name="options[]" value="soda" />
|
206
|
+
<!-- Same value appearing twice -->
|
207
|
+
<input type="text" name="options[]" value="soda" />
|
208
|
+
<input type="hidden" name="options[]" value="dessert" />
|
209
|
+
<input type="hidden" name="response[choices][][selected]" value="one" />
|
210
|
+
<input type="hidden" name="response[choices][][selected]" value="two" />
|
211
|
+
<!-- Same value appearing twice -->
|
212
|
+
<input type="hidden" name="response[choices][][selected]" value="two" />
|
213
|
+
<input type="submit" />
|
214
|
+
</form>
|
215
|
+
EOS
|
216
|
+
@session.expects(:post_via_redirect).with("/login",
|
217
|
+
"options" => ["soda", "soda", "dessert", "burger", "fries"],
|
218
|
+
"response" => { "choices" => [{"selected" => "one"}, {"selected" => "two"}, {"selected" => "two"}]})
|
219
|
+
@session.clicks_button
|
220
|
+
end
|
221
|
+
|
222
|
+
def test_should_not_send_default_unchecked_fields
|
223
|
+
@response.stubs(:body).returns(<<-EOS)
|
224
|
+
<form method="get" action="/login">
|
225
|
+
<input id="user_tos" name="user[tos]" value="1" type="checkbox" />
|
226
|
+
<input type="submit" />
|
227
|
+
</form>
|
228
|
+
EOS
|
229
|
+
@session.expects(:get_via_redirect).with("/login", {})
|
230
|
+
@session.clicks_button
|
231
|
+
end
|
232
|
+
|
233
|
+
def test_should_send_default_textarea_values
|
234
|
+
@response.stubs(:body).returns(<<-EOS)
|
235
|
+
<form method="post" action="/posts">
|
236
|
+
<textarea name="post[body]">Post body here!</textarea>
|
237
|
+
<input type="submit" />
|
238
|
+
</form>
|
239
|
+
EOS
|
240
|
+
@session.expects(:post_via_redirect).with("/posts", "post" => {"body" => "Post body here!"})
|
241
|
+
@session.clicks_button
|
242
|
+
end
|
243
|
+
|
244
|
+
def test_should_send_default_selected_option_value_from_select
|
245
|
+
@response.stubs(:body).returns(<<-EOS)
|
246
|
+
<form method="get" action="/login">
|
247
|
+
<select name="month">
|
248
|
+
<option value="1">January</option>
|
249
|
+
<option value="2" selected="selected">February</option>
|
250
|
+
</select>
|
251
|
+
<input type="submit" />
|
252
|
+
</form>
|
253
|
+
EOS
|
254
|
+
@session.expects(:get_via_redirect).with("/login", "month" => "2")
|
255
|
+
@session.clicks_button
|
256
|
+
end
|
257
|
+
|
258
|
+
def test_should_send_default_selected_option_inner_html_from_select_when_no_value_attribute
|
259
|
+
@response.stubs(:body).returns(<<-EOS)
|
260
|
+
<form method="get" action="/login">
|
261
|
+
<select name="month">
|
262
|
+
<option>January</option>
|
263
|
+
<option selected="selected">February</option>
|
264
|
+
</select>
|
265
|
+
<input type="submit" />
|
266
|
+
</form>
|
267
|
+
EOS
|
268
|
+
@session.expects(:get_via_redirect).with("/login", "month" => "February")
|
269
|
+
@session.clicks_button
|
270
|
+
end
|
271
|
+
|
272
|
+
def test_should_send_first_select_option_value_when_no_option_selected
|
273
|
+
@response.stubs(:body).returns(<<-EOS)
|
274
|
+
<form method="get" action="/login">
|
275
|
+
<select name="month">
|
276
|
+
<option value="1">January</option>
|
277
|
+
<option value="2">February</option>
|
278
|
+
</select>
|
279
|
+
<input type="submit" />
|
280
|
+
</form>
|
281
|
+
EOS
|
282
|
+
@session.expects(:get_via_redirect).with("/login", "month" => "1")
|
283
|
+
@session.clicks_button
|
284
|
+
end
|
285
|
+
|
286
|
+
def test_should_handle_nested_properties
|
287
|
+
@response.stubs(:body).returns(<<-EOS)
|
288
|
+
<form method="post" action="/login">
|
289
|
+
<input type="text" id="contestant_scores_12" name="contestant[scores][1]" value="2"/>
|
290
|
+
<input type="text" id="contestant_scores_13" name="contestant[scores][3]" value="4"/>
|
291
|
+
<input type="submit" />
|
292
|
+
</form>
|
293
|
+
EOS
|
294
|
+
@session.expects(:post_via_redirect).with("/login", "contestant" => {"scores" => {'1' => '2', '3' => '4'}})
|
295
|
+
@session.clicks_button
|
296
|
+
end
|
297
|
+
|
298
|
+
def test_should_send_default_empty_text_field_values
|
299
|
+
@response.stubs(:body).returns(<<-EOS)
|
300
|
+
<form method="get" action="/login">
|
301
|
+
<input id="user_email" name="user[email]" value="" type="text" />
|
302
|
+
<input type="submit" />
|
303
|
+
</form>
|
304
|
+
EOS
|
305
|
+
@session.expects(:get_via_redirect).with("/login", "user" => {"email" => ""})
|
306
|
+
@session.clicks_button
|
307
|
+
end
|
308
|
+
end
|