capybara 2.2.1 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +26 -0
  3. data/README.md +36 -14
  4. data/lib/capybara.rb +6 -3
  5. data/lib/capybara/driver/base.rb +37 -1
  6. data/lib/capybara/driver/node.rb +10 -2
  7. data/lib/capybara/helpers.rb +21 -13
  8. data/lib/capybara/node/base.rb +12 -7
  9. data/lib/capybara/node/element.rb +17 -1
  10. data/lib/capybara/node/finders.rb +22 -1
  11. data/lib/capybara/node/matchers.rb +26 -5
  12. data/lib/capybara/node/simple.rb +9 -2
  13. data/lib/capybara/rack_test/css_handlers.rb +3 -1
  14. data/lib/capybara/rack_test/form.rb +3 -2
  15. data/lib/capybara/rack_test/node.rb +3 -3
  16. data/lib/capybara/rspec.rb +1 -0
  17. data/lib/capybara/rspec/features.rb +2 -1
  18. data/lib/capybara/rspec/matchers.rb +50 -5
  19. data/lib/capybara/selenium/driver.rb +76 -12
  20. data/lib/capybara/selenium/node.rb +8 -0
  21. data/lib/capybara/server.rb +1 -1
  22. data/lib/capybara/session.rb +234 -29
  23. data/lib/capybara/spec/public/jquery.js +1 -1
  24. data/lib/capybara/spec/public/test.js +7 -0
  25. data/lib/capybara/spec/session/all_spec.rb +88 -17
  26. data/lib/capybara/spec/session/assert_selector.rb +6 -0
  27. data/lib/capybara/spec/session/attach_file_spec.rb +15 -15
  28. data/lib/capybara/spec/session/body_spec.rb +4 -4
  29. data/lib/capybara/spec/session/check_spec.rb +16 -16
  30. data/lib/capybara/spec/session/choose_spec.rb +5 -5
  31. data/lib/capybara/spec/session/click_button_spec.rb +93 -84
  32. data/lib/capybara/spec/session/click_link_or_button_spec.rb +8 -8
  33. data/lib/capybara/spec/session/click_link_spec.rb +26 -19
  34. data/lib/capybara/spec/session/current_scope_spec.rb +3 -3
  35. data/lib/capybara/spec/session/current_url_spec.rb +8 -8
  36. data/lib/capybara/spec/session/evaluate_script_spec.rb +1 -1
  37. data/lib/capybara/spec/session/execute_script_spec.rb +2 -2
  38. data/lib/capybara/spec/session/fill_in_spec.rb +22 -22
  39. data/lib/capybara/spec/session/find_button_spec.rb +4 -4
  40. data/lib/capybara/spec/session/find_by_id_spec.rb +3 -3
  41. data/lib/capybara/spec/session/find_field_spec.rb +7 -7
  42. data/lib/capybara/spec/session/find_link_spec.rb +4 -4
  43. data/lib/capybara/spec/session/find_spec.rb +46 -46
  44. data/lib/capybara/spec/session/first_spec.rb +23 -23
  45. data/lib/capybara/spec/session/go_back_spec.rb +3 -3
  46. data/lib/capybara/spec/session/go_forward_spec.rb +4 -4
  47. data/lib/capybara/spec/session/has_button_spec.rb +13 -13
  48. data/lib/capybara/spec/session/has_css_spec.rb +87 -87
  49. data/lib/capybara/spec/session/has_field_spec.rb +87 -87
  50. data/lib/capybara/spec/session/has_link_spec.rb +11 -11
  51. data/lib/capybara/spec/session/has_select_spec.rb +58 -58
  52. data/lib/capybara/spec/session/has_selector_spec.rb +48 -48
  53. data/lib/capybara/spec/session/has_table_spec.rb +7 -7
  54. data/lib/capybara/spec/session/has_text_spec.rb +73 -73
  55. data/lib/capybara/spec/session/has_title_spec.rb +10 -10
  56. data/lib/capybara/spec/session/has_xpath_spec.rb +44 -44
  57. data/lib/capybara/spec/session/headers.rb +1 -1
  58. data/lib/capybara/spec/session/html_spec.rb +9 -9
  59. data/lib/capybara/spec/session/node_spec.rb +81 -65
  60. data/lib/capybara/spec/session/reset_session_spec.rb +15 -15
  61. data/lib/capybara/spec/session/response_code.rb +1 -1
  62. data/lib/capybara/spec/session/save_and_open_screenshot_spec.rb +46 -0
  63. data/lib/capybara/spec/session/save_page_spec.rb +9 -9
  64. data/lib/capybara/spec/session/{screenshot.rb → screenshot_spec.rb} +4 -2
  65. data/lib/capybara/spec/session/select_spec.rb +22 -22
  66. data/lib/capybara/spec/session/text_spec.rb +15 -10
  67. data/lib/capybara/spec/session/title_spec.rb +2 -2
  68. data/lib/capybara/spec/session/uncheck_spec.rb +7 -7
  69. data/lib/capybara/spec/session/unselect_spec.rb +14 -14
  70. data/lib/capybara/spec/session/visit_spec.rb +24 -17
  71. data/lib/capybara/spec/session/window/become_closed_spec.rb +84 -0
  72. data/lib/capybara/spec/session/window/current_window_spec.rb +25 -0
  73. data/lib/capybara/spec/session/window/open_new_window_spec.rb +28 -0
  74. data/lib/capybara/spec/session/window/switch_to_window_spec.rb +114 -0
  75. data/lib/capybara/spec/session/window/window_opened_by_spec.rb +83 -0
  76. data/lib/capybara/spec/session/window/window_spec.rb +141 -0
  77. data/lib/capybara/spec/session/window/windows_spec.rb +31 -0
  78. data/lib/capybara/spec/session/window/within_window_spec.rb +188 -0
  79. data/lib/capybara/spec/session/within_frame_spec.rb +9 -9
  80. data/lib/capybara/spec/session/within_spec.rb +16 -16
  81. data/lib/capybara/spec/spec_helper.rb +14 -4
  82. data/lib/capybara/spec/views/form.erb +7 -0
  83. data/lib/capybara/spec/views/popup_one.erb +1 -1
  84. data/lib/capybara/spec/views/popup_two.erb +1 -1
  85. data/lib/capybara/spec/views/with_js.erb +2 -0
  86. data/lib/capybara/spec/views/with_windows.erb +38 -0
  87. data/lib/capybara/version.rb +1 -1
  88. data/lib/capybara/window.rb +123 -0
  89. data/spec/basic_node_spec.rb +32 -32
  90. data/spec/capybara_spec.rb +6 -7
  91. data/spec/dsl_spec.rb +48 -48
  92. data/spec/fixtures/selenium_driver_rspec_failure.rb +2 -2
  93. data/spec/fixtures/selenium_driver_rspec_success.rb +2 -2
  94. data/spec/rack_test_spec.rb +33 -19
  95. data/spec/result_spec.rb +13 -13
  96. data/spec/rspec/features_spec.rb +20 -15
  97. data/spec/rspec/matchers_spec.rb +109 -109
  98. data/spec/rspec_spec.rb +10 -10
  99. data/spec/selenium_spec.rb +31 -6
  100. data/spec/selenium_spec_chrome.rb +2 -2
  101. data/spec/server_spec.rb +13 -13
  102. metadata +51 -62
  103. checksums.yaml.gz.sig +0 -0
  104. data.tar.gz.sig +0 -0
  105. data/lib/capybara/spec/session/within_window_spec.rb +0 -45
  106. data/lib/capybara/spec/views/within_popups.erb +0 -25
  107. metadata.gz.sig +0 -0
@@ -11,31 +11,31 @@ Capybara::SpecHelper.spec '#click_button' do
11
11
 
12
12
  it "casts to string" do
13
13
  @session.click_button(:'Relative Action')
14
- @session.current_path.should == '/relative'
15
- extract_results(@session)['relative'].should == 'Relative Action'
14
+ expect(@session.current_path).to eq('/relative')
15
+ expect(extract_results(@session)['relative']).to eq('Relative Action')
16
16
  end
17
17
 
18
18
  context "with multiple values with the same name" do
19
19
  it "should use the latest given value" do
20
20
  @session.check('Terms of Use')
21
21
  @session.click_button('awesome')
22
- extract_results(@session)['terms_of_use'].should == '1'
22
+ expect(extract_results(@session)['terms_of_use']).to eq('1')
23
23
  end
24
24
  end
25
25
 
26
26
  context "with a form that has a relative url as an action" do
27
27
  it "should post to the correct url" do
28
28
  @session.click_button('Relative Action')
29
- @session.current_path.should == '/relative'
30
- extract_results(@session)['relative'].should == 'Relative Action'
29
+ expect(@session.current_path).to eq('/relative')
30
+ expect(extract_results(@session)['relative']).to eq('Relative Action')
31
31
  end
32
32
  end
33
33
 
34
34
  context "with a form that has no action specified" do
35
35
  it "should post to the correct url" do
36
36
  @session.click_button('No Action')
37
- @session.current_path.should == '/form'
38
- extract_results(@session)['no_action'].should == 'No Action'
37
+ expect(@session.current_path).to eq('/form')
38
+ expect(extract_results(@session)['no_action']).to eq('No Action')
39
39
  end
40
40
  end
41
41
 
@@ -47,23 +47,23 @@ Capybara::SpecHelper.spec '#click_button' do
47
47
  end
48
48
 
49
49
  it "should serialise and submit search fields" do
50
- @results['html5_search'].should == 'what are you looking for'
50
+ expect(@results['html5_search']).to eq('what are you looking for')
51
51
  end
52
52
 
53
53
  it "should serialise and submit email fields" do
54
- @results['html5_email'].should == 'person@email.com'
54
+ expect(@results['html5_email']).to eq('person@email.com')
55
55
  end
56
56
 
57
57
  it "should serialise and submit url fields" do
58
- @results['html5_url'].should == 'http://www.example.com'
58
+ expect(@results['html5_url']).to eq('http://www.example.com')
59
59
  end
60
60
 
61
61
  it "should serialise and submit tel fields" do
62
- @results['html5_tel'].should == '911'
62
+ expect(@results['html5_tel']).to eq('911')
63
63
  end
64
64
 
65
65
  it "should serialise and submit color fields" do
66
- @results['html5_color'].upcase.should == '#FFFFFF'
66
+ expect(@results['html5_color'].upcase).to eq('#FFFFFF')
67
67
  end
68
68
  end
69
69
 
@@ -74,78 +74,78 @@ Capybara::SpecHelper.spec '#click_button' do
74
74
  end
75
75
 
76
76
  it "should serialize and submit text fields" do
77
- @results['first_name'].should == 'John'
77
+ expect(@results['first_name']).to eq('John')
78
78
  end
79
79
 
80
80
  it "should escape fields when submitting" do
81
- @results['phone'].should == '+1 555 7021'
81
+ expect(@results['phone']).to eq('+1 555 7021')
82
82
  end
83
83
 
84
84
  it "should serialize and submit password fields" do
85
- @results['password'].should == 'seeekrit'
85
+ expect(@results['password']).to eq('seeekrit')
86
86
  end
87
87
 
88
88
  it "should serialize and submit hidden fields" do
89
- @results['token'].should == '12345'
89
+ expect(@results['token']).to eq('12345')
90
90
  end
91
91
 
92
92
  it "should not serialize fields from other forms" do
93
- @results['middle_name'].should be_nil
93
+ expect(@results['middle_name']).to be_nil
94
94
  end
95
95
 
96
96
  it "should submit the button that was clicked, but not other buttons" do
97
- @results['awesome'].should == 'awesome'
98
- @results['crappy'].should be_nil
97
+ expect(@results['awesome']).to eq('awesome')
98
+ expect(@results['crappy']).to be_nil
99
99
  end
100
100
 
101
101
  it "should serialize radio buttons" do
102
- @results['gender'].should == 'female'
102
+ expect(@results['gender']).to eq('female')
103
103
  end
104
104
 
105
105
  it "should default radio value to 'on' if none specified" do
106
- @results['valueless_radio'].should == 'on'
106
+ expect(@results['valueless_radio']).to eq('on')
107
107
  end
108
108
 
109
109
  it "should serialize check boxes" do
110
- @results['pets'].should include('dog', 'hamster')
111
- @results['pets'].should_not include('cat')
110
+ expect(@results['pets']).to include('dog', 'hamster')
111
+ expect(@results['pets']).not_to include('cat')
112
112
  end
113
113
 
114
114
  it "should default checkbox value to 'on' if none specififed" do
115
- @results['valueless_checkbox'].should == 'on'
115
+ expect(@results['valueless_checkbox']).to eq('on')
116
116
  end
117
117
 
118
118
  it "should serialize text areas" do
119
- @results['description'].should == 'Descriptive text goes here'
119
+ expect(@results['description']).to eq('Descriptive text goes here')
120
120
  end
121
121
 
122
122
  it "should serialize select tag with values" do
123
- @results['locale'].should == 'en'
123
+ expect(@results['locale']).to eq('en')
124
124
  end
125
125
 
126
126
  it "should serialize select tag without values" do
127
- @results['region'].should == 'Norway'
127
+ expect(@results['region']).to eq('Norway')
128
128
  end
129
129
 
130
130
  it "should serialize first option for select tag with no selection" do
131
- @results['city'].should == 'London'
131
+ expect(@results['city']).to eq('London')
132
132
  end
133
133
 
134
134
  it "should not serialize a select tag without options" do
135
- @results['tendency'].should be_nil
135
+ expect(@results['tendency']).to be_nil
136
136
  end
137
137
 
138
138
  it "should convert lf to cr/lf in submitted textareas" do
139
- @results['newline'].should == "\r\nNew line after and before textarea tag\r\n"
139
+ expect(@results['newline']).to eq("\r\nNew line after and before textarea tag\r\n")
140
140
  end
141
141
 
142
142
  it "should not submit disabled fields" do
143
- @results['disabled_text_field'].should be_nil
144
- @results['disabled_textarea'].should be_nil
145
- @results['disabled_checkbox'].should be_nil
146
- @results['disabled_radio'].should be_nil
147
- @results['disabled_select'].should be_nil
148
- @results['disabled_file'].should be_nil
143
+ expect(@results['disabled_text_field']).to be_nil
144
+ expect(@results['disabled_textarea']).to be_nil
145
+ expect(@results['disabled_checkbox']).to be_nil
146
+ expect(@results['disabled_radio']).to be_nil
147
+ expect(@results['disabled_select']).to be_nil
148
+ expect(@results['disabled_file']).to be_nil
149
149
  end
150
150
  end
151
151
  end
@@ -153,24 +153,24 @@ Capybara::SpecHelper.spec '#click_button' do
153
153
  context "with id given on a submit button" do
154
154
  it "should submit the associated form" do
155
155
  @session.click_button('awe123')
156
- extract_results(@session)['first_name'].should == 'John'
156
+ expect(extract_results(@session)['first_name']).to eq('John')
157
157
  end
158
158
 
159
159
  it "should work with partial matches" do
160
160
  @session.click_button('Go')
161
- @session.should have_content('You landed')
161
+ expect(@session).to have_content('You landed')
162
162
  end
163
163
  end
164
164
 
165
165
  context "with title given on a submit button" do
166
166
  it "should submit the associated form" do
167
167
  @session.click_button('What an Awesome Button')
168
- extract_results(@session)['first_name'].should == 'John'
168
+ expect(extract_results(@session)['first_name']).to eq('John')
169
169
  end
170
170
 
171
171
  it "should work with partial matches" do
172
172
  @session.click_button('What an Awesome')
173
- extract_results(@session)['first_name'].should == 'John'
173
+ expect(extract_results(@session)['first_name']).to eq('John')
174
174
  end
175
175
  end
176
176
 
@@ -181,19 +181,19 @@ Capybara::SpecHelper.spec '#click_button' do
181
181
  end
182
182
 
183
183
  it "should serialize and submit text fields" do
184
- @results['outside_input'].should == 'outside_input'
184
+ expect(@results['outside_input']).to eq('outside_input')
185
185
  end
186
186
 
187
187
  it "should serialize text areas" do
188
- @results['outside_textarea'].should == 'Some text here'
188
+ expect(@results['outside_textarea']).to eq('Some text here')
189
189
  end
190
190
 
191
191
  it "should serialize select tags" do
192
- @results['outside_select'].should == 'Ruby'
192
+ expect(@results['outside_select']).to eq('Ruby')
193
193
  end
194
194
 
195
195
  it "should not serliaze fields associated with a different form" do
196
- @results['for_form2'].should be_nil
196
+ expect(@results['for_form2']).to be_nil
197
197
  end
198
198
  end
199
199
 
@@ -205,12 +205,12 @@ Capybara::SpecHelper.spec '#click_button' do
205
205
  end
206
206
 
207
207
  it "should submit the associated form" do
208
- @results['which_form'].should == 'form2'
208
+ expect(@results['which_form']).to eq('form2')
209
209
  end
210
210
 
211
211
  it "should submit the button that was clicked, but not other buttons" do
212
- @results['outside_button'].should == 'outside_button'
213
- @results['unused'].should be_nil
212
+ expect(@results['outside_button']).to eq('outside_button')
213
+ expect(@results['unused']).to be_nil
214
214
  end
215
215
  end
216
216
 
@@ -221,37 +221,37 @@ Capybara::SpecHelper.spec '#click_button' do
221
221
  end
222
222
 
223
223
  it "should submit the associated form" do
224
- @results['which_form'].should == 'form1'
224
+ expect(@results['which_form']).to eq('form1')
225
225
  end
226
226
 
227
227
  it "should submit the button that was clicked, but not other buttons" do
228
- @results['outside_submit'].should == 'outside_submit'
229
- @results['submit_form1'].should be_nil
228
+ expect(@results['outside_submit']).to eq('outside_submit')
229
+ expect(@results['submit_form1']).to be_nil
230
230
  end
231
231
  end
232
232
 
233
233
  context "with submit button for form1 located within form2" do
234
234
  it "should submit the form associated with the button" do
235
235
  @session.click_button('other_form_button')
236
- extract_results(@session)['which_form'].should == "form1"
236
+ expect(extract_results(@session)['which_form']).to eq("form1")
237
237
  end
238
238
  end
239
239
 
240
240
  context "with submit button not associated with any form" do
241
241
  it "should not error when clicked" do
242
- lambda { @session.click_button('no_form_button') }.should_not raise_error
242
+ expect { @session.click_button('no_form_button') }.not_to raise_error
243
243
  end
244
244
  end
245
245
 
246
246
  context "with alt given on an image button" do
247
247
  it "should submit the associated form" do
248
248
  @session.click_button('oh hai thar')
249
- extract_results(@session)['first_name'].should == 'John'
249
+ expect(extract_results(@session)['first_name']).to eq('John')
250
250
  end
251
251
 
252
252
  it "should work with partial matches" do
253
253
  @session.click_button('hai')
254
- extract_results(@session)['first_name'].should == 'John'
254
+ expect(extract_results(@session)['first_name']).to eq('John')
255
255
  end
256
256
  end
257
257
 
@@ -259,82 +259,82 @@ Capybara::SpecHelper.spec '#click_button' do
259
259
  context "with value given on an image button" do
260
260
  it "should submit the associated form" do
261
261
  @session.click_button('okay')
262
- extract_results(@session)['first_name'].should == 'John'
262
+ expect(extract_results(@session)['first_name']).to eq('John')
263
263
  end
264
264
 
265
265
  it "should work with partial matches" do
266
266
  @session.click_button('kay')
267
- extract_results(@session)['first_name'].should == 'John'
267
+ expect(extract_results(@session)['first_name']).to eq('John')
268
268
  end
269
269
  end
270
270
 
271
271
  context "with id given on an image button" do
272
272
  it "should submit the associated form" do
273
273
  @session.click_button('okay556')
274
- extract_results(@session)['first_name'].should == 'John'
274
+ expect(extract_results(@session)['first_name']).to eq('John')
275
275
  end
276
276
  end
277
277
 
278
278
  context "with title given on an image button" do
279
279
  it "should submit the associated form" do
280
280
  @session.click_button('Okay 556 Image')
281
- extract_results(@session)['first_name'].should == 'John'
281
+ expect(extract_results(@session)['first_name']).to eq('John')
282
282
  end
283
283
 
284
284
  it "should work with partial matches" do
285
285
  @session.click_button('Okay 556')
286
- extract_results(@session)['first_name'].should == 'John'
286
+ expect(extract_results(@session)['first_name']).to eq('John')
287
287
  end
288
288
  end
289
289
 
290
290
  context "with text given on a button defined by <button> tag" do
291
291
  it "should submit the associated form" do
292
292
  @session.click_button('Click me')
293
- extract_results(@session)['first_name'].should == 'John'
293
+ expect(extract_results(@session)['first_name']).to eq('John')
294
294
  end
295
295
 
296
296
  it "should work with partial matches" do
297
297
  @session.click_button('Click')
298
- extract_results(@session)['first_name'].should == 'John'
298
+ expect(extract_results(@session)['first_name']).to eq('John')
299
299
  end
300
300
  end
301
301
 
302
302
  context "with id given on a button defined by <button> tag" do
303
303
  it "should submit the associated form" do
304
304
  @session.click_button('click_me_123')
305
- extract_results(@session)['first_name'].should == 'John'
305
+ expect(extract_results(@session)['first_name']).to eq('John')
306
306
  end
307
307
 
308
308
  it "should serialize and send GET forms" do
309
309
  @session.visit('/form')
310
310
  @session.click_button('med')
311
311
  @results = extract_results(@session)
312
- @results['middle_name'].should == 'Darren'
313
- @results['foo'].should be_nil
312
+ expect(@results['middle_name']).to eq('Darren')
313
+ expect(@results['foo']).to be_nil
314
314
  end
315
315
  end
316
316
 
317
317
  context "with value given on a button defined by <button> tag" do
318
318
  it "should submit the associated form" do
319
319
  @session.click_button('click_me')
320
- extract_results(@session)['first_name'].should == 'John'
320
+ expect(extract_results(@session)['first_name']).to eq('John')
321
321
  end
322
322
 
323
323
  it "should work with partial matches" do
324
324
  @session.click_button('ck_me')
325
- extract_results(@session)['first_name'].should == 'John'
325
+ expect(extract_results(@session)['first_name']).to eq('John')
326
326
  end
327
327
  end
328
328
 
329
329
  context "with title given on a button defined by <button> tag" do
330
330
  it "should submit the associated form" do
331
331
  @session.click_button('Click Title button')
332
- extract_results(@session)['first_name'].should == 'John'
332
+ expect(extract_results(@session)['first_name']).to eq('John')
333
333
  end
334
334
 
335
335
  it "should work with partial matches" do
336
336
  @session.click_button('Click Title')
337
- extract_results(@session)['first_name'].should == 'John'
337
+ expect(extract_results(@session)['first_name']).to eq('John')
338
338
  end
339
339
  end
340
340
  context "with a locator that doesn't exist" do
@@ -346,42 +346,51 @@ Capybara::SpecHelper.spec '#click_button' do
346
346
  end
347
347
  end
348
348
 
349
+ context "with formaction attribute on button" do
350
+ it "should submit to the formaction attribute" do
351
+ @session.click_button('Formaction button')
352
+ expect(@session.current_path).to eq '/form'
353
+ @results = extract_results(@session)
354
+ expect(@results['which_form']).to eq 'formaction form'
355
+ end
356
+ end
357
+
349
358
  it "should serialize and send valueless buttons that were clicked" do
350
359
  @session.click_button('No Value!')
351
360
  @results = extract_results(@session)
352
- @results['no_value'].should_not be_nil
361
+ expect(@results['no_value']).not_to be_nil
353
362
  end
354
363
 
355
364
  it "should not send image buttons that were not clicked" do
356
365
  @session.click_button('Click me!')
357
366
  @results = extract_results(@session)
358
- @results['okay'].should be_nil
367
+ expect(@results['okay']).to be_nil
359
368
  end
360
369
 
361
370
  it "should serialize and send GET forms" do
362
371
  @session.visit('/form')
363
372
  @session.click_button('med')
364
373
  @results = extract_results(@session)
365
- @results['middle_name'].should == 'Darren'
366
- @results['foo'].should be_nil
374
+ expect(@results['middle_name']).to eq('Darren')
375
+ expect(@results['foo']).to be_nil
367
376
  end
368
377
 
369
378
  it "should follow redirects" do
370
379
  @session.click_button('Go FAR')
371
- @session.current_url.should match(%r{/landed$})
372
- @session.should have_content('You landed')
380
+ expect(@session.current_url).to match(%r{/landed$})
381
+ expect(@session).to have_content('You landed')
373
382
  end
374
383
 
375
384
  it "should post pack to the same URL when no action given" do
376
385
  @session.visit('/postback')
377
386
  @session.click_button('With no action')
378
- @session.should have_content('Postback')
387
+ expect(@session).to have_content('Postback')
379
388
  end
380
389
 
381
390
  it "should post pack to the same URL when blank action given" do
382
391
  @session.visit('/postback')
383
392
  @session.click_button('With blank action')
384
- @session.should have_content('Postback')
393
+ expect(@session).to have_content('Postback')
385
394
  end
386
395
 
387
396
  it "ignores disabled buttons" do
@@ -404,21 +413,21 @@ Capybara::SpecHelper.spec '#click_button' do
404
413
  @session.click_button "awesome"
405
414
 
406
415
  addresses=extract_results(@session)["addresses"]
407
- addresses.should have(2).addresses
416
+ expect(addresses.size).to eq(2)
408
417
 
409
- addresses[0]["street"].should == 'CDG'
410
- addresses[0]["city"].should == 'Paris'
411
- addresses[0]["country"].should == 'France'
418
+ expect(addresses[0]["street"]).to eq('CDG')
419
+ expect(addresses[0]["city"]).to eq('Paris')
420
+ expect(addresses[0]["country"]).to eq('France')
412
421
 
413
- addresses[1]["street"].should == 'PGS'
414
- addresses[1]["city"].should == 'Mikolaiv'
415
- addresses[1]["country"].should == 'Ukraine'
422
+ expect(addresses[1]["street"]).to eq('PGS')
423
+ expect(addresses[1]["city"]).to eq('Mikolaiv')
424
+ expect(addresses[1]["country"]).to eq('Ukraine')
416
425
  end
417
426
 
418
427
  context "with :exact option" do
419
428
  it "should accept partial matches when false" do
420
429
  @session.click_button('What an Awesome', :exact => false)
421
- extract_results(@session)['first_name'].should == 'John'
430
+ expect(extract_results(@session)['first_name']).to eq('John')
422
431
  end
423
432
 
424
433
  it "should not accept partial matches when true" do