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
@@ -4,13 +4,13 @@ Capybara::SpecHelper.spec '#has_table?' do
4
4
  end
5
5
 
6
6
  it "should be true if the table is on the page" do
7
- @session.should have_table('Villain')
8
- @session.should have_table('villain_table')
9
- @session.should have_table(:'villain_table')
7
+ expect(@session).to have_table('Villain')
8
+ expect(@session).to have_table('villain_table')
9
+ expect(@session).to have_table(:'villain_table')
10
10
  end
11
11
 
12
12
  it "should be false if the table is not on the page" do
13
- @session.should_not have_table('Monkey')
13
+ expect(@session).not_to have_table('Monkey')
14
14
  end
15
15
  end
16
16
 
@@ -20,11 +20,11 @@ Capybara::SpecHelper.spec '#has_no_table?' do
20
20
  end
21
21
 
22
22
  it "should be false if the table is on the page" do
23
- @session.should_not have_no_table('Villain')
24
- @session.should_not have_no_table('villain_table')
23
+ expect(@session).not_to have_no_table('Villain')
24
+ expect(@session).not_to have_no_table('villain_table')
25
25
  end
26
26
 
27
27
  it "should be true if the table is not on the page" do
28
- @session.should have_no_table('Monkey')
28
+ expect(@session).to have_no_table('Monkey')
29
29
  end
30
30
  end
@@ -1,193 +1,193 @@
1
1
  Capybara::SpecHelper.spec '#has_text?' do
2
2
  it "should be true if the given text is on the page at least once" do
3
3
  @session.visit('/with_html')
4
- @session.should have_text('est')
5
- @session.should have_text('Lorem')
6
- @session.should have_text('Redirect')
7
- @session.should have_text(:'Redirect')
4
+ expect(@session).to have_text('est')
5
+ expect(@session).to have_text('Lorem')
6
+ expect(@session).to have_text('Redirect')
7
+ expect(@session).to have_text(:'Redirect')
8
8
  end
9
9
 
10
10
  it "should be true if scoped to an element which has the text" do
11
11
  @session.visit('/with_html')
12
12
  @session.within("//a[@title='awesome title']") do
13
- @session.should have_text('labore')
13
+ expect(@session).to have_text('labore')
14
14
  end
15
15
  end
16
16
 
17
17
  it "should be false if scoped to an element which does not have the text" do
18
18
  @session.visit('/with_html')
19
19
  @session.within("//a[@title='awesome title']") do
20
- @session.should_not have_text('monkey')
20
+ expect(@session).not_to have_text('monkey')
21
21
  end
22
22
  end
23
23
 
24
24
  it "should ignore tags" do
25
25
  @session.visit('/with_html')
26
- @session.should_not have_text('exercitation <a href="/foo" id="foo">ullamco</a> laboris')
27
- @session.should have_text('exercitation ullamco laboris')
26
+ expect(@session).not_to have_text('exercitation <a href="/foo" id="foo">ullamco</a> laboris')
27
+ expect(@session).to have_text('exercitation ullamco laboris')
28
28
  end
29
29
 
30
30
  it "should ignore extra whitespace and newlines" do
31
31
  @session.visit('/with_html')
32
- @session.should have_text('text with whitespace')
32
+ expect(@session).to have_text('text with whitespace')
33
33
  end
34
34
 
35
35
  it "should ignore whitespace and newlines in the search string" do
36
36
  @session.visit('/with_html')
37
- @session.should have_text("text with \n\n whitespace")
37
+ expect(@session).to have_text("text with \n\n whitespace")
38
38
  end
39
39
 
40
40
  it "should be false if the given text is not on the page" do
41
41
  @session.visit('/with_html')
42
- @session.should_not have_text('xxxxyzzz')
43
- @session.should_not have_text('monkey')
42
+ expect(@session).not_to have_text('xxxxyzzz')
43
+ expect(@session).not_to have_text('monkey')
44
44
  end
45
45
 
46
46
  it 'should handle single quotes in the text' do
47
47
  @session.visit('/with-quotes')
48
- @session.should have_text("can't")
48
+ expect(@session).to have_text("can't")
49
49
  end
50
50
 
51
51
  it 'should handle double quotes in the text' do
52
52
  @session.visit('/with-quotes')
53
- @session.should have_text(%q{"No," he said})
53
+ expect(@session).to have_text(%q{"No," he said})
54
54
  end
55
55
 
56
56
  it 'should handle mixed single and double quotes in the text' do
57
57
  @session.visit('/with-quotes')
58
- @session.should have_text(%q{"you can't do that."})
58
+ expect(@session).to have_text(%q{"you can't do that."})
59
59
  end
60
60
 
61
61
  it 'should be false if text is in the title tag in the head' do
62
62
  @session.visit('/with_js')
63
- @session.should_not have_text('with_js')
63
+ expect(@session).not_to have_text('with_js')
64
64
  end
65
65
 
66
66
  it 'should be false if text is inside a script tag in the body' do
67
67
  @session.visit('/with_js')
68
- @session.should_not have_text('a javascript comment')
69
- @session.should_not have_text('aVar')
68
+ expect(@session).not_to have_text('a javascript comment')
69
+ expect(@session).not_to have_text('aVar')
70
70
  end
71
71
 
72
72
  it "should be false if the given text is on the page but not visible" do
73
73
  @session.visit('/with_html')
74
- @session.should_not have_text('Inside element with hidden ancestor')
74
+ expect(@session).not_to have_text('Inside element with hidden ancestor')
75
75
  end
76
76
 
77
77
  it "should be true if :all given and text is invisible." do
78
78
  @session.visit('/with_html')
79
- @session.should have_text(:all, 'Some of this text is hidden!')
79
+ expect(@session).to have_text(:all, 'Some of this text is hidden!')
80
80
  end
81
81
 
82
82
  it "should be true if `Capybara.ignore_hidden_elements = true` and text is invisible." do
83
83
  Capybara.ignore_hidden_elements = false
84
84
  @session.visit('/with_html')
85
- @session.should have_text('Some of this text is hidden!')
85
+ expect(@session).to have_text('Some of this text is hidden!')
86
86
  end
87
87
 
88
88
  it "should be true if the text in the page matches given regexp" do
89
89
  @session.visit('/with_html')
90
- @session.should have_text(/Lorem/)
90
+ expect(@session).to have_text(/Lorem/)
91
91
  end
92
92
 
93
93
  it "should be false if the text in the page doesn't match given regexp" do
94
94
  @session.visit('/with_html')
95
- @session.should_not have_text(/xxxxyzzz/)
95
+ expect(@session).not_to have_text(/xxxxyzzz/)
96
96
  end
97
97
 
98
98
  it "should escape any characters that would have special meaning in a regexp" do
99
99
  @session.visit('/with_html')
100
- @session.should_not have_text('.orem')
100
+ expect(@session).not_to have_text('.orem')
101
101
  end
102
102
 
103
103
  it "should accept non-string parameters" do
104
104
  @session.visit('/with_html')
105
- @session.should have_text(42)
105
+ expect(@session).to have_text(42)
106
106
  end
107
107
 
108
108
  it "should be true when passed nil" do
109
109
  # Historical behavior; no particular reason other than compatibility.
110
110
  @session.visit('/with_html')
111
- @session.should have_text(nil)
111
+ expect(@session).to have_text(nil)
112
112
  end
113
113
 
114
114
  it "should wait for text to appear", :requires => [:js] do
115
115
  @session.visit('/with_js')
116
116
  @session.click_link('Click me')
117
- @session.should have_text("Has been clicked")
117
+ expect(@session).to have_text("Has been clicked")
118
118
  end
119
119
 
120
120
  context "with between" do
121
121
  it "should be true if the text occurs within the range given" do
122
122
  @session.visit('/with_count')
123
- @session.should have_text('count', between: 1..3)
124
- @session.should have_text(/count/, between: 2..2)
123
+ expect(@session).to have_text('count', between: 1..3)
124
+ expect(@session).to have_text(/count/, between: 2..2)
125
125
  end
126
126
 
127
127
  it "should be false if the text occurs more or fewer times than range" do
128
128
  @session.visit('/with_count')
129
- @session.should_not have_text('count', between: 0..1)
130
- @session.should_not have_text('count', between: 3..10)
131
- @session.should_not have_text(/count/, between: 2...2)
129
+ expect(@session).not_to have_text('count', between: 0..1)
130
+ expect(@session).not_to have_text('count', between: 3..10)
131
+ expect(@session).not_to have_text(/count/, between: 2...2)
132
132
  end
133
133
  end
134
134
 
135
135
  context "with count" do
136
136
  it "should be true if the text occurs the given number of times" do
137
137
  @session.visit('/with_count')
138
- @session.should have_text('count', count: 2)
138
+ expect(@session).to have_text('count', count: 2)
139
139
  end
140
140
 
141
141
  it "should be false if the text occurs a different number of times than the given" do
142
142
  @session.visit('/with_count')
143
- @session.should_not have_text('count', count: 0)
144
- @session.should_not have_text('count', count: 1)
145
- @session.should_not have_text(/count/, count: 3)
143
+ expect(@session).not_to have_text('count', count: 0)
144
+ expect(@session).not_to have_text('count', count: 1)
145
+ expect(@session).not_to have_text(/count/, count: 3)
146
146
  end
147
147
 
148
148
  it "should coerce count to an integer" do
149
149
  @session.visit('/with_count')
150
- @session.should have_text('count', count: '2')
151
- @session.should_not have_text('count', count: '3')
150
+ expect(@session).to have_text('count', count: '2')
151
+ expect(@session).not_to have_text('count', count: '3')
152
152
  end
153
153
  end
154
154
 
155
155
  context "with maximum" do
156
156
  it "should be true when text occurs same or fewer times than given" do
157
157
  @session.visit('/with_count')
158
- @session.should have_text('count', maximum: 2)
159
- @session.should have_text(/count/, maximum: 3)
158
+ expect(@session).to have_text('count', maximum: 2)
159
+ expect(@session).to have_text(/count/, maximum: 3)
160
160
  end
161
161
 
162
162
  it "should be false when text occurs more times than given" do
163
163
  @session.visit('/with_count')
164
- @session.should_not have_text('count', maximum: 1)
165
- @session.should_not have_text('count', maximum: 0)
164
+ expect(@session).not_to have_text('count', maximum: 1)
165
+ expect(@session).not_to have_text('count', maximum: 0)
166
166
  end
167
167
 
168
168
  it "should coerce maximum to an integer" do
169
169
  @session.visit('/with_count')
170
- @session.should have_text('count', maximum: '2')
171
- @session.should_not have_text('count', maximum: '1')
170
+ expect(@session).to have_text('count', maximum: '2')
171
+ expect(@session).not_to have_text('count', maximum: '1')
172
172
  end
173
173
  end
174
174
 
175
175
  context "with minimum" do
176
176
  it "should be true when text occurs same or more times than given" do
177
177
  @session.visit('/with_count')
178
- @session.should have_text('count', minimum: 2)
179
- @session.should have_text(/count/, minimum: 0)
178
+ expect(@session).to have_text('count', minimum: 2)
179
+ expect(@session).to have_text(/count/, minimum: 0)
180
180
  end
181
181
 
182
182
  it "should be false when text occurs fewer times than given" do
183
183
  @session.visit('/with_count')
184
- @session.should_not have_text('count', minimum: 3)
184
+ expect(@session).not_to have_text('count', minimum: 3)
185
185
  end
186
186
 
187
187
  it "should coerce minimum to an integer" do
188
188
  @session.visit('/with_count')
189
- @session.should have_text('count', minimum: '2')
190
- @session.should_not have_text('count', minimum: '3')
189
+ expect(@session).to have_text('count', minimum: '2')
190
+ expect(@session).not_to have_text('count', minimum: '3')
191
191
  end
192
192
  end
193
193
 
@@ -196,7 +196,7 @@ Capybara::SpecHelper.spec '#has_text?' do
196
196
  Capybara.using_wait_time(0.1) do
197
197
  @session.visit('/with_js')
198
198
  @session.click_link('Click me')
199
- @session.should have_text('Has been clicked', :wait => 0.9)
199
+ expect(@session).to have_text('Has been clicked', :wait => 0.9)
200
200
  end
201
201
  end
202
202
  end
@@ -205,105 +205,105 @@ end
205
205
  Capybara::SpecHelper.spec '#has_no_text?' do
206
206
  it "should be false if the given text is on the page at least once" do
207
207
  @session.visit('/with_html')
208
- @session.should_not have_no_text('est')
209
- @session.should_not have_no_text('Lorem')
210
- @session.should_not have_no_text('Redirect')
208
+ expect(@session).not_to have_no_text('est')
209
+ expect(@session).not_to have_no_text('Lorem')
210
+ expect(@session).not_to have_no_text('Redirect')
211
211
  end
212
212
 
213
213
  it "should be false if scoped to an element which has the text" do
214
214
  @session.visit('/with_html')
215
215
  @session.within("//a[@title='awesome title']") do
216
- @session.should_not have_no_text('labore')
216
+ expect(@session).not_to have_no_text('labore')
217
217
  end
218
218
  end
219
219
 
220
220
  it "should be true if scoped to an element which does not have the text" do
221
221
  @session.visit('/with_html')
222
222
  @session.within("//a[@title='awesome title']") do
223
- @session.should have_no_text('monkey')
223
+ expect(@session).to have_no_text('monkey')
224
224
  end
225
225
  end
226
226
 
227
227
  it "should ignore tags" do
228
228
  @session.visit('/with_html')
229
- @session.should have_no_text('exercitation <a href="/foo" id="foo">ullamco</a> laboris')
230
- @session.should_not have_no_text('exercitation ullamco laboris')
229
+ expect(@session).to have_no_text('exercitation <a href="/foo" id="foo">ullamco</a> laboris')
230
+ expect(@session).not_to have_no_text('exercitation ullamco laboris')
231
231
  end
232
232
 
233
233
  it "should be true if the given text is not on the page" do
234
234
  @session.visit('/with_html')
235
- @session.should have_no_text('xxxxyzzz')
236
- @session.should have_no_text('monkey')
235
+ expect(@session).to have_no_text('xxxxyzzz')
236
+ expect(@session).to have_no_text('monkey')
237
237
  end
238
238
 
239
239
  it 'should handle single quotes in the text' do
240
240
  @session.visit('/with-quotes')
241
- @session.should_not have_no_text("can't")
241
+ expect(@session).not_to have_no_text("can't")
242
242
  end
243
243
 
244
244
  it 'should handle double quotes in the text' do
245
245
  @session.visit('/with-quotes')
246
- @session.should_not have_no_text(%q{"No," he said})
246
+ expect(@session).not_to have_no_text(%q{"No," he said})
247
247
  end
248
248
 
249
249
  it 'should handle mixed single and double quotes in the text' do
250
250
  @session.visit('/with-quotes')
251
- @session.should_not have_no_text(%q{"you can't do that."})
251
+ expect(@session).not_to have_no_text(%q{"you can't do that."})
252
252
  end
253
253
 
254
254
  it 'should be true if text is in the title tag in the head' do
255
255
  @session.visit('/with_js')
256
- @session.should have_no_text('with_js')
256
+ expect(@session).to have_no_text('with_js')
257
257
  end
258
258
 
259
259
  it 'should be true if text is inside a script tag in the body' do
260
260
  @session.visit('/with_js')
261
- @session.should have_no_text('a javascript comment')
262
- @session.should have_no_text('aVar')
261
+ expect(@session).to have_no_text('a javascript comment')
262
+ expect(@session).to have_no_text('aVar')
263
263
  end
264
264
 
265
265
  it "should be true if the given text is on the page but not visible" do
266
266
  @session.visit('/with_html')
267
- @session.should have_no_text('Inside element with hidden ancestor')
267
+ expect(@session).to have_no_text('Inside element with hidden ancestor')
268
268
  end
269
269
 
270
270
  it "should be false if :all given and text is invisible." do
271
271
  @session.visit('/with_html')
272
- @session.should_not have_no_text(:all, 'Some of this text is hidden!')
272
+ expect(@session).not_to have_no_text(:all, 'Some of this text is hidden!')
273
273
  end
274
274
 
275
275
  it "should be false if `Capybara.ignore_hidden_elements = true` and text is invisible." do
276
276
  Capybara.ignore_hidden_elements = false
277
277
  @session.visit('/with_html')
278
- @session.should_not have_no_text('Some of this text is hidden!')
278
+ expect(@session).not_to have_no_text('Some of this text is hidden!')
279
279
  end
280
280
 
281
281
  it "should be true if the text in the page doesn't match given regexp" do
282
282
  @session.visit('/with_html')
283
- @session.should have_no_text(/xxxxyzzz/)
283
+ expect(@session).to have_no_text(/xxxxyzzz/)
284
284
  end
285
285
 
286
286
  it "should be false if the text in the page matches given regexp" do
287
287
  @session.visit('/with_html')
288
- @session.should_not have_no_text(/Lorem/)
288
+ expect(@session).not_to have_no_text(/Lorem/)
289
289
  end
290
290
 
291
291
  it "should escape any characters that would have special meaning in a regexp" do
292
292
  @session.visit('/with_html')
293
- @session.should have_no_text('.orem')
293
+ expect(@session).to have_no_text('.orem')
294
294
  end
295
295
 
296
296
  it "should wait for text to disappear", :requires => [:js] do
297
297
  @session.visit('/with_js')
298
298
  @session.click_link('Click me')
299
- @session.should have_no_text("I changed it")
299
+ expect(@session).to have_no_text("I changed it")
300
300
  end
301
301
 
302
302
  context "with wait", :requires => [:js] do
303
303
  it "should not find element if it appears after given wait duration" do
304
304
  @session.visit('/with_js')
305
305
  @session.click_link('Click me')
306
- @session.should have_no_text('Has been clicked', :wait => 0.1)
306
+ expect(@session).to have_no_text('Has been clicked', :wait => 0.1)
307
307
  end
308
308
  end
309
309
  end
@@ -4,21 +4,21 @@ Capybara::SpecHelper.spec '#has_title?' do
4
4
  end
5
5
 
6
6
  it "should be true if the page has the given title" do
7
- @session.should have_title('with_js')
7
+ expect(@session).to have_title('with_js')
8
8
  end
9
9
 
10
10
  it "should allow regexp matches" do
11
- @session.should have_title(/w[a-z]{3}_js/)
12
- @session.should_not have_title(/monkey/)
11
+ expect(@session).to have_title(/w[a-z]{3}_js/)
12
+ expect(@session).not_to have_title(/monkey/)
13
13
  end
14
14
 
15
15
  it "should wait for title", :requires => [:js] do
16
16
  @session.click_link("Change title")
17
- @session.should have_title("changed title")
17
+ expect(@session).to have_title("changed title")
18
18
  end
19
19
 
20
20
  it "should be false if the page has not the given title" do
21
- @session.should_not have_title('monkey')
21
+ expect(@session).not_to have_title('monkey')
22
22
  end
23
23
  end
24
24
 
@@ -28,20 +28,20 @@ Capybara::SpecHelper.spec '#has_no_title?' do
28
28
  end
29
29
 
30
30
  it "should be false if the page has the given title" do
31
- @session.should_not have_no_title('with_js')
31
+ expect(@session).not_to have_no_title('with_js')
32
32
  end
33
33
 
34
34
  it "should allow regexp matches" do
35
- @session.should_not have_no_title(/w[a-z]{3}_js/)
36
- @session.should have_no_title(/monkey/)
35
+ expect(@session).not_to have_no_title(/w[a-z]{3}_js/)
36
+ expect(@session).to have_no_title(/monkey/)
37
37
  end
38
38
 
39
39
  it "should wait for title to disappear", :requires => [:js] do
40
40
  @session.click_link("Change title")
41
- @session.should have_no_title('with_js')
41
+ expect(@session).to have_no_title('with_js')
42
42
  end
43
43
 
44
44
  it "should be true if the page has not the given title" do
45
- @session.should have_no_title('monkey')
45
+ expect(@session).to have_no_title('monkey')
46
46
  end
47
47
  end