spreewald 1.12.6 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +18 -0
- data/README.md +4 -0
- data/lib/spreewald/email_steps.rb +11 -11
- data/lib/spreewald/table_steps.rb +2 -2
- data/lib/spreewald/web_steps.rb +42 -42
- data/lib/spreewald_support/mail_finder.rb +2 -1
- data/lib/spreewald_support/version.rb +1 -1
- data/lib/spreewald_support/web_steps_helpers.rb +8 -8
- data/spreewald.gemspec +1 -1
- data/tests/rails-3_capybara-1/Gemfile.lock +6 -1
- data/tests/rails-3_capybara-2/Gemfile.lock +6 -1
- data/tests/rails-4_capybara-3/Gemfile.lock +6 -1
- data/tests/rails-4_capybara-3/features/email_steps.feature +102 -11
- data/tests/rails-4_capybara-3/features/step_definitions/overriding_steps.rb +1 -1
- data/tests/rails-4_capybara-3/features/web_steps.feature +33 -3
- data/tests/shared/app/controllers/forms_controller.rb +3 -0
- data/tests/shared/app/models/mailer.rb +9 -4
- data/tests/shared/app/views/emails/send_email.haml +0 -0
- data/tests/shared/app/views/forms/form1.html.haml +4 -0
- data/tests/shared/app/views/forms/invalid_form.html.haml +10 -0
- data/tests/shared/app/views/mailer/email.haml +4 -0
- data/tests/shared/db/test.sqlite3 +0 -0
- data/tests/shared/features/shared/email_steps.feature +102 -11
- data/tests/shared/features/shared/step_definitions/overriding_steps.rb +1 -1
- data/tests/shared/features/shared/web_steps.feature +33 -3
- metadata +22 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a22775025cf0cf74204918e6e3ee4d23a6b69c96
|
4
|
+
data.tar.gz: 333abc8f129f9313377b91a65e00eafde0b1a9a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b778997c69a6b30f559e874de95c6ce458908dd94671592cd505f6e55f4f34ba845fb5ecdb07d0e1883b66d0babf5bd10fc8dbeba82e2b60aa1161fea0c7299b
|
7
|
+
data.tar.gz: e105a28e01f932938c13eb0854ec605438c57c9d3fcdab4f0286897fcc9d5c0e6247423d1adf8408c5eab5874644344b19533c2f6559e9d76569153d63677901
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
5
5
|
|
6
|
+
## 2.0.0
|
7
|
+
Mail steps supports both LF and CRLF linebreaks. (see [issue #83](https://github.com/makandra/spreewald/issues/83))
|
8
|
+
### Breaking Changes
|
9
|
+
Requires RSpec >= 2.13.0 because we dropped RSpec's should syntax.
|
10
|
+
|
6
11
|
## 1.12.6
|
7
12
|
The "within" step no longer clashes with the "I should see an element for" and "I click on the element for" steps ([Issue #87](https://github.com/makandra/spreewald/issues/87))
|
8
13
|
|
@@ -22,13 +27,9 @@ Always check the current driver by its class (see [issue](https://github.com/mak
|
|
22
27
|
- Remove deprecation warnings because of `failure_message_for_should` and `failure_message_for_should_not`
|
23
28
|
|
24
29
|
## 1.12.0
|
25
|
-
|
26
|
-
### Compatible changes
|
27
30
|
- Make Spreewald work without jQuery
|
28
31
|
|
29
32
|
## 1.11.6 2018-08-28
|
30
|
-
|
31
|
-
### Compatible changes
|
32
33
|
- Added CHANGELOG
|
33
34
|
- Replaced `field_labeled` with `find_field` (https://github.com/teamcapybara/capybara/blob/master/History.md#removed)
|
34
35
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,22 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
+
diff-lcs (1.3)
|
4
5
|
gemika (0.3.4)
|
5
6
|
rake (12.3.2)
|
7
|
+
rspec (3.8.0)
|
8
|
+
rspec-core (~> 3.8.0)
|
9
|
+
rspec-expectations (~> 3.8.0)
|
10
|
+
rspec-mocks (~> 3.8.0)
|
11
|
+
rspec-core (3.8.0)
|
12
|
+
rspec-support (~> 3.8.0)
|
13
|
+
rspec-expectations (3.8.2)
|
14
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
15
|
+
rspec-support (~> 3.8.0)
|
16
|
+
rspec-mocks (3.8.0)
|
17
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
18
|
+
rspec-support (~> 3.8.0)
|
19
|
+
rspec-support (3.8.0)
|
6
20
|
|
7
21
|
PLATFORMS
|
8
22
|
ruby
|
@@ -10,3 +24,7 @@ PLATFORMS
|
|
10
24
|
DEPENDENCIES
|
11
25
|
gemika
|
12
26
|
rake
|
27
|
+
rspec (>= 2.13.0)
|
28
|
+
|
29
|
+
BUNDLED WITH
|
30
|
+
1.13.7
|
data/README.md
CHANGED
@@ -38,25 +38,25 @@ Then /^(an|no) e?mail should have been sent with:$/ do |mode, raw_data|
|
|
38
38
|
end
|
39
39
|
conditions[:body] = body if body
|
40
40
|
@mail = MailFinder.find(conditions)
|
41
|
-
expectation = mode == 'no' ? '
|
42
|
-
@mail.send(expectation, be_present)
|
41
|
+
expectation = mode == 'no' ? 'not_to' : 'to'
|
42
|
+
expect(@mail).send(expectation, be_present)
|
43
43
|
end
|
44
44
|
end.overridable
|
45
45
|
|
46
46
|
# nodoc
|
47
|
-
Then /^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]+"|to "[^"]+"|the subject "[^"]+"|the body "[^"]+"|the attachments "[^"]+")+)$/ do |mode, query|
|
47
|
+
Then /^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]+"|cc "[^"]+"|to "[^"]+"|the subject "[^"]+"|the body "[^"]+"|the attachments "[^"]+")+)$/ do |mode, query|
|
48
48
|
patiently do
|
49
49
|
conditions = {}
|
50
50
|
conditions[:to] = $1 if query =~ /to "([^"]+)"/
|
51
|
-
conditions[:
|
51
|
+
conditions[:Cc] = $1 if query =~ /cc "([^"]+)"/
|
52
52
|
conditions[:bcc] = $1 if query =~ /bcc "([^"]+)"/
|
53
53
|
conditions[:from] = $1 if query =~ /from "([^"]+)"/
|
54
54
|
conditions[:subject] = $1 if query =~ /the subject "([^"]+)"/
|
55
55
|
conditions[:body] = $1 if query =~ /the body "([^"]+)"/
|
56
56
|
conditions[:attachments] = $1 if query =~ /the attachments "([^"]+)"/
|
57
57
|
@mail = MailFinder.find(conditions)
|
58
|
-
expectation = mode == 'no' ? '
|
59
|
-
@mail.send(expectation, be_present)
|
58
|
+
expectation = mode == 'no' ? 'not_to' : 'to'
|
59
|
+
expect(@mail).send(expectation, be_present)
|
60
60
|
end
|
61
61
|
end.overridable
|
62
62
|
|
@@ -71,12 +71,12 @@ When /^I follow the (first|second|third)? ?link in the e?mail$/ do |index_in_wor
|
|
71
71
|
end.overridable
|
72
72
|
|
73
73
|
Then /^no e?mail should have been sent$/ do
|
74
|
-
ActionMailer::Base.deliveries.
|
74
|
+
expect(ActionMailer::Base.deliveries).to be_empty
|
75
75
|
end.overridable
|
76
76
|
|
77
77
|
# Checks that the last sent email includes some text
|
78
78
|
Then /^I should see "([^\"]*)" in the e?mail$/ do |text|
|
79
|
-
MailFinder.email_text_body(ActionMailer::Base.deliveries.last).
|
79
|
+
expect(MailFinder.email_text_body(ActionMailer::Base.deliveries.last)).to include(text)
|
80
80
|
end.overridable
|
81
81
|
|
82
82
|
# Print all sent emails to STDOUT.
|
@@ -103,16 +103,16 @@ end.overridable
|
|
103
103
|
# need to be present
|
104
104
|
# """
|
105
105
|
Then /^that e?mail should( not)? have the following lines in the body:$/ do |negate, body|
|
106
|
-
expectation = negate ? '
|
106
|
+
expectation = negate ? 'not_to' : 'to'
|
107
107
|
email_text_body = MailFinder.email_text_body(@mail)
|
108
108
|
|
109
109
|
body.to_s.strip.split(/\n/).each do |line|
|
110
|
-
email_text_body.send(expectation, include(line.strip))
|
110
|
+
expect(email_text_body).send(expectation, include(line.strip))
|
111
111
|
end
|
112
112
|
end.overridable
|
113
113
|
|
114
114
|
# Only works after you've retrieved the email using "Then an email should have been sent with:"
|
115
115
|
# Checks that the text should be included in the retrieved email
|
116
116
|
Then /^that e?mail should have the following body:$/ do |body|
|
117
|
-
MailFinder.email_text_body(@mail).
|
117
|
+
expect(MailFinder.email_text_body(@mail)).to include(body.strip)
|
118
118
|
end.overridable
|
@@ -129,9 +129,9 @@ Then /^I should( not)? see a table with (exactly )?the following rows( in any or
|
|
129
129
|
options = { :exactly => exactly, :unordered => unordered }
|
130
130
|
|
131
131
|
if negate
|
132
|
-
tables.
|
132
|
+
expect(tables).not_to contain_table(parsed_table, options)
|
133
133
|
else
|
134
|
-
tables.
|
134
|
+
expect(tables).to contain_table(parsed_table, options)
|
135
135
|
end
|
136
136
|
end
|
137
137
|
end.overridable
|
data/lib/spreewald/web_steps.rb
CHANGED
@@ -46,7 +46,7 @@ When /^(.*) within (.*[^:])$/ do |nested_step, parent|
|
|
46
46
|
selector = _selector_for(parent)
|
47
47
|
if selector.is_a?(String) || selector.is_a?(Array) # could also be a Capybara::Node::Element
|
48
48
|
patiently do
|
49
|
-
page.
|
49
|
+
expect(page).to have_selector(*selector)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
patiently do
|
@@ -81,7 +81,7 @@ Then /^(?:|I )should be on (.+)$/ do |page_name|
|
|
81
81
|
current_path = expected_path if current_path.chomp("/") == expected_path.chomp("/")
|
82
82
|
current_path = expected_path if current_path.gsub("/#", "#") == expected_path.gsub("/#", "#")
|
83
83
|
|
84
|
-
current_path.
|
84
|
+
expect(current_path).to eq(expected_path)
|
85
85
|
end
|
86
86
|
end.overridable
|
87
87
|
|
@@ -168,7 +168,7 @@ end.overridable
|
|
168
168
|
# Note that this does not detect if the text might be hidden via CSS
|
169
169
|
Then /^(?:|I )should see "([^"]*)"$/ do |text|
|
170
170
|
patiently do
|
171
|
-
page.
|
171
|
+
expect(page).to have_content(text)
|
172
172
|
end
|
173
173
|
end.overridable
|
174
174
|
|
@@ -178,20 +178,20 @@ end.overridable
|
|
178
178
|
Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
|
179
179
|
regexp = Regexp.new(regexp)
|
180
180
|
patiently do
|
181
|
-
page.
|
181
|
+
expect(page).to have_xpath('//*', :text => regexp)
|
182
182
|
end
|
183
183
|
end.overridable
|
184
184
|
|
185
185
|
Then /^(?:|I )should not see "([^"]*)"$/ do |text|
|
186
186
|
patiently do
|
187
|
-
page.
|
187
|
+
expect(page).to have_no_content(text)
|
188
188
|
end
|
189
189
|
end.overridable
|
190
190
|
|
191
191
|
Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
|
192
192
|
patiently do
|
193
193
|
regexp = Regexp.new(regexp)
|
194
|
-
page.
|
194
|
+
expect(page).to have_no_xpath('//*', :text => regexp)
|
195
195
|
end
|
196
196
|
end.overridable
|
197
197
|
|
@@ -212,7 +212,7 @@ Then /^the "([^"]*)" field should (not )?contain "([^"]*)"$/ do |label, negate,
|
|
212
212
|
else
|
213
213
|
field.value
|
214
214
|
end
|
215
|
-
field_value.send(negate ? :
|
215
|
+
expect(field_value).send(negate ? :not_to : :to, contain_with_wildcards(expected_string))
|
216
216
|
end
|
217
217
|
end.overridable
|
218
218
|
|
@@ -220,7 +220,7 @@ end.overridable
|
|
220
220
|
Then(/^the "(.*?)" field should (not )?contain:$/) do |label, negate, expected_string|
|
221
221
|
patiently do
|
222
222
|
field = find_field(label)
|
223
|
-
field.value.chomp.send(negate ? :
|
223
|
+
expect(field.value.chomp).send(negate ? :not_to : :to, contain_with_wildcards(expected_string))
|
224
224
|
end
|
225
225
|
end.overridable
|
226
226
|
|
@@ -248,7 +248,7 @@ Then /^the "([^"]*)" field should have the error "([^"]*)"$/ do |field, error_me
|
|
248
248
|
using_formtastic = form_for_input[:class].include?('formtastic')
|
249
249
|
error_class = using_formtastic ? 'error' : 'field_with_errors'
|
250
250
|
|
251
|
-
classes.
|
251
|
+
expect(classes).to include(error_class)
|
252
252
|
|
253
253
|
if using_formtastic
|
254
254
|
error_paragraph = element.find(:xpath, '../*[@class="inline-errors"][1]')
|
@@ -261,10 +261,10 @@ end.overridable
|
|
261
261
|
|
262
262
|
Then /^the "([^\"]*)" field should( not)? have an error$/ do |label, negate|
|
263
263
|
patiently do
|
264
|
-
expectation = negate ? :
|
264
|
+
expectation = negate ? :not_to : :to
|
265
265
|
field = find_field(label)
|
266
|
-
field[:id].
|
267
|
-
page.send(expectation, have_css(".field_with_errors ##{field[:id]}"))
|
266
|
+
expect(field[:id]).to be_present # prevent bad CSS selector if field lacks id
|
267
|
+
expect(page).send(expectation, have_css(".field_with_errors ##{field[:id]}"))
|
268
268
|
end
|
269
269
|
end.overridable
|
270
270
|
|
@@ -272,13 +272,13 @@ Then /^the "([^"]*)" field should have no error$/ do |field|
|
|
272
272
|
patiently do
|
273
273
|
element = find_field(field)
|
274
274
|
classes = element.find(:xpath, '..')[:class].split(' ')
|
275
|
-
classes.
|
276
|
-
classes.
|
275
|
+
expect(classes).not_to include('field_with_errors')
|
276
|
+
expect(classes).not_to include('error')
|
277
277
|
end
|
278
278
|
end.overridable
|
279
279
|
|
280
280
|
Then /^the "([^"]*)" checkbox should( not)? be checked( and disabled)?$/ do |label, negate, disabled|
|
281
|
-
expectation = negate ? :
|
281
|
+
expectation = negate ? :not_to : :to
|
282
282
|
|
283
283
|
patiently do
|
284
284
|
field = if Capybara::VERSION < "2.1"
|
@@ -286,13 +286,13 @@ Then /^the "([^"]*)" checkbox should( not)? be checked( and disabled)?$/ do |lab
|
|
286
286
|
else
|
287
287
|
find_field(label, :disabled => !!disabled)
|
288
288
|
end
|
289
|
-
field.send expectation, be_checked
|
289
|
+
expect(field).send expectation, be_checked
|
290
290
|
end
|
291
291
|
end.overridable
|
292
292
|
|
293
293
|
Then /^the radio button "([^"]*)" should( not)? be (?:checked|selected)$/ do |field, negate|
|
294
294
|
patiently do
|
295
|
-
page.send((negate ? :has_no_checked_field? : :has_checked_field?), field).
|
295
|
+
expect(page.send((negate ? :has_no_checked_field? : :has_checked_field?), field)).to eq(true)
|
296
296
|
end
|
297
297
|
end.overridable
|
298
298
|
|
@@ -310,7 +310,7 @@ Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
|
310
310
|
expected_params = {}
|
311
311
|
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
|
312
312
|
|
313
|
-
actual_params.
|
313
|
+
expect(actual_params).to eq(expected_params)
|
314
314
|
end
|
315
315
|
end.overridable
|
316
316
|
|
@@ -322,7 +322,7 @@ end.overridable
|
|
322
322
|
|
323
323
|
# Checks for the existance of an input field (given its id or label)
|
324
324
|
Then /^I should( not)? see a field "([^"]*)"$/ do |negate, name|
|
325
|
-
expectation = negate ? :
|
325
|
+
expectation = negate ? :not_to : :to
|
326
326
|
patiently do
|
327
327
|
begin
|
328
328
|
# In old Capybaras find_field returns nil, so we assign it to `field`
|
@@ -332,7 +332,7 @@ Then /^I should( not)? see a field "([^"]*)"$/ do |negate, name|
|
|
332
332
|
# We must explicitely reset the field variable from a previous patiently iteration
|
333
333
|
field = nil
|
334
334
|
end
|
335
|
-
field.send(expectation, be_present)
|
335
|
+
expect(field).send(expectation, be_present)
|
336
336
|
end
|
337
337
|
end.overridable
|
338
338
|
|
@@ -346,22 +346,22 @@ Then /^I should( not)? see the (?:number|amount) ([\-\d,\.]+)(?: (.*?))?$/ do |n
|
|
346
346
|
no_minus = amount.starts_with?('-') ? '' : '[^\\-]'
|
347
347
|
nbsp = " "
|
348
348
|
regexp = Regexp.new(no_minus + "\\b" + Regexp.quote(amount) + (unit ? "( |#{nbsp}| )(#{unit}|#{Regexp.quote(HTMLEntities.new.encode(unit, :named))})" :"\\b"))
|
349
|
-
expectation = negate ? :
|
349
|
+
expectation = negate ? :not_to : :to
|
350
350
|
patiently do
|
351
|
-
page.body.send(expectation, match(regexp))
|
351
|
+
expect(page.body).send(expectation, match(regexp))
|
352
352
|
end
|
353
353
|
end.overridable
|
354
354
|
|
355
355
|
# Checks `Content-Type` HTTP header
|
356
356
|
Then /^I should get a response with content-type "([^\"]*)"$/ do |expected_content_type|
|
357
|
-
page.response_headers['Content-Type'].
|
357
|
+
expect(page.response_headers['Content-Type']).to =~ /\A#{Regexp.quote(expected_content_type)}($|;)/
|
358
358
|
end.overridable
|
359
359
|
|
360
360
|
# Checks `Content-Disposition` HTTP header
|
361
361
|
#
|
362
362
|
# Attention: Doesn't work with Selenium, see https://github.com/jnicklas/capybara#gotchas
|
363
363
|
Then /^I should get a download with filename "([^\"]*)"$/ do |filename|
|
364
|
-
page.response_headers['Content-Disposition'].
|
364
|
+
expect(page.response_headers['Content-Disposition']).to =~ /filename="#{Regexp.escape(filename)}"$/
|
365
365
|
end.overridable
|
366
366
|
|
367
367
|
# Checks that a certain option is selected for a text field
|
@@ -375,7 +375,7 @@ Then /^nothing should be selected for "([^"]*)"$/ do |field|
|
|
375
375
|
begin
|
376
376
|
selected_option = select.find(:xpath, ".//option[@selected = 'selected']") || select.all(:css, 'option').first
|
377
377
|
value = selected_option ? selected_option.value : nil
|
378
|
-
value.
|
378
|
+
expect(value).to be_blank
|
379
379
|
rescue Capybara::ElementNotFound
|
380
380
|
end
|
381
381
|
end
|
@@ -391,11 +391,11 @@ Then /^"([^"]*)" should( not)? be an option for "([^"]*)"$/ do |value, negate, f
|
|
391
391
|
patiently do
|
392
392
|
if negate
|
393
393
|
begin
|
394
|
-
find_field(field).
|
394
|
+
expect(find_field(field)).to have_no_css(*finder_arguments)
|
395
395
|
rescue Capybara::ElementNotFound
|
396
396
|
end
|
397
397
|
else
|
398
|
-
find_field(field).
|
398
|
+
expect(find_field(field)).to have_css(*finder_arguments)
|
399
399
|
end
|
400
400
|
end
|
401
401
|
end.overridable
|
@@ -404,31 +404,31 @@ end.overridable
|
|
404
404
|
# the expected string contains quotes as well.
|
405
405
|
Then /^(?:|I )should see '([^']*)'$/ do |text|
|
406
406
|
patiently do
|
407
|
-
page.
|
407
|
+
expect(page).to have_content(text)
|
408
408
|
end
|
409
409
|
end.overridable
|
410
410
|
|
411
411
|
# Check that the raw HTML contains a string
|
412
412
|
Then /^I should see "([^\"]*)" in the HTML$/ do |text|
|
413
413
|
patiently do
|
414
|
-
page.body.
|
414
|
+
expect(page.body).to include(text)
|
415
415
|
end
|
416
416
|
end.overridable
|
417
417
|
|
418
418
|
Then /^I should not see "([^\"]*)" in the HTML$/ do |text|
|
419
419
|
patiently do
|
420
|
-
page.body.
|
420
|
+
expect(page.body).not_to include(text)
|
421
421
|
end
|
422
422
|
end.overridable
|
423
423
|
|
424
424
|
# Checks that status code is 400..599
|
425
425
|
Then /^I should see an error$/ do
|
426
|
-
(400 .. 599).
|
426
|
+
expect((400 .. 599)).to include(page.status_code)
|
427
427
|
end.overridable
|
428
428
|
|
429
429
|
Then /^the window should be titled "([^"]*)"$/ do |title|
|
430
430
|
patiently do
|
431
|
-
|
431
|
+
expect(pag).to have_css('title', :text => title)
|
432
432
|
end
|
433
433
|
end.overridable
|
434
434
|
|
@@ -521,7 +521,7 @@ end.overridable(priority: -5) # priority lower than within
|
|
521
521
|
Then /^"([^"]*)" should link to "([^"]*)"$/ do |link_label, target|
|
522
522
|
patiently do
|
523
523
|
link = find_link(link_label)
|
524
|
-
link[:href].
|
524
|
+
expect(link[:href]).to match(/#{Regexp.escape target}(\?[^\/]*)?$/) # ignore trailing timestamps
|
525
525
|
end
|
526
526
|
end.overridable
|
527
527
|
|
@@ -534,9 +534,9 @@ end.overridable
|
|
534
534
|
# Then I should not see an element ".sidebar"
|
535
535
|
# Then I should not see the element ".sidebar"
|
536
536
|
Then /^I should (not )?see (?:an|the) element "([^"]+)"$/ do |negate, selector|
|
537
|
-
expectation = negate ? :
|
537
|
+
expectation = negate ? :not_to : :to
|
538
538
|
patiently do
|
539
|
-
page.send(expectation, have_css(selector))
|
539
|
+
expect(page).send(expectation, have_css(selector))
|
540
540
|
end
|
541
541
|
end.overridable
|
542
542
|
|
@@ -549,10 +549,10 @@ end.overridable
|
|
549
549
|
# Then I should not see an element for the sidebar
|
550
550
|
# Then I should not see the element for the sidebar
|
551
551
|
Then /^I should (not )?see (?:an|the) element for (.*?)$/ do |negate, locator|
|
552
|
-
expectation = negate ? :
|
552
|
+
expectation = negate ? :not_to : :to
|
553
553
|
selector = _selector_for(locator)
|
554
554
|
patiently do
|
555
|
-
page.send(expectation, have_selector(*selector))
|
555
|
+
expect(page).send(expectation, have_selector(*selector))
|
556
556
|
end
|
557
557
|
end.overridable(:priority => -5) # priority must be lower than the "within" step
|
558
558
|
|
@@ -574,8 +574,8 @@ When /^I follow "([^"]*)" inside any "([^"]*)"$/ do |label, selector|
|
|
574
574
|
end.overridable
|
575
575
|
|
576
576
|
Then /^I should( not)? see "([^"]*)" inside any "([^"]*)"$/ do |negate, text, selector|
|
577
|
-
expectation = negate ? :
|
578
|
-
page.send(expectation, have_css(selector, :text => text))
|
577
|
+
expectation = negate ? :not_to : :to
|
578
|
+
expect(page).send(expectation, have_css(selector, :text => text))
|
579
579
|
end.overridable
|
580
580
|
|
581
581
|
When /^I fill in "([^"]*)" with "([^"]*)" inside any "([^"]*)"$/ do |field, value, selector|
|
@@ -638,7 +638,7 @@ Then /^I should see in this order:?$/ do |text|
|
|
638
638
|
pattern = lines.collect(&Regexp.method(:quote)).join('.*?')
|
639
639
|
pattern = Regexp.compile(pattern)
|
640
640
|
patiently do
|
641
|
-
page.text.gsub(/\s+/, ' ').
|
641
|
+
expect(page.text.gsub(/\s+/, ' ')).to match(pattern)
|
642
642
|
end
|
643
643
|
end.overridable
|
644
644
|
|
@@ -653,7 +653,7 @@ Then /^the "([^\"]*)" (field|button|checkbox) should( not)? be disabled$/ do |la
|
|
653
653
|
else
|
654
654
|
element = find_button(label)
|
655
655
|
end
|
656
|
-
["false", "", nil].send(negate ? :
|
656
|
+
expect(["false", "", nil]).send(negate ? :not_to : :to, include(element[:disabled]))
|
657
657
|
end.overridable
|
658
658
|
|
659
659
|
# Tests that a field with the given label is visible.
|
@@ -728,5 +728,5 @@ Then /^the "(.*?)" select should( not)? be sorted$/ do |label, negate|
|
|
728
728
|
options = select.all('option').reject { |o| o.value.blank? }
|
729
729
|
option_texts = options.collect(&:text)
|
730
730
|
|
731
|
-
option_texts.send((negate ? :
|
731
|
+
expect(option_texts).send((negate ? :not_to : :to), be_sorted)
|
732
732
|
end.overridable
|