spreewald 1.4.0 → 1.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 550c0ee0c29e48a7a5150fd2455ae75e567a024b
4
- data.tar.gz: ca07a1d6c5b953721b885d371451d177373791f3
3
+ metadata.gz: 960108c467445549a67e87a7695a194c5521584e
4
+ data.tar.gz: 32acb9ab2ef32405962b9e31ce7497f5e5bbcbb0
5
5
  SHA512:
6
- metadata.gz: fb34ba4c3ea0cf7003a371450d7288940c3daeb40b94d4d70c1424a393b385d5ec7d4a54f98c5d8d643e25459426d2a0358a8262ba01acf712767360ff295d83
7
- data.tar.gz: 703bf4de4c830f759520c099b28d98a0cdd0def111139326e1ad9b231a180f14889ccb3ee5b26a5295bda09c64a40091b5207960f664bc41d7550e8bfd7bbda3
6
+ metadata.gz: 93b0cad01387a6e425564b0fa4606383319f430996cb6e4596b51b12138258b6cced76a5410907d05bf606ed6d4feabcca6c978ef09cd3fe560659d8262d2789
7
+ data.tar.gz: 7954b16059be050cd13a8cfd11c941dad7213a81a5c448661dd3b885a1bd16c68555d32084dc7e185c14c65ca0d978310fd301dbff57c44dd384fc6160c6fc9b
data/README.md CHANGED
@@ -65,6 +65,12 @@ You can achieve this in your own steps by wrapping them inside a `patiently do`
65
65
 
66
66
  More info [here](https://makandracards.com/makandra/12139-waiting-for-page-load-with-spreewald).
67
67
 
68
+
69
+ ## Overriding steps
70
+
71
+ Thanks to [cucumber_priority](https://github.com/makandra/cucumber_priority) you can override any step definition from Spreewald with your own patten. Cucumber will not raise `Cucumber::Ambiguous` if your custom steps collide with a Spreewald step.
72
+
73
+
68
74
  ## Contributing
69
75
 
70
76
  Test applications for various Rails versions live in `tests/`.
@@ -1,4 +1,5 @@
1
1
  # coding: UTF-8
2
2
 
3
+ require 'cucumber_priority'
3
4
  require "spreewald_support/version"
4
5
  require "spreewald_support/github"
@@ -3,7 +3,7 @@
3
3
  # Marks scenario as pending
4
4
  Then /^it should work$/ do
5
5
  pending
6
- end
6
+ end.overridable
7
7
 
8
8
  # Starts debugger, or Pry if installed
9
9
  Then /^debugger$/ do
@@ -14,7 +14,7 @@ Then /^debugger$/ do
14
14
  end
15
15
 
16
16
  true # Ruby will halt in this line
17
- end
17
+ end.overridable
18
18
 
19
19
  # Waits 2 seconds after each step
20
20
  AfterStep('@slow-motion') do
@@ -8,7 +8,7 @@ end
8
8
 
9
9
  When /^I clear my e?mails$/ do
10
10
  ActionMailer::Base.deliveries.clear
11
- end
11
+ end.overridable
12
12
 
13
13
  # Example:
14
14
  #
@@ -41,7 +41,7 @@ Then /^(an|no) e?mail should have been sent with:$/ do |mode, raw_data|
41
41
  expectation = mode == 'no' ? 'should_not' : 'should'
42
42
  @mail.send(expectation, be_present)
43
43
  end
44
- end
44
+ end.overridable
45
45
 
46
46
  # nodoc
47
47
  Then /^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]+"|to "[^"]+"|the subject "[^"]+"|the body "[^"]+"|the attachments "[^"]+")+)$/ do |mode, query|
@@ -58,7 +58,7 @@ Then /^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]
58
58
  expectation = mode == 'no' ? 'should_not' : 'should'
59
59
  @mail.send(expectation, be_present)
60
60
  end
61
- end
61
+ end.overridable
62
62
 
63
63
  # Only works after you have retrieved the mail using "Then an email should have been sent with:"
64
64
  When /^I follow the (first|second|third)? ?link in the e?mail$/ do |index_in_words|
@@ -68,16 +68,16 @@ When /^I follow the (first|second|third)? ?link in the e?mail$/ do |index_in_wor
68
68
  mail_body = MailFinder.email_text_body(mail).to_s
69
69
  only_path = mail_body.scan(url_pattern)[index][0]
70
70
  visit only_path
71
- end
71
+ end.overridable
72
72
 
73
73
  Then /^no e?mail should have been sent$/ do
74
74
  ActionMailer::Base.deliveries.should be_empty
75
- end
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
79
  MailFinder.email_text_body(ActionMailer::Base.deliveries.last).should include(text)
80
- end
80
+ end.overridable
81
81
 
82
82
  # Print all sent emails to STDOUT.
83
83
  Then /^show me the e?mails$/ do
@@ -91,7 +91,7 @@ Then /^show me the e?mails$/ do
91
91
  ].join("\n")
92
92
  print "-" * 80
93
93
  end
94
- end
94
+ end.overridable
95
95
 
96
96
  # Only works after you've retrieved the email using "Then an email should have been sent with:"
97
97
  #
@@ -109,10 +109,10 @@ Then /^that e?mail should( not)? have the following lines in the body:$/ do |neg
109
109
  body.to_s.strip.split(/\n/).each do |line|
110
110
  email_text_body.send(expectation, include(line.strip))
111
111
  end
112
- end
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
117
  MailFinder.email_text_body(@mail).should include(body.strip)
118
- end
118
+ end.overridable
@@ -38,4 +38,4 @@ Given /^the file "([^"]*)" was attached(?: as (?:([^"]*)\/)?([^"]*))? to the ([^
38
38
  container.send("#{relation_name}=", File.new(path_to_file))
39
39
  container.updated_at = time if time
40
40
  container.save!
41
- end
41
+ end.overridable
@@ -122,4 +122,4 @@ Then /^I should( not)? see a table with (exactly )?the following rows( in any or
122
122
  tables.should contain_table(parsed_table, options)
123
123
  end
124
124
  end
125
- end
125
+ end.overridable
@@ -46,14 +46,14 @@ if defined?(Timecop)
46
46
  # Given the time is 2012-02-10 13:40
47
47
  When /^the (?:date|time) is "?(\d{4}-\d{2}-\d{2}(?: \d{1,2}:\d{2})?)"?$/ do |time|
48
48
  Timecop.travel(parse_time(time))
49
- end
49
+ end.overridable
50
50
 
51
51
  # Example:
52
52
  #
53
53
  # Given the time is 13:40
54
54
  When /^the time is "?(\d{1,2}:\d{2})"?$/ do |time_without_date|
55
55
  Timecop.travel(parse_time(time_without_date)) # date will be today
56
- end
56
+ end.overridable
57
57
 
58
58
  # Example:
59
59
  #
@@ -70,10 +70,10 @@ if defined?(Timecop)
70
70
  end
71
71
  amount = -amount if direction == 'earlier'
72
72
  Timecop.travel(current_time + amount.send(unit))
73
- end
73
+ end.overridable
74
74
 
75
75
  After do
76
76
  Timecop.return
77
77
  end
78
78
 
79
- end
79
+ end
@@ -42,22 +42,22 @@ When /^(.*) within (.*[^:])$/ do |nested_step, parent|
42
42
  patiently do
43
43
  with_scope(parent) { step(nested_step) }
44
44
  end
45
- end
45
+ end.overridable(priority: 10)
46
46
 
47
47
  # nodoc
48
48
  When /^(.*) within (.*[^:]):$/ do |nested_step, parent, table_or_string|
49
49
  patiently do
50
50
  with_scope(parent) { step("#{nested_step}:", table_or_string) }
51
51
  end
52
- end
52
+ end.overridable(priority: 10)
53
53
 
54
54
  Given /^(?:|I )am on (.+)$/ do |page_name|
55
55
  visit _path_to(page_name)
56
- end
56
+ end.overridable
57
57
 
58
58
  When /^(?:|I )go to (.+)$/ do |page_name|
59
59
  visit _path_to(page_name)
60
- end
60
+ end.overridable
61
61
 
62
62
  Then /^(?:|I )should be on (.+)$/ do |page_name|
63
63
  patiently do
@@ -73,26 +73,26 @@ Then /^(?:|I )should be on (.+)$/ do |page_name|
73
73
 
74
74
  current_path.should == expected_path
75
75
  end
76
- end
76
+ end.overridable
77
77
 
78
78
  When /^(?:|I )press "([^"]*)"$/ do |button|
79
79
  patiently do
80
80
  click_button(button)
81
81
  end
82
- end
82
+ end.overridable
83
83
 
84
84
  When /^(?:|I )follow "([^"]*)"$/ do |link|
85
85
  patiently do
86
86
  click_link(link)
87
87
  end
88
- end
88
+ end.overridable
89
89
 
90
90
  # Fill in text field
91
91
  When /^(?:|I )fill in "([^"]*)" (?:with|for) "([^"]*)"$/ do |field, value|
92
92
  patiently do
93
93
  fill_in(field, :with => value)
94
94
  end
95
- end
95
+ end.overridable
96
96
 
97
97
  # Fill in text field with multi-line block
98
98
  # You can use a doc string to supply multi-line text
@@ -109,49 +109,49 @@ When /^(?:|I )fill in "([^"]*)" (?:with|for):$/ do |field, value|
109
109
  patiently do
110
110
  fill_in(field, :with => value)
111
111
  end
112
- end
112
+ end.overridable
113
113
 
114
114
  # Fill in text field
115
115
  When /^(?:|I )fill in "([^"]*)" (?:with|for) '(.*)'$/ do |field, value|
116
116
  patiently do
117
117
  fill_in(field, :with => value)
118
118
  end
119
- end
119
+ end.overridable
120
120
 
121
121
  # Select from select box
122
122
  When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field|
123
123
  patiently do
124
124
  select(value, :from => field)
125
125
  end
126
- end
126
+ end.overridable
127
127
 
128
128
  # Check a checkbox
129
129
  When /^(?:|I )check "([^"]*)"$/ do |field|
130
130
  patiently do
131
131
  check(field)
132
132
  end
133
- end
133
+ end.overridable
134
134
 
135
135
  # Uncheck a checkbox
136
136
  When /^(?:|I )uncheck "([^"]*)"$/ do |field|
137
137
  patiently do
138
138
  uncheck(field)
139
139
  end
140
- end
140
+ end.overridable
141
141
 
142
142
  # Select a radio button
143
143
  When /^(?:|I )choose "([^"]*)"$/ do |field|
144
144
  patiently do
145
145
  choose(field)
146
146
  end
147
- end
147
+ end.overridable
148
148
 
149
149
  # Attach a file to a file upload form field
150
150
  When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
151
151
  patiently do
152
152
  attach_file(field, File.expand_path(path))
153
153
  end
154
- end
154
+ end.overridable
155
155
 
156
156
  # Checks that some text appears on the page
157
157
  #
@@ -160,7 +160,7 @@ Then /^(?:|I )should see "([^"]*)"$/ do |text|
160
160
  patiently do
161
161
  page.should have_content(text)
162
162
  end
163
- end
163
+ end.overridable
164
164
 
165
165
  # Checks that a regexp appears on the page
166
166
  #
@@ -170,20 +170,20 @@ Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
170
170
  patiently do
171
171
  page.should have_xpath('//*', :text => regexp)
172
172
  end
173
- end
173
+ end.overridable
174
174
 
175
175
  Then /^(?:|I )should not see "([^"]*)"$/ do |text|
176
176
  patiently do
177
177
  page.should have_no_content(text)
178
178
  end
179
- end
179
+ end.overridable
180
180
 
181
181
  Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
182
182
  patiently do
183
183
  regexp = Regexp.new(regexp)
184
184
  page.should have_no_xpath('//*', :text => regexp)
185
185
  end
186
- end
186
+ end.overridable
187
187
 
188
188
 
189
189
  # Checks that an input field contains some value (allowing * as wildcard character)
@@ -204,7 +204,7 @@ Then /^the "([^"]*)" field should (not )?contain "([^"]*)"$/ do |label, negate,
204
204
  end
205
205
  field_value.send(negate ? :should_not : :should, contain_with_wildcards(expected_string))
206
206
  end
207
- end
207
+ end.overridable
208
208
 
209
209
  # Checks that a multiline textarea contains some value (allowing * as wildcard character)
210
210
  Then(/^the "(.*?)" field should (not )?contain:$/) do |label, negate, expected_string|
@@ -212,7 +212,7 @@ Then(/^the "(.*?)" field should (not )?contain:$/) do |label, negate, expected_s
212
212
  field = find_field(label)
213
213
  field.value.chomp.send(negate ? :should_not : :should, contain_with_wildcards(expected_string))
214
214
  end
215
- end
215
+ end.overridable
216
216
 
217
217
  # Checks that a list of label/value pairs are visible as control inputs.
218
218
  #
@@ -227,7 +227,7 @@ Then /^I should see a form with the following values:$/ do |table|
227
227
  expectations.each do |label, expected_value|
228
228
  step %(the "#{label}" field should contain "#{expected_value}")
229
229
  end
230
- end
230
+ end.overridable
231
231
 
232
232
  # Checks that an input field was wrapped with a validation error
233
233
  Then /^the "([^"]*)" field should have the error "([^"]*)"$/ do |field, error_message|
@@ -248,7 +248,7 @@ Then /^the "([^"]*)" field should have the error "([^"]*)"$/ do |field, error_me
248
248
  page.should have_content("#{field.titlecase} #{error_message}")
249
249
  end
250
250
  end
251
- end
251
+ end.overridable
252
252
 
253
253
  Then /^the "([^\"]*)" field should( not)? have an error$/ do |label, negate|
254
254
  patiently do
@@ -257,7 +257,7 @@ Then /^the "([^\"]*)" field should( not)? have an error$/ do |label, negate|
257
257
  field[:id].should be_present # prevent bad CSS selector if field lacks id
258
258
  page.send(expectation, have_css(".field_with_errors ##{field[:id]}"))
259
259
  end
260
- end
260
+ end.overridable
261
261
 
262
262
  Then /^the "([^"]*)" field should have no error$/ do |field|
263
263
  patiently do
@@ -266,7 +266,7 @@ Then /^the "([^"]*)" field should have no error$/ do |field|
266
266
  classes.should_not include('field_with_errors')
267
267
  classes.should_not include('error')
268
268
  end
269
- end
269
+ end.overridable
270
270
 
271
271
  # nodoc
272
272
  Then /^the "([^"]*)" checkbox should( not)? be checked$/ do |label, negate|
@@ -276,13 +276,13 @@ Then /^the "([^"]*)" checkbox should( not)? be checked$/ do |label, negate|
276
276
  field = find_field(label)
277
277
  field.send expectation, be_checked
278
278
  end
279
- end
279
+ end.overridable
280
280
 
281
281
  Then /^the radio button "([^"]*)" should( not)? be (?:checked|selected)$/ do |field, negate|
282
282
  patiently do
283
283
  page.send((negate ? :has_no_checked_field? : :has_checked_field?), field).should == true
284
284
  end
285
- end
285
+ end.overridable
286
286
 
287
287
  # Example:
288
288
  #
@@ -300,12 +300,12 @@ Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
300
300
 
301
301
  actual_params.should == expected_params
302
302
  end
303
- end
303
+ end.overridable
304
304
 
305
305
  # Open the current Capybara page using the `launchy` gem
306
306
  Then /^show me the page$/ do
307
307
  save_and_open_page
308
- end
308
+ end.overridable
309
309
 
310
310
 
311
311
  # Checks for the existance of an input field (given its id or label)
@@ -319,7 +319,7 @@ Then /^I should( not)? see a field "([^"]*)"$/ do |negate, name|
319
319
  end
320
320
  field.send(expectation, be_present)
321
321
  end
322
- end
322
+ end.overridable
323
323
 
324
324
  # Use this step to test for a number or money amount instead of a simple `Then I should see`
325
325
  #
@@ -334,24 +334,24 @@ Then /^I should( not)? see the (?:number|amount) ([\-\d,\.]+)(?: (.*?))?$/ do |n
334
334
  patiently do
335
335
  page.body.send(expectation, match(regexp))
336
336
  end
337
- end
337
+ end.overridable
338
338
 
339
339
  # Checks `Content-Type` HTTP header
340
340
  Then /^I should get a response with content-type "([^\"]*)"$/ do |expected_content_type|
341
341
  page.response_headers['Content-Type'].should =~ /\A#{Regexp.quote(expected_content_type)}($|;)/
342
- end
342
+ end.overridable
343
343
 
344
344
  # Checks `Content-Disposition` HTTP header
345
345
  #
346
346
  # Attention: Doesn't work with Selenium, see https://github.com/jnicklas/capybara#gotchas
347
347
  Then /^I should get a download with filename "([^\"]*)"$/ do |filename|
348
348
  page.response_headers['Content-Disposition'].should =~ /filename="#{filename}"$/
349
- end
349
+ end.overridable
350
350
 
351
351
  # Checks that a certain option is selected for a text field
352
352
  Then /^"([^"]*)" should be selected for "([^"]*)"$/ do |value, field|
353
353
  step %(the "#{field}" field should contain "#{value}")
354
- end
354
+ end.overridable
355
355
 
356
356
  Then /^nothing should be selected for "([^"]*)"?$/ do |field|
357
357
  patiently do
@@ -361,7 +361,7 @@ Then /^nothing should be selected for "([^"]*)"?$/ do |field|
361
361
  rescue Capybara::ElementNotFound
362
362
  end
363
363
  end
364
- end
364
+ end.overridable
365
365
 
366
366
  # Checks for the presence of an option in a select
367
367
  Then /^"([^"]*)" should( not)? be an option for "([^"]*)"$/ do |value, negate, field|
@@ -376,7 +376,7 @@ Then /^"([^"]*)" should( not)? be an option for "([^"]*)"$/ do |value, negate, f
376
376
  field_labeled(field).find(:xpath, xpath).should be_present
377
377
  end
378
378
  end
379
- end
379
+ end.overridable
380
380
 
381
381
  # Like `Then I should see`, but with single instead of double quotes. In case
382
382
  # the expected string contains quotes as well.
@@ -384,32 +384,32 @@ Then /^(?:|I )should see '([^']*)'$/ do |text|
384
384
  patiently do
385
385
  page.should have_content(text)
386
386
  end
387
- end
387
+ end.overridable
388
388
 
389
389
  # Check that the raw HTML contains a string
390
390
  Then /^I should see "([^\"]*)" in the HTML$/ do |text|
391
391
  patiently do
392
392
  page.body.should include(text)
393
393
  end
394
- end
394
+ end.overridable
395
395
 
396
396
  Then /^I should not see "([^\"]*)" in the HTML$/ do |text|
397
397
  patiently do
398
398
  page.body.should_not include(text)
399
399
  end
400
- end
400
+ end.overridable
401
401
 
402
402
  # Checks that status code is 400..599
403
403
  Then /^I should see an error$/ do
404
404
  (400 .. 599).should include(page.status_code)
405
- end
405
+ end.overridable
406
406
 
407
407
  #nodoc
408
408
  Then /^the window should be titled "([^"]*)"$/ do |title|
409
409
  patiently do
410
410
  page.should have_css('title', :text => title)
411
411
  end
412
- end
412
+ end.overridable
413
413
 
414
414
  When /^I reload the page$/ do
415
415
  case Capybara::current_driver
@@ -420,7 +420,7 @@ When /^I reload the page$/ do
420
420
  else
421
421
  visit current_path
422
422
  end
423
- end
423
+ end.overridable
424
424
 
425
425
  # Checks that an element is actually present and visible, also considering styles.
426
426
  # Within a selenium test, the browser is asked whether the element is really visible
@@ -431,14 +431,14 @@ end
431
431
  # More details [here](https://makandracards.com/makandra/1049-capybara-check-that-a-page-element-is-hidden-via-css)
432
432
  Then /^(the tag )?"([^\"]+)" should( not)? be visible$/ do |tag, selector_or_text, hidden|
433
433
  if hidden
434
- warn "The step 'Then ... should not be visible' is ambiguous. Please use 'Then ... should be hidden' or 'Then I should not see ...' instead."
434
+ warn "The step 'Then ... should not be visible' is prone to misunderstandgs. Please use 'Then ... should be hidden' or 'Then I should not see ...' instead."
435
435
  end
436
436
 
437
437
  options = {}
438
438
  tag ? options.store(:selector, selector_or_text) : options.store(:text, selector_or_text)
439
439
 
440
440
  hidden ? assert_hidden(options) : assert_visible(options)
441
- end
441
+ end.overridable
442
442
 
443
443
  # Checks that an element is actually present and hidden, also considering styles.
444
444
  # Within a selenium test, the browser is asked whether the element is really hidden.
@@ -448,7 +448,7 @@ Then /^(the tag )?"([^\"]+)" should be hidden$/ do |tag, selector_or_text|
448
448
  tag ? options.store(:selector, selector_or_text) : options.store(:text, selector_or_text)
449
449
 
450
450
  assert_hidden(options)
451
- end
451
+ end.overridable
452
452
 
453
453
  # Click on some text that might not be a link.
454
454
  #
@@ -463,7 +463,7 @@ When /^I click on "([^\"]+)"$/ do |text|
463
463
  element = page.find(:xpath, ".//*[#{contains_text} and not (./*[#{contains_text}])]")
464
464
  element.click
465
465
  end
466
- end
466
+ end.overridable
467
467
 
468
468
  # Click on an element with the given selector.
469
469
  #
@@ -475,7 +475,7 @@ When /^I click on the element "([^"]+)"$/ do |selector|
475
475
  patiently do
476
476
  page.find(selector).click
477
477
  end
478
- end
478
+ end.overridable
479
479
 
480
480
  # Click on the element with the given [selector alias](https://github.com/makandra/spreewald/blob/master/examples/selectors.rb).
481
481
  #
@@ -487,7 +487,7 @@ When /^I click on the element for (.+?)$/ do |locator|
487
487
  selector = _selector_for(locator)
488
488
  page.find(selector).click
489
489
  end
490
- end
490
+ end.overridable
491
491
 
492
492
  # Use this step to check external links.
493
493
  #
@@ -500,7 +500,7 @@ Then /^"([^"]*)" should link to "([^"]*)"$/ do |link_label, target|
500
500
  link = find_link(link_label)
501
501
  link[:href].should =~ /#{Regexp.escape target}(\?[^\/]*)?$/ # ignore trailing timestamps
502
502
  end
503
- end
503
+ end.overridable
504
504
 
505
505
  # Check that an element with the given selector is present on the page.
506
506
  #
@@ -515,7 +515,7 @@ Then /^I should (not )?see an element "([^"]+)"$/ do |negate, selector|
515
515
  patiently do
516
516
  page.send(expectation, have_css(selector))
517
517
  end
518
- end
518
+ end.overridable
519
519
 
520
520
  # Check that an element with the given [selector alias](https://github.com/makandra/spreewald/blob/master/examples/selectors.rb) is present on the page.
521
521
  #
@@ -531,13 +531,13 @@ Then /^I should (not )?see an element for (.*?)$/ do |negate, locator|
531
531
  patiently do
532
532
  page.send(expectation, have_css(selector))
533
533
  end
534
- end
534
+ end.overridable
535
535
 
536
536
 
537
537
  # Checks that the result has content type `text/plain`
538
538
  Then /^I should get a text response$/ do
539
539
  step 'I should get a response with content-type "text/plain"'
540
- end
540
+ end.overridable
541
541
 
542
542
  # Click a link within an element matching the given selector. Will try to be clever
543
543
  # and disregard elements that don't contain a matching link.
@@ -549,12 +549,12 @@ end
549
549
  When /^I follow "([^"]*)" inside any "([^"]*)"$/ do |label, selector|
550
550
  node = find("#{selector} a", :text => label)
551
551
  node.click
552
- end
552
+ end.overridable
553
553
 
554
554
  Then /^I should( not)? see "([^"]*)" inside any "([^"]*)"$/ do |negate, text, selector|
555
555
  expectation = negate ? :should_not : :should
556
556
  page.send(expectation, have_css(selector, :text => text))
557
- end
557
+ end.overridable
558
558
 
559
559
  When /^I fill in "([^"]*)" with "([^"]*)" inside any "([^"]*)"$/ do |field, value, selector|
560
560
  containers = all(:css, selector)
@@ -567,19 +567,19 @@ When /^I fill in "([^"]*)" with "([^"]*)" inside any "([^"]*)"$/ do |field, valu
567
567
  else
568
568
  raise "Could not find an input field \"#{field}\" inside any \"#{selector}\""
569
569
  end
570
- end
570
+ end.overridable
571
571
 
572
572
  When /^I confirm the browser dialog$/ do
573
573
  patiently do
574
574
  page.driver.browser.switch_to.alert.accept
575
575
  end
576
- end
576
+ end.overridable
577
577
 
578
578
  When /^I cancel the browser dialog$/ do
579
579
  patiently do
580
580
  page.driver.browser.switch_to.alert.dismiss
581
581
  end
582
- end
582
+ end.overridable
583
583
 
584
584
  When /^I enter "([^"]*)" into the browser dialog$/ do |text|
585
585
  patiently do
@@ -587,12 +587,12 @@ When /^I enter "([^"]*)" into the browser dialog$/ do |text|
587
587
  alert.send_keys(text)
588
588
  alert.accept
589
589
  end
590
- end
590
+ end.overridable
591
591
 
592
592
  When /^I switch to the new tab$/ do
593
593
  Capybara::current_driver == :selenium or raise("This step works only with selenium")
594
594
  page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
595
- end
595
+ end.overridable
596
596
 
597
597
  # Checks that these strings are rendered in the given order in a single line or in multiple lines
598
598
  #
@@ -616,7 +616,7 @@ Then /^I should see in this order:?$/ do |text|
616
616
  patiently do
617
617
  page.text.gsub(/\s+/, ' ').should =~ pattern
618
618
  end
619
- end
619
+ end.overridable
620
620
 
621
621
  # Tests that an input or button with the given label is disabled.
622
622
  Then /^the "([^\"]*)" (field|button) should( not)? be disabled$/ do |label, kind, negate|
@@ -626,7 +626,7 @@ Then /^the "([^\"]*)" (field|button) should( not)? be disabled$/ do |label, kind
626
626
  element = find_button(label)
627
627
  end
628
628
  ["false", "", nil].send(negate ? :should : :should_not, include(element[:disabled]))
629
- end
629
+ end.overridable
630
630
 
631
631
  # Tests that a field with the given label is visible.
632
632
  Then /^the "([^\"]*)" field should( not)? be visible$/ do |label, hidden|
@@ -647,7 +647,7 @@ Then /^the "([^\"]*)" field should( not)? be visible$/ do |label, hidden|
647
647
  expectation = hidden ? :should_not : :should
648
648
  field.send(expectation, be_visible)
649
649
  end
650
- end
650
+ end.overridable
651
651
 
652
652
  # Waits for the page to finish loading and AJAX requests to finish.
653
653
  #
@@ -660,7 +660,7 @@ When /^I wait for the page to load$/ do
660
660
  end
661
661
  end
662
662
  page.has_content? ''
663
- end
663
+ end.overridable
664
664
 
665
665
  # Performs HTTP basic authentication with the given credentials and visits the given path.
666
666
  #
@@ -679,7 +679,7 @@ When /^I perform basic authentication as "([^\"]*)\/([^\"]*)" and go to (.*)$/ d
679
679
  authorizer.basic_authorize(user, password)
680
680
  visit path
681
681
  end
682
- end
682
+ end.overridable
683
683
 
684
684
  # Goes to the previously viewed page.
685
685
  When /^I go back$/ do
@@ -693,7 +693,7 @@ When /^I go back$/ do
693
693
  visit page.driver.last_request.env['HTTP_REFERER']
694
694
  end
695
695
  end
696
- end
696
+ end.overridable
697
697
 
698
698
  # Tests whether a select field is sorted. Uses Array#natural_sort, if defined;
699
699
  # Array#sort else.
@@ -703,4 +703,4 @@ Then /^the "(.*?)" select should( not)? be sorted$/ do |label, negate|
703
703
  option_texts = options.collect(&:text)
704
704
 
705
705
  option_texts.send((negate ? :should_not : :should), be_sorted)
706
- end
706
+ end.overridable
@@ -1,3 +1,3 @@
1
1
  module Spreewald
2
- VERSION = '1.4.0'
2
+ VERSION = '1.5.0'
3
3
  end
@@ -17,7 +17,6 @@ Gem::Specification.new do |gem|
17
17
  gem.require_paths = ["lib"]
18
18
  gem.version = Spreewald::VERSION
19
19
 
20
- gem.add_runtime_dependency('cucumber-rails')
21
- gem.add_runtime_dependency('cucumber')
22
- gem.add_runtime_dependency('capybara')
20
+ gem.add_dependency('cucumber')
21
+ gem.add_dependency('cucumber_priority')
23
22
  end
@@ -5,6 +5,7 @@ gem "sqlite3", :platform=>:ruby
5
5
  gem 'ruby-debug', :platforms => :ruby_18
6
6
  gem 'database_cleaner'
7
7
  gem 'capybara', "~>1" # for ruby 1.8.7 compatibility
8
+ gem 'cucumber-rails'
8
9
  gem 'cucumber', '1.3.2' # 1.3.3 uses an API that slimgems does not provide
9
10
  gem 'selenium-webdriver'
10
11
 
@@ -1,10 +1,9 @@
1
1
  PATH
2
2
  remote: ../../..
3
3
  specs:
4
- spreewald (1.3.3)
5
- capybara
4
+ spreewald (1.4.0)
6
5
  cucumber
7
- cucumber-rails
6
+ cucumber_priority
8
7
 
9
8
  GEM
10
9
  remote: https://rubygems.org/
@@ -59,6 +58,9 @@ GEM
59
58
  cucumber (>= 1.2.0)
60
59
  nokogiri (>= 1.5.0)
61
60
  rails (>= 3.0.0)
61
+ cucumber_priority (0.1.1)
62
+ activesupport
63
+ cucumber
62
64
  database_cleaner (1.0.1)
63
65
  diff-lcs (1.2.4)
64
66
  erubis (2.7.0)
@@ -156,6 +158,7 @@ PLATFORMS
156
158
  DEPENDENCIES
157
159
  capybara (~> 1)
158
160
  cucumber (= 1.3.2)
161
+ cucumber-rails
159
162
  database_cleaner
160
163
  haml-rails
161
164
  rails (~> 3.2)
@@ -6,6 +6,7 @@ gem 'ruby-debug', :platforms => :ruby_18
6
6
  gem 'database_cleaner'
7
7
  gem 'launchy'
8
8
  gem 'capybara'#, "~>2"
9
+ gem 'cucumber-rails'
9
10
  gem 'cucumber'#, '1.3.2' # 1.3.3 uses an API that slimgems does not provide
10
11
  gem 'selenium-webdriver'
11
12
 
@@ -1,10 +1,9 @@
1
1
  PATH
2
2
  remote: ../../..
3
3
  specs:
4
- spreewald (1.3.3)
5
- capybara
4
+ spreewald (1.4.0)
6
5
  cucumber
7
- cucumber-rails
6
+ cucumber_priority
8
7
 
9
8
  GEM
10
9
  remote: https://rubygems.org/
@@ -59,6 +58,9 @@ GEM
59
58
  cucumber (>= 1.2.0)
60
59
  nokogiri (>= 1.5.0)
61
60
  rails (>= 3.0.0)
61
+ cucumber_priority (0.1.1)
62
+ activesupport
63
+ cucumber
62
64
  database_cleaner (1.0.1)
63
65
  diff-lcs (1.2.4)
64
66
  erubis (2.7.0)
@@ -160,6 +162,7 @@ PLATFORMS
160
162
  DEPENDENCIES
161
163
  capybara
162
164
  cucumber
165
+ cucumber-rails
163
166
  database_cleaner
164
167
  haml-rails
165
168
  launchy
@@ -0,0 +1,5 @@
1
+ Feature: Overriding Spreewald-steps
2
+
3
+ Scenario: The developer should be able to override any Spreewald step without Cucumber raising Cucumber::Ambiguous
4
+ When I go to "/static_pages/overridden"
5
+ Then I should see "overridden value"
@@ -0,0 +1,3 @@
1
+ Then /^I should see "overridden value"$/ do
2
+ page.should have_content('overridden value')
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spreewald
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Kraze
@@ -10,20 +10,6 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2015-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: cucumber-rails
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: cucumber
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +25,7 @@ dependencies:
39
25
  - !ruby/object:Gem::Version
40
26
  version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
- name: capybara
28
+ name: cucumber_priority
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - ">="
@@ -147,6 +133,7 @@ files:
147
133
  - tests/shared/app/views/static_pages/click_on.html.haml
148
134
  - tests/shared/app/views/static_pages/home.html.haml
149
135
  - tests/shared/app/views/static_pages/link_to_home.html.haml
136
+ - tests/shared/app/views/static_pages/overridden.html.haml
150
137
  - tests/shared/app/views/static_pages/see_element.html.haml
151
138
  - tests/shared/app/views/static_pages/visibility.html.haml
152
139
  - tests/shared/app/views/static_pages/within.html.haml
@@ -155,6 +142,8 @@ files:
155
142
  - tests/shared/config/database.yml
156
143
  - tests/shared/db/migrate/.gitignore
157
144
  - tests/shared/features/shared/email_steps.feature
145
+ - tests/shared/features/shared/overriding.feature
146
+ - tests/shared/features/shared/step_definitions/overriding_steps.rb
158
147
  - tests/shared/features/shared/step_definitions/test_steps.rb
159
148
  - tests/shared/features/shared/table_steps.feature
160
149
  - tests/shared/features/shared/web_steps.feature
@@ -248,6 +237,7 @@ test_files:
248
237
  - tests/shared/app/views/static_pages/click_on.html.haml
249
238
  - tests/shared/app/views/static_pages/home.html.haml
250
239
  - tests/shared/app/views/static_pages/link_to_home.html.haml
240
+ - tests/shared/app/views/static_pages/overridden.html.haml
251
241
  - tests/shared/app/views/static_pages/see_element.html.haml
252
242
  - tests/shared/app/views/static_pages/visibility.html.haml
253
243
  - tests/shared/app/views/static_pages/within.html.haml
@@ -256,6 +246,8 @@ test_files:
256
246
  - tests/shared/config/database.yml
257
247
  - tests/shared/db/migrate/.gitignore
258
248
  - tests/shared/features/shared/email_steps.feature
249
+ - tests/shared/features/shared/overriding.feature
250
+ - tests/shared/features/shared/step_definitions/overriding_steps.rb
259
251
  - tests/shared/features/shared/step_definitions/test_steps.rb
260
252
  - tests/shared/features/shared/table_steps.feature
261
253
  - tests/shared/features/shared/web_steps.feature