spreewald 2.99.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e40a203a4efe394c63dfe3513bcbee6fd9b2c03adeb6a2da742083f8e1916db
4
- data.tar.gz: a3607b851a21bbed752f0abcb07a0f492efeb03d7bcf9dab65df2ee4049fbd30
3
+ metadata.gz: 64749212dae1262a16bb92a588740444cf7ede78c5980fbdf15f66271a4b081d
4
+ data.tar.gz: 7384baaed65e17289ff4d4c52874e1c257b315b0e9026fac51bbea9a414f4141
5
5
  SHA512:
6
- metadata.gz: 44e4db7d78e098e62fde16d7c912dd761384fde5d131d3dc9b92c7ff960ef60b36e284b9aba8f125ae61c1a36ba9a05c73715b39ae36ec735e285f8eae76baef
7
- data.tar.gz: cabe0d013bdbeebd4e250ea73437e15b8de88bca1bfdb6d331fb9521ecda26d8f8fe74e7e7f8e4f150bec938c8d6099cc17823b09f7bf97650021a7cca2d9398
6
+ metadata.gz: e06ba20e5252696bd8ce7aecb6f3a6f9f21eb16c3e2f7ba2cb6223bdfdfdf1cb05c34ada79e06bcd94631ea7288e802fab3f9cce98f8d59d34f7b0b9117300c3
7
+ data.tar.gz: d09e69ad26c4e76a09bfaa44989bcd870b1eb160de410be081bf0d40889e3a7ffc901e02c7e208538e8c92719752a3cb7fa396a9f7dada600c257dcbcf72fef3
@@ -3,6 +3,42 @@ 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
+ ## 3.0.0
7
+
8
+ ### Breaking changes
9
+
10
+ - The following steps have been removed:
11
+ - `/^the file "([^"]*)" was attached(?: as (?:([^"]*)\/)?([^"]*))? to the ([^"]*) above(?: at "([^"]*)")?$/` (see [#106](https://github.com/makandra/spreewald/issues/106), this functionality was moved to [CucumberFactory](https://github.com/makandra/cucumber_factory))
12
+ - `/^the "([^"]*)" field should have no error$/` (see [#134](https://github.com/makandra/spreewald/issues/134))
13
+ - `/^I should get a text response$/` (see [#135](https://github.com/makandra/spreewald/issues/135))
14
+ - `/^I wait for the page to load$/` (see [#136](https://github.com/makandra/spreewald/issues/136))
15
+ - `debugger` (was an alias for `console`)
16
+ - These email steps have been removed in favor of `(an?|no)( HTML| plain-text|) e?mail should have been sent with:` (see [#132](https://github.com/makandra/spreewald/issues/132#issuecomment-631457290)):
17
+ - `/^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]+"|cc "[^"]+"|to "[^"]+"|the subject "[^"]+"|the body "[^"]+"|the attachments "[^"]+")+)$/`
18
+ - `/^that e?mail should( not)? have the following lines in the body$/`
19
+ - `/^that e?mail should have the following (?:|content in the )body:$/`
20
+ - The `and disabled` modifier of the step `the "..." checkbox should( not)? be checked` has been removed. Use the step without the modifier together with the step `the "..." checkbox should be disabled` to achieve the old behavior.
21
+ - The step `/^(the tag )?"([^\"]+)" should( not)? be visible$/` lost its `not` modifier (Use `Then (the tag )?"..." should be hidden` or `Then I should not see "..."`)
22
+ - The file `lib/spreewald/timecop_steps.rb` was removed (was an alias for `lib/spreewald/time_steps.rb`).
23
+ - The step `(an?|no)( HTML| plain-text|) e?mail should have been sent with:` does now require that the whole body is matched.
24
+ - All web steps interacting with forms will now find both enabled and disabled fields. We encourage you to assert the "disabled" state in a separate step when needed, Spreewald offers these steps as well.
25
+
26
+ The following steps have been adjusted:
27
+ - `I should( not)? see a field "..."`
28
+ - `the "..." field should( not)? contain "..."`
29
+ - `I should see a form with the following values:`
30
+ - `the "..." field should have the error "..."`
31
+ - `the "..." field should( not)? have an error`
32
+ - `the "..." checkbox should( not)? be checked`
33
+ - `"..." should be selected for "..."`
34
+ - `nothing should be selected for "..."`
35
+ - `"..." should( not)? be an option for "..."`
36
+ - `the "..." field should( not)? be visible`
37
+ - `the "..." select should( not)? be sorted`
38
+
39
+ ### Compatible changes
40
+ - Reintroduced support for emails with CRLF line ending
41
+
6
42
  ## 2.99.0
7
43
  - The following steps were deprecated and will be removed in the upcoming major version:
8
44
  - `/^the "([^"]*)" field should have no error$/` (see [#134](https://github.com/makandra/spreewald/issues/134))
data/README.md CHANGED
@@ -197,8 +197,7 @@ the step definitions.
197
197
  * **Then console**
198
198
 
199
199
  Pauses test execution and opens an IRB shell with current context. Does not halt the application-
200
- under-test. (Replaces the "Then debugger" step that has never been adequate
201
- for its job)
200
+ under-test.
202
201
 
203
202
 
204
203
  * **AfterStep @slow-motion**
@@ -238,9 +237,6 @@ the step definitions.
238
237
 
239
238
  """
240
239
 
241
- Because of backwards-compatibility, the body currently only has to be a prefix
242
- of the real body. However, this is deprecated and will be removed in a future
243
- version. Use wildcards instead.
244
240
  You may skip lines in the header, of course.
245
241
 
246
242
 
@@ -269,13 +265,6 @@ the step definitions.
269
265
  This uses the same syntax as `Then an email should have been sent with:`
270
266
 
271
267
 
272
- ### file_attachment_steps.rb
273
-
274
- * **Given the file "..." was attached( as (.../)?...)? to the ... above( at "...")?**
275
-
276
- This step is deprecated and will be removed from spreewald. If you still want to use it, copy the code to your project's own steps.
277
-
278
-
279
268
  ### session_steps.rb
280
269
 
281
270
  * **When ... in the browser session "..."**
@@ -330,8 +319,6 @@ Please note that the two approaches branch. While ActiveSupport will freeze the
330
319
  When it is a few hours earlier
331
320
 
332
321
 
333
-
334
-
335
322
  ### web_steps.rb
336
323
 
337
324
  Most of cucumber-rails' original web steps plus a few of our own.
@@ -559,10 +546,7 @@ deprecation notice. Decide for yourself whether you want to use them:
559
546
  * **Then the "..." field should( not)? have an error**
560
547
 
561
548
 
562
- * **Then the "..." field should have no error**
563
-
564
-
565
- * **Then the "..." checkbox should( not)? be checked( and disabled)?**
549
+ * **Then the "..." checkbox should( not)? be checked?**
566
550
 
567
551
 
568
552
  * **Then the radio button "..." should( not)? be (checked|selected)**
@@ -615,14 +599,12 @@ deprecation notice. Decide for yourself whether you want to use them:
615
599
  * **When I reload the page**
616
600
 
617
601
 
618
- * **Then (the tag )?"..." should( not)? be visible**
602
+ * **Then (the tag )?"..." should be visible**
619
603
 
620
604
  Checks that an element is actually present and visible, also considering styles.
621
605
  Within a selenium test, the browser is asked whether the element is really visible
622
606
  In a non-selenium test, we only check for `.hidden`, `.invisible` or `style: display:none`
623
607
 
624
- The step 'Then (the tag )?"..." should **not** be visible' is ambiguous. Please use 'Then (the tag )?"..." should be hidden' or 'Then I should not see "..."' instead. Note that the **not** option will be removed in future versions of Spreewald.
625
-
626
608
  More details [here](https://makandracards.com/makandra/1049-capybara-check-that-a-page-element-is-hidden-via-css)
627
609
 
628
610
 
@@ -675,11 +657,6 @@ deprecation notice. Decide for yourself whether you want to use them:
675
657
  got: "http://makandra.com/" (using =~)
676
658
 
677
659
 
678
- * **Then I should get a text response**
679
-
680
- Checks that the result has content type `text/plain`
681
-
682
-
683
660
  * **When I follow "..." inside any "..."**
684
661
 
685
662
  Click a link within an element matching the given selector. Will try to be clever
@@ -715,13 +692,6 @@ deprecation notice. Decide for yourself whether you want to use them:
715
692
  Tests that a field with the given label is visible.
716
693
 
717
694
 
718
- * **When I wait for the page to load**
719
-
720
- Waits for the page to finish loading and AJAX requests to finish.
721
-
722
- More details [here](https://makandracards.com/makandra/12139-waiting-for-page-loads-and-ajax-requests-to-finish-with-capybara).
723
-
724
-
725
695
  * **When I perform basic authentication as ".../..." and go to ...**
726
696
 
727
697
  Performs HTTP basic authentication with the given credentials and visits the given path.
@@ -240,7 +240,7 @@ Feature: The `spreewald` binary
240
240
 
241
241
  Scenario: Print version
242
242
  When I run `spreewald --version`
243
- Then the output should contain "Spreewald 2."
243
+ Then the output should contain "Spreewald 3."
244
244
 
245
245
  When I run `spreewald -v`
246
- Then the output should contain "Spreewald 2."
246
+ Then the output should contain "Spreewald 3."
@@ -5,15 +5,8 @@ Then /^it should work(.+?)?$/ do |message|
5
5
  pending(message)
6
6
  end.overridable
7
7
 
8
- # nodoc
9
- Then 'debugger' do
10
- warn 'The step "Then debugger" will be removed in future versions of Spreewald. Please use "Then console" instead.'
11
- step 'console' # Alias
12
- end.overridable
13
-
14
8
  # Pauses test execution and opens an IRB shell with current context. Does not halt the application-
15
- # under-test. (Replaces the "Then debugger" step that has never been adequate
16
- # for its job)
9
+ # under-test.
17
10
  Then 'console' do
18
11
  require 'irb'
19
12
  ARGV.clear # IRB takes ARGV as its own arguments
@@ -30,9 +30,6 @@ end.overridable
30
30
  #
31
31
  # """
32
32
  #
33
- # Because of backwards-compatibility, the body currently only has to be a prefix
34
- # of the real body. However, this is deprecated and will be removed in a future
35
- # version. Use wildcards instead.
36
33
  # You may skip lines in the header, of course.
37
34
  Then /^(an?|no)( HTML| plain-text|) e?mail should have been sent with:$/ do |mode, type, raw_data|
38
35
  patiently do
@@ -70,26 +67,6 @@ ERROR
70
67
  end
71
68
  end.overridable
72
69
 
73
- # nodoc (deprecated)
74
- Then /^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]+"|cc "[^"]+"|to "[^"]+"|the subject "[^"]+"|the body "[^"]+"|the attachments "[^"]+")+)$/ do |mode, query|
75
- warn "The step `an email should have been sent (from ...) (to ...) (cc ...) ...` has been deprecated in favor of `(an?|no)( HTML| plain-text|) e?mail should have been sent with:`"
76
- patiently do
77
- filename_method = Rails::VERSION::MAJOR < 3 ? 'original_filename' : 'filename'
78
- @mail = ActionMailer::Base.deliveries.find do |mail|
79
- [ query =~ /to "([^"]+)"/ && !mail.to.include?(MailFinder.resolve_email $1),
80
- query =~ /cc "([^"]+)"/ && !mail.cc.include?(MailFinder.resolve_email $1),
81
- query =~ /bcc "([^"]+)"/ && !mail.bcc.include?(MailFinder.resolve_email $1),
82
- query =~ /from "([^"]+)"/ && !mail.from.include?(MailFinder.resolve_email $1),
83
- query =~ /reply_to "([^"]+)"/ && !mail.reply_to.include?(MailFinder.resolve_email $1),
84
- query =~ /subject "([^"]+)"/ && !mail.subject.include?($1),
85
- query =~ /the attachments "([^"]+)"/ && $1.split(/\s*,\s*/).sort != Array(mail.attachments).collect(&:"#{filename_method}").sort
86
- ].none?
87
- end
88
- expectation = mode == 'no' ? 'not_to' : 'to'
89
- expect(@mail).send(expectation, be_present)
90
- end
91
- end.overridable
92
-
93
70
  # Please note that this step will only follow HTTP and HTTPS links.
94
71
  # Other links (such as mailto: or ftp:// links) are ignored.
95
72
  When /^I follow the (first|second|third)? ?link in the e?mail$/ do |index_in_words|
@@ -141,22 +118,3 @@ Then /^show me the e?mail( header)?s with:$/ do |only_header, raw_data|
141
118
 
142
119
  print MailFinder.show_mails(results.mails, only_header)
143
120
  end.overridable
144
-
145
- # nodoc (deprecated)
146
- Then /^that e?mail should( not)? have the following lines in the body:$/ do |negate, body|
147
- warn "The step /^that e?mail should( not)? have the following lines in the body:$/ has been deprecated in favor of the updated step /^(an?|no)( HTML| plain-text|) e?mail should have been sent with:$/."
148
- expectation = negate ? 'not_to' : 'to'
149
- mail = @mail || ActionMailer::Base.deliveries.last
150
- email_text_body = MailFinder.email_text_body(mail)
151
-
152
- body.to_s.strip.split(/\n/).each do |line|
153
- expect(email_text_body).send(expectation, include(line.strip))
154
- end
155
- end.overridable
156
-
157
- # nodoc (deprecated)
158
- Then /^that e?mail should have the following (?:|content in the )body:$/ do |body|
159
- warn "The step /^that e?mail should have the following( content in the)? body:$/ has been deprecated in favor of the updated step /^(an?|no)( HTML| plain-text|) e?mail should have been sent with:$/."
160
- mail = @mail || ActionMailer::Base.deliveries.last
161
- expect(MailFinder.email_text_body(mail)).to include(body.strip)
162
- end.overridable
@@ -201,10 +201,10 @@ Then /^I should( not)? see a field "([^"]*)"$/ do |negate, name|
201
201
  expectation = negate ? :not_to : :to
202
202
  patiently do
203
203
  begin
204
- # In old Capybaras find_field returns nil, so we assign it to `field`
205
- field = find_field(name)
204
+ # In old Capybaras find returns nil, so we assign it to `field`
205
+ field = find_with_disabled(:field, name)
206
206
  rescue Capybara::ElementNotFound
207
- # In Capybara 0.4+ #find_field raises an error instead of returning nil
207
+ # In Capybara 0.4+ #find raises an error instead of returning nil
208
208
  # We must explicitely reset the field variable from a previous patiently iteration
209
209
  field = nil
210
210
  end
@@ -327,7 +327,7 @@ end.overridable
327
327
  # Checks that an input field contains some value (allowing * as wildcard character)
328
328
  Then /^the "([^"]*)" field should (not )?contain "([^"]*)"$/ do |label, negate, expected_string|
329
329
  patiently do
330
- field = find_field(label)
330
+ field = find_with_disabled(:field, label)
331
331
  field_value = case field.tag_name
332
332
  when 'select'
333
333
  options = field.all('option')
@@ -347,7 +347,7 @@ end.overridable
347
347
  # Checks that a multiline textarea contains some value (allowing * as wildcard character)
348
348
  Then(/^the "(.*?)" field should (not )?contain:$/) do |label, negate, expected_string|
349
349
  patiently do
350
- field = find_field(label)
350
+ field = find_with_disabled(:field, label)
351
351
  expect(field.value.chomp).send(negate ? :not_to : :to, contain_with_wildcards(expected_string))
352
352
  end
353
353
  end.overridable
@@ -369,7 +369,7 @@ end.overridable
369
369
  # Checks that an input field was wrapped with a validation error
370
370
  Then /^the "([^"]*)" field should have the error "([^"]*)"$/ do |field, error_message|
371
371
  patiently do
372
- element = find_field(field)
372
+ element = find_with_disabled(:field, field)
373
373
  classes = element.find(:xpath, '..')[:class].split(' ')
374
374
 
375
375
  form_for_input = element.find(:xpath, 'ancestor::form[1]')
@@ -390,35 +390,17 @@ end.overridable
390
390
  Then /^the "([^\"]*)" field should( not)? have an error$/ do |label, negate|
391
391
  patiently do
392
392
  expectation = negate ? :not_to : :to
393
- field = find_field(label)
393
+ field = find_with_disabled(:field, label)
394
394
  expect(field[:id]).to be_present # prevent bad CSS selector if field lacks id
395
395
  expect(page).send(expectation, have_css(".field_with_errors ##{field[:id]}"))
396
396
  end
397
397
  end.overridable
398
398
 
399
- Then /^the "([^"]*)" field should have no error$/ do |field|
400
- warn 'The step /^the "([^"]*)" field should have no error$/ is deprecated and scheduled for removal. Use the step /^the "([^\"]*)" field should( not)? have an error$/ instead.'
401
- patiently do
402
- element = find_field(field)
403
- classes = element.find(:xpath, '..')[:class].split(' ')
404
- expect(classes).not_to include('field_with_errors')
405
- expect(classes).not_to include('error')
406
- end
407
- end.overridable
408
-
409
- Then /^the "([^"]*)" checkbox should( not)? be checked( and disabled)?$/ do |label, negate, disabled|
399
+ Then /^the "([^"]*)" checkbox should( not)? be checked?$/ do |label, negate|
410
400
  expectation = negate ? :not_to : :to
411
401
 
412
- if disabled
413
- warn 'The step /^the "([^"]*)" checkbox should( not)? be checked( and disabled)?$/ will lose the `and disabled` modifier in Spreewald 3. In that version, the step will find a checkbox regardless of whether it is disabled.'
414
- end
415
-
416
402
  patiently do
417
- field = if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "2.1")
418
- find_field(label)
419
- else
420
- find_field(label, :disabled => !!disabled)
421
- end
403
+ field = find_with_disabled(:field, label)
422
404
  expect(field).send expectation, be_checked
423
405
  end
424
406
  end.overridable
@@ -489,7 +471,7 @@ end.overridable
489
471
 
490
472
  Then /^nothing should be selected for "([^"]*)"$/ do |field|
491
473
  patiently do
492
- select = find_field(field)
474
+ select = find_with_disabled(:field, field)
493
475
  begin
494
476
  selected_option = select.find(:xpath, ".//option[@selected = 'selected']") || select.all(:css, 'option').first
495
477
  value = selected_option ? selected_option.value : nil
@@ -509,11 +491,11 @@ Then /^"([^"]*)" should( not)? be an option for "([^"]*)"$/ do |value, negate, f
509
491
  patiently do
510
492
  if negate
511
493
  begin
512
- expect(find_field(field)).to have_no_css(*finder_arguments)
494
+ expect(find_with_disabled(:field, field)).to have_no_css(*finder_arguments)
513
495
  rescue Capybara::ElementNotFound
514
496
  end
515
497
  else
516
- expect(find_field(field)).to have_css(*finder_arguments)
498
+ expect(find_with_disabled(:field, field)).to have_css(*finder_arguments)
517
499
  end
518
500
  end
519
501
  end.overridable
@@ -542,18 +524,12 @@ end.overridable
542
524
  # Within a selenium test, the browser is asked whether the element is really visible
543
525
  # In a non-selenium test, we only check for `.hidden`, `.invisible` or `style: display:none`
544
526
  #
545
- # The step 'Then (the tag )?"..." should **not** be visible' is ambiguous. Please use 'Then (the tag )?"..." should be hidden' or 'Then I should not see "..."' instead. Note that the **not** option will be removed in future versions of Spreewald.
546
- #
547
527
  # More details [here](https://makandracards.com/makandra/1049-capybara-check-that-a-page-element-is-hidden-via-css)
548
- Then /^(the tag )?"([^\"]+)" should( not)? be visible$/ do |tag, selector_or_text, hidden|
549
- if hidden
550
- warn "The step 'Then ... should not be visible' is prone to misunderstandings. Please use 'Then ... should be hidden' or 'Then I should not see ...' instead."
551
- end
552
-
528
+ Then /^(the tag )?"([^\"]+)" should be visible$/ do |tag, selector_or_text|
553
529
  options = {}
554
530
  tag ? options.store(:selector, selector_or_text) : options.store(:text, selector_or_text)
555
531
 
556
- hidden ? assert_hidden(options) : assert_visible(options)
532
+ assert_visible(options)
557
533
  end.overridable
558
534
 
559
535
  # Checks that an element is actually present and hidden, also considering styles.
@@ -621,12 +597,6 @@ Then /^"([^"]*)" should link to "([^"]*)"$/ do |link_label, target|
621
597
  end
622
598
  end.overridable
623
599
 
624
- # Checks that the result has content type `text/plain`
625
- Then /^I should get a text response$/ do
626
- warn 'The step /^I should get a text response$/ is deprecated and scheduled for removal. Use `I should get a response with content-type "text/plain"` instead.'
627
- step 'I should get a response with content-type "text/plain"'
628
- end.overridable
629
-
630
600
  # Click a link within an element matching the given selector. Will try to be clever
631
601
  # and disregard elements that don't contain a matching link.
632
602
  #
@@ -695,11 +665,11 @@ end.overridable
695
665
  # Tests that a field with the given label is visible.
696
666
  Then /^the "([^\"]*)" field should( not)? be visible$/ do |label, hidden|
697
667
  if Spreewald::Comparison.compare_versions(Capybara::VERSION, :<, "2.1")
698
- field = find_field(label)
668
+ field = find_with_disabled(:field, label)
699
669
  else
700
670
  # Capybara 2.1+ won't usually interact with hidden elements,
701
671
  # but we can override this behavior by passing { visible: false }
702
- field = find_field(label, :visible => false)
672
+ field = find_with_disabled(:field, label, :visible => false)
703
673
  end
704
674
 
705
675
  selector = "##{field['id']}"
@@ -711,20 +681,6 @@ Then /^the "([^\"]*)" field should( not)? be visible$/ do |label, hidden|
711
681
  end
712
682
  end.overridable
713
683
 
714
- # Waits for the page to finish loading and AJAX requests to finish.
715
- #
716
- # More details [here](https://makandracards.com/makandra/12139-waiting-for-page-loads-and-ajax-requests-to-finish-with-capybara).
717
- When /^I wait for the page to load$/ do
718
- warn 'The step /^I wait for the page to load$/ is deprecated and scheduled for removal. Please see https://github.com/makandra/spreewald/issues/136'
719
- if javascript_capable?
720
- patiently do
721
- # when no jQuery is loaded, we assume there are no pending AJAX requests
722
- page.execute_script("return typeof jQuery === 'undefined' || $.active == 0;").should == true
723
- end
724
- end
725
- page.has_content? ''
726
- end.overridable
727
-
728
684
  # Performs HTTP basic authentication with the given credentials and visits the given path.
729
685
  #
730
686
  # More details [here](https://makandracards.com/makandra/971-perform-http-basic-authentication-in-cucumber).
@@ -761,7 +717,7 @@ end.overridable
761
717
  # Tests whether a select field is sorted. Uses Array#natural_sort, if defined;
762
718
  # Array#sort else.
763
719
  Then /^the "(.*?)" select should( not)? be sorted$/ do |label, negate|
764
- select = find_field(label)
720
+ select = find_with_disabled(:field, label)
765
721
  options = select.all('option').reject { |o| o.value.blank? }
766
722
  option_texts = options.collect(&:text)
767
723
 
@@ -58,7 +58,7 @@ class MailFinder
58
58
  end
59
59
 
60
60
  def email_text_body(mail, type = '')
61
- if mail.html_part && type != 'plain-text'
61
+ body = if mail.html_part && type != 'plain-text'
62
62
  dom = Nokogiri::HTML(mail.html_part.body.to_s)
63
63
  dom.at_css('body').text.gsub(/\n\n/, "\n")
64
64
  elsif mail.text_part && type != 'HTML'
@@ -66,6 +66,7 @@ class MailFinder
66
66
  else
67
67
  mail.body.to_s
68
68
  end
69
+ body.gsub("\r\n", "\n") # The mail gem (>= 2.7.1) switched from \n to \r\n line breaks (LF to CRLF) in plain text mails.
69
70
  end
70
71
 
71
72
  def show_mails(mails, only_header = false)
@@ -81,14 +82,12 @@ class MailFinder
81
82
  end
82
83
 
83
84
  def expected_body_regex(expected_body)
84
- # To stay backwards-compatible, this will only check whether an email
85
- # starts with the expected body.
86
85
  expected = '\A\n' + Regexp.quote(expected_body.strip) + '\n\Z'
87
86
  expected.gsub! '\n\*\n', '\n[\s\S]*\n'
88
87
  expected.gsub! '\*\n', '.*\n'
89
88
 
90
89
  expected.gsub! '\A\n', '\A'
91
- expected.gsub! '\n\Z', '' # Change '' to '\Z' to force that the whole body matches
90
+ expected.gsub! '\n\Z', '\Z'
92
91
 
93
92
  Regexp.new(expected)
94
93
  end
@@ -1,3 +1,3 @@
1
1
  module Spreewald
2
- VERSION = '2.99.0'
2
+ VERSION = '3.0.0'
3
3
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (2.99.0)
4
+ spreewald (3.0.0)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (2.99.0)
4
+ spreewald (3.0.0)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (2.99.0)
4
+ spreewald (3.0.0)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (2.99.0)
4
+ spreewald (3.0.0)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -17,7 +17,15 @@ class SpreewaldMailer < ApplicationMailer
17
17
  :subject => SUBJECT
18
18
  )
19
19
  end
20
-
20
+
21
+ def email_crlf
22
+ email
23
+ end
24
+
25
+ def email_with_umlauts
26
+ email
27
+ end
28
+
21
29
  def html_email_with_links
22
30
  email
23
31
  end
@@ -9,6 +9,16 @@ class EmailsController < ApplicationController
9
9
  render_nothing
10
10
  end
11
11
 
12
+ def send_crlf_email
13
+ deliver :email_crlf
14
+ render_nothing
15
+ end
16
+
17
+ def send_email_with_umlauts
18
+ deliver :email_with_umlauts
19
+ render_nothing
20
+ end
21
+
12
22
  def send_html_email_with_links
13
23
  deliver :html_email_with_links
14
24
  render_nothing
@@ -21,6 +21,14 @@ class Mailer < ActionMailer::Base
21
21
  )
22
22
  end
23
23
 
24
+ def email_crlf
25
+ email
26
+ end
27
+
28
+ def email_with_umlauts
29
+ email
30
+ end
31
+
24
32
  def html_email_with_links
25
33
  email
26
34
  end
@@ -42,6 +50,10 @@ class Mailer < ActionMailer::Base
42
50
  body BODY
43
51
  end
44
52
 
53
+ def email_crlf
54
+ email
55
+ end
56
+
45
57
  def html_email_with_links
46
58
  email
47
59
  end
@@ -4,6 +4,9 @@
4
4
  = label_tag 'checked_name', 'Checked'
5
5
  = check_box_tag 'checked_name', 'value', checked
6
6
 
7
+ = label_tag 'checked_disabled_name', 'Checked disabled'
8
+ = check_box_tag 'checked_disabled_name', 'value', checked, disabled: true
9
+
7
10
  - checked = false
8
11
  = label_tag 'unchecked_name', 'Unchecked'
9
12
  = check_box_tag 'unchecked_name', 'value', checked
@@ -69,3 +69,4 @@
69
69
 
70
70
  = label_tag 'enabled_radio_2', 'Enabled radio button #2'
71
71
  = radio_button_tag 'enabled_radio', '2', selected
72
+
@@ -3,6 +3,9 @@
3
3
  = label_tag 'text_control', 'Text control'
4
4
  = text_field_tag 'text_control', 'Text control value'
5
5
 
6
+ = label_tag 'disabled_text_control', 'Disabled text control'
7
+ = text_field_tag 'disabled_text_control', 'Disabled text control value', disabled: true
8
+
6
9
  = label_tag 'select_control', 'Select control'
7
10
  = select_tag 'select_control', options_for_select([['Label 1', 'value1'], ['Label 2', 'value2'], ['Label 3', 'value3']], 'value2')
8
11
 
@@ -26,4 +29,4 @@
26
29
  = label_tag 'radio_button_control_radio1', 'Radio 1'
27
30
  = radio_button_tag 'radio_button_control', 'radio1'
28
31
  = label_tag 'radio_button_control_radio2', 'Radio 2'
29
- = radio_button_tag 'radio_button_control', 'radio2'
32
+ = radio_button_tag 'radio_button_control', 'radio2'
@@ -5,6 +5,9 @@
5
5
  .form-group.field_with_errors
6
6
  = label_tag 'textarea_control_1', 'B is invalid'
7
7
  = text_area_tag 'textarea_control_1', "Textarea control line 1\nTextarea control line 2\n"
8
+ .form-group.field_with_errors
9
+ = label_tag 'disabled_control', 'Disabled is invalid'
10
+ = text_field_tag 'disabled_control', "Disabled control value", disabled: true
8
11
  .form-group
9
12
  = label_tag 'textarea_control_2', 'C'
10
13
  = text_area_tag 'textarea_control_2', "Textarea control line 1\nTextarea control line 2\n"
@@ -0,0 +1,5 @@
1
+ Body
2
+ with
3
+ CRLF
4
+ line
5
+ breaks
@@ -6,6 +6,8 @@ Rails.application.routes.draw do
6
6
 
7
7
  get '/emails/do_nothing', to: 'emails#do_nothing'
8
8
  get '/emails/send_email', to: 'emails#send_email'
9
+ get '/emails/send_crlf_email', to: 'emails#send_crlf_email'
10
+ get '/emails/send_email_with_umlauts', to: 'emails#send_email_with_umlauts'
9
11
  get '/emails/send_html_email_with_links', to: 'emails#send_html_email_with_links'
10
12
  get '/emails/send_text_email_with_links', to: 'emails#send_text_email_with_links'
11
13
 
@@ -200,7 +200,7 @@ Feature: Test Spreewald's email steps
200
200
  '''
201
201
  """
202
202
 
203
- # Test body with wildcard not at the end of a line
203
+ # Test body with to few paragraphs
204
204
  Then the following multiline step should fail:
205
205
  """
206
206
  Then an email should have been sent with:
@@ -211,75 +211,64 @@ Feature: Test Spreewald's email steps
211
211
  Subject: SUBJECT
212
212
 
213
213
  Body
214
- *th
215
- line
216
- break
217
- '''
218
- """
219
-
220
- Scenario: Scenario: /^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]+"|cc "[^"]+"|to "[^"]+"|the subject "[^"]+"|the body "[^"]+"|the attachments "[^"]+")+)$/
221
- When I go to "/emails/send_email"
222
-
223
- # Test with correct conditions
224
- Then the following multiline step should succeed:
225
- """
226
- Then an email should have been sent from "from@example.com" to "to@example.com" cc "cc@example.com" bcc "bcc@example.com" and the subject "SUBJECT" and the attachments "attached_file.pdf"
227
- """
228
-
229
- # Test with wrong conditions
230
- Then the following multiline step should fail:
231
- """
232
- Then an email should have been sent from "from@example.com" to "to@example.com" cc "cc@example.com" bcc "wrong_bcc@example.com" and the subject "SUBJECT" and the attachments "attached_file.pdf"
233
- """
234
-
235
- Scenario: /^that e?mail should have the following lines in the body:$/
236
- When I go to "/emails/send_email"
237
-
238
- # Test with correct body lines
239
- Then the following multiline step should succeed:
240
- """
241
- Then that email should have the following lines in the body:
242
- '''
243
214
  with
244
215
  line
245
216
  '''
246
217
  """
247
218
 
248
- # Test with wrong body lines
219
+ # Test body with wildcard not at the end of a line
249
220
  Then the following multiline step should fail:
250
221
  """
251
- Then that email should have the following lines in the body:
222
+ Then an email should have been sent with:
252
223
  '''
253
- wrong
224
+ From: from@example.com
225
+ Reply-To: reply-to@example.com
226
+ To: to@example.com
227
+ Subject: SUBJECT
228
+
229
+ Body
230
+ *th
254
231
  line
232
+ break
255
233
  '''
256
234
  """
257
235
 
236
+ When I clear my emails
237
+ And I go to "/emails/send_crlf_email"
258
238
 
259
- Scenario: /^that e?mail should have the following( content in the)? body$/
260
- When I go to "/emails/send_email"
261
-
262
- # Test with correct body lines
263
239
  Then the following multiline step should succeed:
264
240
  """
265
- Then that email should have the following content in the body:
241
+ Then an email should have been sent with:
266
242
  '''
243
+ From: from@example.com
244
+ Reply-To: reply-to@example.com
245
+ To: to@example.com
246
+ Subject: SUBJECT
247
+
248
+ Body
267
249
  with
250
+ CRLF
268
251
  line
252
+ breaks
269
253
  '''
270
254
  """
271
255
 
272
- # Test with wrong body lines
273
- Then the following multiline step should fail:
274
- """
275
- Then that email should have the following body:
256
+ When I clear my emails
257
+ And I go to "/emails/send_email_with_umlauts"
258
+
259
+ Then the following multiline step should succeed:
260
+ """
261
+ Then an email should have been sent with:
276
262
  '''
277
- wrong
278
- line
263
+ From: from@example.com
264
+ Reply-To: reply-to@example.com
265
+ To: to@example.com
266
+ Subject: SUBJECT
267
+
268
+ Viele Grüße
279
269
  '''
280
270
  """
281
271
 
282
-
283
272
  Scenario: /^I follow the (first|second|third)? ?link in the e?mail$/ (HTML e-mail body)
284
273
  When I go to "/emails/send_html_email_with_links"
285
274
  And I follow the first link in the email
@@ -4,6 +4,7 @@ Feature: Web steps
4
4
  When I go to "/forms/form1"
5
5
  Then the "Text control" field should contain "Text control value"
6
6
  Then the "Text control" field should not contain "false text"
7
+ Then the "Disabled text control" field should contain "Disabled text control value"
7
8
  Then the "Select control" field should contain "Label 2"
8
9
  Then the "Select control without selection" field should contain "Label 1"
9
10
  Then the "Textarea control" field should contain "Textarea control value"
@@ -35,17 +36,14 @@ Feature: Web steps
35
36
  When I go to "/forms/invalid_form"
36
37
  Then the "A" field should have an error
37
38
  Then the "B" field should have an error
39
+ Then the "Disabled" field should have an error
38
40
  Then the "C" field should not have an error
39
41
 
40
42
  Scenario: /^the "([^"]*)" field should have the error "([^"]*)"$/
41
43
  When I go to "/forms/invalid_form"
42
44
  Then the "A" field should have the error "is invalid"
43
45
  Then the "B" field should have the error "is invalid"
44
-
45
-
46
- Scenario: /^the "([^"]*)" field should have no error$/
47
- When I go to "/forms/invalid_form"
48
- Then the "C" field should have no error
46
+ Then the "Disabled" field should have the error "is invalid"
49
47
 
50
48
 
51
49
  Scenario: /^I should see a form with the following values:$/
@@ -93,6 +91,7 @@ Feature: Web steps
93
91
  Scenario: /^the "([^"]*)" checkbox should( not)? be checked$/
94
92
  When I go to "/forms/checkbox_form"
95
93
  Then the "Checked" checkbox should be checked
94
+ And the "Checked disabled" checkbox should be checked
96
95
  And the "Unchecked" checkbox should not be checked
97
96
 
98
97
 
@@ -135,7 +134,7 @@ Feature: Web steps
135
134
  But the "unsorted" select should not be sorted
136
135
 
137
136
 
138
- Scenario: /^Then (the tag )?"..." should( not)? be visible$/
137
+ Scenario: /^Then (the tag )?"..." should be visible$/
139
138
  When I go to "/static_pages/visibility"
140
139
  Then "hidden ümläüt" should be hidden
141
140
  And "visible ümläüt" should be visible
@@ -145,13 +144,13 @@ Feature: Web steps
145
144
 
146
145
 
147
146
  @javascript
148
- Scenario: /^Then (the tag )?"..." should( not)? be visible$/ with javascript
147
+ Scenario: /^Then (the tag )?"..." should be visible$/ with javascript
149
148
  When I go to "/static_pages/visibility"
150
- Then "hidden ümläüt" should not be visible
149
+ Then "hidden ümläüt" should be hidden
151
150
  And "visible ümläüt" should be visible
152
151
  And a hidden string with quotes should not be visible
153
152
  And a visible string with quotes should be visible
154
- And "hidden ümläüt" should not be visible
153
+ And "hidden ümläüt" should be hidden
155
154
 
156
155
 
157
156
  Scenario: /^the "([^\"]*)" field should( not)? be visible$/
@@ -161,7 +160,7 @@ Feature: Web steps
161
160
 
162
161
  Scenario: /^the "([^\"]*)" field should( not)? be visible within (.*[^:])$/
163
162
  When I go to "/static_pages/visibility"
164
- Then "content" should not be visible within ".inside"
163
+ Then "content" should be hidden within ".inside"
165
164
  But "content" should be visible within ".outside"
166
165
 
167
166
  @javascript
@@ -302,6 +301,12 @@ Feature: Web steps
302
301
  And I should not see a link labeled "First visible link" within ".unrelated-element"
303
302
 
304
303
 
304
+ Scenario: /^I should( not)? see a field "([^"]*)"$/
305
+ When I go to "/forms/disabled_elements"
306
+ Then I should see a field "Enabled field #1"
307
+ And I should see a field "Disabled field #1"
308
+
309
+
305
310
  Scenario: /^I should( not)? see the (?:number|amount) ([\-\d,\.]+)(?: (.*?))?$/
306
311
  When I am on "/static_pages/numbers"
307
312
  Then I should see the number 1
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: 2.99.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Kraze
@@ -157,11 +157,9 @@ files:
157
157
  - lib/spreewald/browser_tab_steps.rb
158
158
  - lib/spreewald/development_steps.rb
159
159
  - lib/spreewald/email_steps.rb
160
- - lib/spreewald/file_attachment_steps.rb
161
160
  - lib/spreewald/session_steps.rb
162
161
  - lib/spreewald/table_steps.rb
163
162
  - lib/spreewald/time_steps.rb
164
- - lib/spreewald/timecop_steps.rb
165
163
  - lib/spreewald/web_steps.rb
166
164
  - lib/spreewald_support/comparison.rb
167
165
  - lib/spreewald_support/compatibility.rb
@@ -348,6 +346,8 @@ files:
348
346
  - tests/shared/app/views/layouts/mailer.html.erb
349
347
  - tests/shared/app/views/layouts/mailer.text.erb
350
348
  - tests/shared/app/views/mailer/email.text.erb
349
+ - tests/shared/app/views/mailer/email_crlf.text.erb
350
+ - tests/shared/app/views/mailer/email_with_umlauts.text.erb
351
351
  - tests/shared/app/views/mailer/html_email_with_links.haml
352
352
  - tests/shared/app/views/mailer/text_email_with_links.text.erb
353
353
  - tests/shared/app/views/spreewald_mailer
@@ -579,6 +579,8 @@ test_files:
579
579
  - tests/shared/app/views/layouts/mailer.html.erb
580
580
  - tests/shared/app/views/layouts/mailer.text.erb
581
581
  - tests/shared/app/views/mailer/email.text.erb
582
+ - tests/shared/app/views/mailer/email_crlf.text.erb
583
+ - tests/shared/app/views/mailer/email_with_umlauts.text.erb
582
584
  - tests/shared/app/views/mailer/html_email_with_links.haml
583
585
  - tests/shared/app/views/mailer/text_email_with_links.text.erb
584
586
  - tests/shared/app/views/spreewald_mailer
@@ -1,22 +0,0 @@
1
- # This step is deprecated and will be removed from spreewald. If you still want to use it, copy the code to your project's own steps.
2
- Given /^the file "([^"]*)" was attached(?: as (?:([^"]*)\/)?([^"]*))? to the ([^"]*) above(?: at "([^"]*)")?$/ do
3
- |path_to_file, container_name, relation_name, model_name, time_string|
4
-
5
- warn "The step 'the file ... was attached to the ... above' will soon be removed from Spreewald, because we want Spreewald to be a library of steps that interact with a user interface and instead of manipulating the database directly. If you wish to further use this step please copy it over to your project's own steps."
6
-
7
- object = model_name.camelize.constantize.last
8
- time = Time.parse(time_string) if time_string.present?
9
- relation_name ||= 'file'
10
-
11
- if container_name.present?
12
- container = container_name.camelize.constantize.new # Image.file = File... owner: gallery
13
- container.owner = object
14
- container.created_at = time if time
15
- else
16
- container = object # Person.avatar = File...
17
- end
18
-
19
- container.send("#{relation_name}=", File.new(path_to_file))
20
- container.updated_at = time if time
21
- container.save!
22
- end.overridable
@@ -1,9 +0,0 @@
1
- # nodoc
2
- # FILE_COMMENT_END
3
-
4
- warn <<-WARNING
5
- Warning: The file spreewald/timecop_steps.rb is deprecated. It was moved to
6
- spreewald/time_steps.rb. Please require the new file instead.
7
- WARNING
8
-
9
- require 'spreewald/time_steps'