spreewald 2.2.4 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -1
  3. data/.travis.yml +14 -15
  4. data/CHANGELOG.md +34 -2
  5. data/Gemfile +1 -2
  6. data/Gemfile.lock +1 -16
  7. data/Gemfile.ruby266 +9 -0
  8. data/Gemfile.ruby266.lock +65 -0
  9. data/README.md +76 -34
  10. data/Rakefile +22 -7
  11. data/examples/paths.rb +36 -0
  12. data/examples/selectors.rb +28 -0
  13. data/lib/spreewald/all_steps.rb +4 -1
  14. data/lib/spreewald/browser_tab_steps.rb +91 -0
  15. data/lib/spreewald/development_steps.rb +2 -1
  16. data/lib/spreewald/email_steps.rb +11 -4
  17. data/lib/spreewald/file_attachment_steps.rb +3 -21
  18. data/lib/spreewald/time_steps.rb +102 -0
  19. data/lib/spreewald/timecop_steps.rb +6 -76
  20. data/lib/spreewald/web_steps.rb +8 -16
  21. data/lib/spreewald_support/driver_info.rb +8 -0
  22. data/lib/spreewald_support/tolerance_for_selenium_sync_issues.rb +9 -3
  23. data/lib/spreewald_support/version.rb +1 -1
  24. data/support/step_definition.rb +1 -1
  25. data/support/step_definition_file.rb +2 -0
  26. data/tests/rails-3_capybara-1/Gemfile +2 -1
  27. data/tests/rails-3_capybara-1/Gemfile.lock +3 -1
  28. data/tests/rails-3_capybara-1/app +1 -1
  29. data/tests/rails-3_capybara-1/config/cucumber.yml +1 -1
  30. data/tests/rails-3_capybara-1/config/database.yml +1 -1
  31. data/tests/rails-3_capybara-1/config/routes.rb +1 -0
  32. data/tests/rails-3_capybara-1/db +1 -1
  33. data/tests/rails-3_capybara-1/features/shared +1 -1
  34. data/tests/rails-3_capybara-1/features/support/paths.rb +1 -1
  35. data/tests/rails-3_capybara-1/features/support/selectors.rb +1 -1
  36. data/tests/rails-3_capybara-1/public +1 -1
  37. data/tests/rails-3_capybara-2/Gemfile +2 -1
  38. data/tests/rails-3_capybara-2/Gemfile.lock +3 -1
  39. data/tests/rails-3_capybara-2/Rakefile +1 -1
  40. data/tests/rails-3_capybara-2/app +1 -1
  41. data/tests/rails-3_capybara-2/config +1 -1
  42. data/tests/rails-3_capybara-2/config.ru +1 -1
  43. data/tests/rails-3_capybara-2/db +1 -1
  44. data/tests/rails-3_capybara-2/features +1 -1
  45. data/tests/rails-3_capybara-2/public +1 -1
  46. data/tests/rails-3_capybara-2/script +1 -1
  47. data/tests/rails-4_capybara-3/Gemfile +1 -1
  48. data/tests/rails-4_capybara-3/Gemfile.lock +3 -3
  49. data/tests/rails-4_capybara-3/app +1 -1
  50. data/tests/rails-4_capybara-3/config/routes.rb +1 -0
  51. data/tests/rails-4_capybara-3/db +1 -1
  52. data/tests/rails-4_capybara-3/features/development_steps.feature +1 -1
  53. data/tests/rails-4_capybara-3/features/email_steps.feature +1 -1
  54. data/tests/rails-4_capybara-3/features/overriding.feature +1 -1
  55. data/tests/rails-4_capybara-3/features/step_definitions/overriding_steps.rb +1 -1
  56. data/tests/rails-4_capybara-3/features/step_definitions/test_steps.rb +1 -1
  57. data/tests/rails-4_capybara-3/features/support/paths.rb +1 -1
  58. data/tests/rails-4_capybara-3/features/support/selectors.rb +1 -1
  59. data/tests/rails-4_capybara-3/features/table_steps.feature +1 -1
  60. data/tests/rails-4_capybara-3/features/time_steps.feature +1 -0
  61. data/tests/rails-4_capybara-3/features/web_steps.feature +1 -1
  62. data/tests/rails-4_capybara-3/public/fixture_files +1 -1
  63. data/tests/rails-6_capybara-3/.ruby-version +1 -0
  64. data/tests/rails-6_capybara-3/Gemfile +25 -0
  65. data/tests/rails-6_capybara-3/Gemfile.lock +264 -0
  66. data/tests/rails-6_capybara-3/README.md +24 -0
  67. data/tests/rails-6_capybara-3/Rakefile +6 -0
  68. data/tests/rails-6_capybara-3/app/controllers +1 -0
  69. data/tests/rails-6_capybara-3/app/mailers/application_mailer.rb +4 -0
  70. data/tests/rails-6_capybara-3/app/mailers/spreewald_mailer.rb +30 -0
  71. data/tests/rails-6_capybara-3/app/models/application_record.rb +3 -0
  72. data/tests/rails-6_capybara-3/app/views +1 -0
  73. data/tests/rails-6_capybara-3/bin/bundle +114 -0
  74. data/tests/rails-6_capybara-3/bin/rails +4 -0
  75. data/tests/rails-6_capybara-3/bin/rake +4 -0
  76. data/tests/rails-6_capybara-3/bin/setup +33 -0
  77. data/tests/rails-6_capybara-3/config.ru +5 -0
  78. data/tests/rails-6_capybara-3/config/application.rb +35 -0
  79. data/tests/rails-6_capybara-3/config/boot.rb +3 -0
  80. data/tests/rails-6_capybara-3/config/cucumber.yml +9 -0
  81. data/tests/rails-6_capybara-3/config/database.yml +25 -0
  82. data/tests/rails-6_capybara-3/config/environment.rb +5 -0
  83. data/tests/rails-6_capybara-3/config/environments/development.rb +48 -0
  84. data/tests/rails-6_capybara-3/config/environments/test.rb +45 -0
  85. data/tests/rails-6_capybara-3/config/initializers/application_controller_renderer.rb +8 -0
  86. data/tests/rails-6_capybara-3/config/initializers/backtrace_silencers.rb +7 -0
  87. data/tests/rails-6_capybara-3/config/initializers/content_security_policy.rb +28 -0
  88. data/tests/rails-6_capybara-3/config/initializers/cookies_serializer.rb +5 -0
  89. data/tests/rails-6_capybara-3/config/initializers/filter_parameter_logging.rb +4 -0
  90. data/tests/rails-6_capybara-3/config/initializers/inflections.rb +16 -0
  91. data/tests/rails-6_capybara-3/config/initializers/mime_types.rb +4 -0
  92. data/tests/rails-6_capybara-3/config/initializers/wrap_parameters.rb +14 -0
  93. data/tests/rails-6_capybara-3/config/locales/en.yml +33 -0
  94. data/tests/rails-6_capybara-3/config/routes.rb +1 -0
  95. data/tests/rails-6_capybara-3/db +1 -0
  96. data/tests/rails-6_capybara-3/features/development_steps.feature +1 -0
  97. data/tests/rails-6_capybara-3/features/email_steps.feature +1 -0
  98. data/tests/rails-6_capybara-3/features/overriding.feature +1 -0
  99. data/tests/{shared/app/views/emails/send_email.haml → rails-6_capybara-3/features/step_definitions/.gitkeep} +0 -0
  100. data/tests/rails-6_capybara-3/features/step_definitions/overriding_steps.rb +1 -0
  101. data/tests/rails-6_capybara-3/features/step_definitions/test_steps.rb +1 -0
  102. data/tests/rails-6_capybara-3/features/support/env.rb +66 -0
  103. data/tests/rails-6_capybara-3/features/support/paths.rb +1 -0
  104. data/tests/rails-6_capybara-3/features/support/selectors.rb +1 -0
  105. data/tests/rails-6_capybara-3/features/support/selenium.rb +3 -0
  106. data/tests/rails-6_capybara-3/features/table_steps.feature +1 -0
  107. data/tests/rails-6_capybara-3/features/time_steps.feature +1 -0
  108. data/tests/rails-6_capybara-3/features/web_steps.feature +1 -0
  109. data/tests/{shared/db/migrate/.gitignore → rails-6_capybara-3/lib/tasks/.keep} +0 -0
  110. data/tests/rails-6_capybara-3/lib/tasks/cucumber.rake +76 -0
  111. data/tests/rails-6_capybara-3/log/.keep +0 -0
  112. data/tests/rails-6_capybara-3/public/404.html +67 -0
  113. data/tests/rails-6_capybara-3/public/422.html +67 -0
  114. data/tests/rails-6_capybara-3/public/500.html +66 -0
  115. data/tests/rails-6_capybara-3/public/favicon.ico +0 -0
  116. data/tests/rails-6_capybara-3/public/fixture_files +1 -0
  117. data/tests/rails-6_capybara-3/script/cucumber +11 -0
  118. data/tests/shared/app/controllers/application_controller.rb +9 -0
  119. data/tests/shared/app/controllers/authenticated_controller.rb +10 -2
  120. data/tests/shared/app/controllers/emails_controller.rb +25 -7
  121. data/tests/shared/app/controllers/forms_controller.rb +3 -0
  122. data/tests/shared/app/controllers/static_pages_controller.rb +23 -0
  123. data/tests/shared/app/models/mailer.rb +16 -0
  124. data/tests/shared/app/views/layouts/mailer.html.erb +13 -0
  125. data/tests/shared/app/views/layouts/mailer.text.erb +1 -0
  126. data/tests/shared/app/views/mailer/{email.haml → email.text.erb} +0 -0
  127. data/tests/shared/app/views/mailer/html_email_with_links.haml +6 -0
  128. data/tests/shared/app/views/mailer/text_email_with_links.text.erb +6 -0
  129. data/tests/shared/app/views/spreewald_mailer +1 -0
  130. data/tests/shared/app/views/static_pages/tab_1.haml +3 -0
  131. data/tests/shared/app/views/static_pages/tab_2.haml +2 -0
  132. data/tests/shared/app/views/static_pages/tab_3.haml +1 -0
  133. data/tests/shared/app/views/static_pages/time.html.haml +2 -0
  134. data/tests/shared/app/views/static_pages/visibility.html.haml +8 -1
  135. data/tests/shared/app/views/static_pages/within.html.haml +3 -0
  136. data/tests/shared/config/routes.rb +37 -0
  137. data/tests/shared/db/migrate/.keep +0 -0
  138. data/tests/shared/features/shared/browser_tab_steps.feature +103 -0
  139. data/tests/shared/features/shared/email_steps.feature +18 -0
  140. data/tests/shared/features/shared/time_steps.feature +31 -0
  141. data/tests/shared/features/shared/web_steps.feature +17 -0
  142. metadata +149 -12
  143. data/tests/rails-3_capybara-1/config/routes.rb +0 -5
  144. data/tests/rails-4_capybara-3/.gitignore +0 -17
  145. data/tests/rails-4_capybara-3/config/routes.rb +0 -3
@@ -0,0 +1 @@
1
+ ../../shared/public/fixture_files/
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
5
+ if vendored_cucumber_bin
6
+ load File.expand_path(vendored_cucumber_bin)
7
+ else
8
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
9
+ require 'cucumber'
10
+ load Cucumber::BINARY
11
+ end
@@ -1,2 +1,11 @@
1
1
  class ApplicationController < ActionController::Base
2
+
3
+ def render_nothing
4
+ if Rails.version.to_i >= 5
5
+ render body: nil
6
+ else
7
+ render nothing: true
8
+ end
9
+ end
10
+
2
11
  end
@@ -1,9 +1,17 @@
1
1
  class AuthenticatedController < ApplicationController
2
2
 
3
- before_filter :authenticate
3
+ if Rails.version.to_i >= 5
4
+ before_action :authenticate
5
+ else
6
+ before_filter :authenticate
7
+ end
4
8
 
5
9
  def page
6
- render :text => 'Action reached'
10
+ if Rails.version.to_i >= 5
11
+ render :plain => 'Action reached'
12
+ else
13
+ render :text => 'Action reached'
14
+ end
7
15
  end
8
16
 
9
17
  private
@@ -1,17 +1,35 @@
1
1
  class EmailsController < ApplicationController
2
2
 
3
3
  def do_nothing
4
- render :nothing => true
4
+ render_nothing
5
5
  end
6
-
6
+
7
7
  def send_email
8
- if Rails.version >= "3"
9
- Mailer.email.deliver
8
+ deliver :email
9
+ render_nothing
10
+ end
11
+
12
+ def send_html_email_with_links
13
+ deliver :html_email_with_links
14
+ render_nothing
15
+ end
16
+
17
+ def send_text_email_with_links
18
+ deliver :text_email_with_links
19
+ render_nothing
20
+ end
21
+
22
+ private
23
+
24
+ def deliver(method_name)
25
+ case
26
+ when Rails.version.to_i >= 5
27
+ SpreewaldMailer.send(method_name).deliver
28
+ when Rails.version.to_i >= 3
29
+ Mailer.public_send(method_name).deliver
10
30
  else
11
- Mailer.deliver_email
31
+ Mailer.public_send("deliver_#{method_name}")
12
32
  end
13
-
14
- render :nothing => true
15
33
  end
16
34
 
17
35
  end
@@ -3,6 +3,9 @@ class FormsController < ApplicationController
3
3
  def checkbox_form
4
4
  end
5
5
 
6
+ def disabled_elements
7
+ end
8
+
6
9
  def form1
7
10
  end
8
11
 
@@ -9,16 +9,39 @@ class StaticPagesController < ApplicationController
9
9
  def link_to_home
10
10
  end
11
11
 
12
+ def links
13
+ end
14
+
15
+ def numbers
16
+ end
17
+
12
18
  def overriden
13
19
  end
14
20
 
15
21
  def see_element
16
22
  end
17
23
 
24
+ def tab_1
25
+ end
26
+
27
+ def tab_2
28
+ end
29
+
30
+ def tab_3
31
+ end
32
+
18
33
  def visibility
19
34
  end
20
35
 
21
36
  def within
22
37
  end
23
38
 
39
+ def link_target
40
+ render_nothing
41
+ end
42
+
43
+ def second_link_target
44
+ render_nothing
45
+ end
46
+
24
47
  end
@@ -21,6 +21,14 @@ class Mailer < ActionMailer::Base
21
21
  )
22
22
  end
23
23
 
24
+ def html_email_with_links
25
+ email
26
+ end
27
+
28
+ def text_email_with_links
29
+ email
30
+ end
31
+
24
32
  else
25
33
 
26
34
  def email
@@ -34,6 +42,14 @@ class Mailer < ActionMailer::Base
34
42
  body BODY
35
43
  end
36
44
 
45
+ def html_email_with_links
46
+ email
47
+ end
48
+
49
+ def text_email_with_links
50
+ email
51
+ end
52
+
37
53
  end
38
54
 
39
55
  end
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -0,0 +1,6 @@
1
+ !!!
2
+ %html(lang="en" xmlns="http://www.w3.org/1999/xhtml")
3
+ %body
4
+ %img(src="https://www.example.com/image.png")
5
+ %a(href="https://www.example.com/static_pages/link_target") Click me
6
+ %a(href="https://www.example.com/static_pages/second_link_target") Other link
@@ -0,0 +1,6 @@
1
+ Hello!
2
+
3
+ First link: https://www.example.com/static_pages/link_target
4
+ Second link: https://www.example.com/static_pages/second_link_target
5
+
6
+ Bye!
@@ -0,0 +1 @@
1
+ tests/shared/app/views/mailer
@@ -0,0 +1,3 @@
1
+ %h1 First browser tab
2
+ %a(href='/static_pages/tab_2' target='_blank') Click to open tab 2
3
+ %a(href='/static_pages/tab_2') Follow link WITHOUT opening a new tab
@@ -0,0 +1,2 @@
1
+ %h1 Second browser tab
2
+ %a(href='/static_pages/tab_3' target='_blank') Click to open tab 3
@@ -0,0 +1 @@
1
+ %h1 Third browser tab
@@ -0,0 +1,2 @@
1
+ = "The current date is #{Time.current.strftime("%Y-%m-%d")}."
2
+ = "The current time is #{Time.current.strftime("%H:%M")}."
@@ -32,4 +32,11 @@
32
32
  .hidden
33
33
  div with class: hidden
34
34
  .invisible
35
- div with class: invisible
35
+ div with class: invisible
36
+
37
+ .outside
38
+ %div
39
+ content
40
+ .inside
41
+ %div(style='display: none')
42
+ content
@@ -27,3 +27,6 @@ He lives within a few miles of Augsburg.
27
27
 
28
28
  .unrelated-element
29
29
  Shared Text
30
+
31
+ .outside-table
32
+ Outside Table
@@ -0,0 +1,37 @@
1
+ Rails.application.routes.draw do
2
+ get '/authenticated/page', to: 'authenticated#page'
3
+
4
+ get '/downloads/spreadsheet', to: 'downloads#spreadsheet'
5
+ get '/downloads/spreadsheet', to: 'downloads#spreadsheet'
6
+
7
+ get '/emails/do_nothing', to: 'emails#do_nothing'
8
+ get '/emails/send_email', to: 'emails#send_email'
9
+ get '/emails/send_html_email_with_links', to: 'emails#send_html_email_with_links'
10
+ get '/emails/send_text_email_with_links', to: 'emails#send_text_email_with_links'
11
+
12
+ get '/forms/checkbox_form', to: 'forms#checkbox_form'
13
+ get '/forms/disabled_elements', to: 'forms#disabled_elements'
14
+ get '/forms/form1', to: 'forms#form1'
15
+ get '/forms/form2', to: 'forms#form2'
16
+ get '/forms/select_fields', to: 'forms#select_fields'
17
+ get '/forms/invalid_form', to: 'forms#invalid_form'
18
+
19
+ get '/static_pages/click_on', to: 'static_pages#click_on'
20
+ get '/static_pages/home', to: 'static_pages#home'
21
+ get '/static_pages/link_target', to: 'static_pages#link_target'
22
+ get '/static_pages/link_to_home', to: 'static_pages#link_to_home'
23
+ get '/static_pages/links', to: 'static_pages#links'
24
+ get '/static_pages/numbers', to: 'static_pages#numbers'
25
+ get '/static_pages/overridden', to: 'static_pages#overridden'
26
+ get '/static_pages/second_link_target', to: 'static_pages#second_link_target'
27
+ get '/static_pages/see_element', to: 'static_pages#see_element'
28
+ get '/static_pages/tab_1', to: 'static_pages#tab_1'
29
+ get '/static_pages/tab_2', to: 'static_pages#tab_2'
30
+ get '/static_pages/tab_3', to: 'static_pages#tab_3'
31
+ get '/static_pages/time', to: 'static_pages#time'
32
+ get '/static_pages/visibility', to: 'static_pages#visibility'
33
+ get '/static_pages/within', to: 'static_pages#within'
34
+
35
+ get '/tables/table1', to: 'tables#table1'
36
+ get '/tables/table_with_weird_spaces', to: 'tables#table_with_weird_spaces'
37
+ end
File without changes
@@ -0,0 +1,103 @@
1
+ @javascript
2
+ Feature: Browser tab steps
3
+
4
+ Background: Access some content in a first tab
5
+ Given I go to "/static_pages/tab_1"
6
+ Then I should see "First browser tab"
7
+ And there should be 1 browser tab
8
+
9
+
10
+ Scenario: I open (.+?) in a new browser tab
11
+ When I open "/static_pages/tab_2" in a new browser tab
12
+ Then I should see "Second browser tab"
13
+ And there should be 2 browser tabs
14
+
15
+ When I open "/static_pages/tab_3" in a new browser tab
16
+ Then I should see "Third browser tab"
17
+ And there should be 3 browser tabs
18
+
19
+
20
+ Scenario: I close the browser tab
21
+ When I open "/static_pages/tab_2" in a new browser tab
22
+ And I open "/static_pages/tab_3" in a new browser tab
23
+ Then I should see "Third browser tab"
24
+ And there should be 3 browser tabs
25
+
26
+ When I close the browser tab
27
+ Then there should be 2 browser tabs
28
+ And I should see "First browser tab"
29
+
30
+ When I close the browser tab
31
+ Then there should be 1 browser tab
32
+ And I should see "Second browser tab"
33
+
34
+
35
+ Scenario: I switch to the new(?:ly opened)? browser tab
36
+ When I follow "Click to open tab 2"
37
+ Then I should see "First browser tab"
38
+
39
+ When I switch to the newly opened browser tab
40
+ Then I should see "Second browser tab"
41
+
42
+ When I follow "Click to open tab 3"
43
+ And I switch to the new browser tab
44
+ Then I should see "Third browser tab"
45
+
46
+
47
+ Scenario: I switch(?: back)? to the previous browser tab
48
+ When I open "/static_pages/tab_2" in a new browser tab
49
+ Then I should see "Second browser tab"
50
+ And there should be 2 browser tabs
51
+
52
+ When I switch back to the previous browser tab
53
+ Then I should see "First browser tab"
54
+ And there should be 2 browser tabs
55
+
56
+ And I open "/static_pages/tab_3" in a new browser tab
57
+ Then I should see "Third browser tab"
58
+ And there should be 3 browser tabs
59
+
60
+ When I switch to the previous browser tab
61
+ Then I should see "Second browser tab"
62
+ And there should be 3 browser tabs
63
+
64
+
65
+ Scenario: I should have opened a new browser tab
66
+ This step must be preceded by "I may open a new browser tab"
67
+
68
+ When I may open a new browser tab
69
+ And I follow "Click to open tab 2"
70
+ Then I should have opened a new browser tab
71
+ And there should be 2 browser tabs
72
+
73
+
74
+ Scenario: I should not have opened a new browser tab
75
+ This step must be preceded by "I may open a new browser tab"
76
+
77
+ When I may open a new browser tab
78
+ And I follow "Follow link WITHOUT opening a new tab"
79
+ Then I should not have opened a new browser tab
80
+ And there should be 1 browser tabs
81
+
82
+
83
+ Scenario: there should be (\d+) browser tabs?
84
+ Given there should be 1 browser tab
85
+ When I open "/static_pages/tab_2" in a new browser tab
86
+ Then there should be 2 browser tabs
87
+
88
+ When I open "/static_pages/tab_3" in a new browser tab
89
+ Then there should be 3 browser tabs
90
+
91
+ When I open "/static_pages/tab_3" in a new browser tab
92
+ Then there should be 4 browser tabs
93
+
94
+
95
+ Scenario: there should be at least (\d+) browser tabs?
96
+ Given there should be at least 1 browser tab
97
+ When I open "/static_pages/tab_2" in a new browser tab
98
+ Then there should be at least 2 browser tabs
99
+
100
+ When I open "/static_pages/tab_3" in a new browser tab
101
+ Then there should be at least 1 browser tabs
102
+ Then there should be at least 2 browser tabs
103
+ Then there should be at least 3 browser tabs
@@ -214,3 +214,21 @@ Feature: Test Spreewald's email steps
214
214
  line
215
215
  '''
216
216
  """
217
+
218
+
219
+ Scenario: /^I follow the (first|second|third)? ?link in the e?mail$/ (HTML e-mail body)
220
+ When I go to "/emails/send_html_email_with_links"
221
+ And I follow the first link in the email
222
+ Then I should be on "/static_pages/link_target"
223
+
224
+ When I follow the second link in the email
225
+ Then I should be on "/static_pages/second_link_target"
226
+
227
+
228
+ Scenario: /^I follow the (first|second|third)? ?link in the e?mail$/ (text e-mail body)
229
+ When I go to "/emails/send_text_email_with_links"
230
+ And I follow the first link in the email
231
+ Then I should be on "/static_pages/link_target"
232
+
233
+ When I follow the second link in the email
234
+ Then I should be on "/static_pages/second_link_target"
@@ -0,0 +1,31 @@
1
+ # The time steps use the timecop gem or ActiveSupport 4.1, depending on what is
2
+ # available.
3
+ # In order to test both implementations, the rails 3 test projects (Capybara 1 & 2)
4
+ # use timecop to run this feature, while the rails 4 & 6 test projects (Capybara 6)
5
+ # use ActiveSupport for this feature.
6
+
7
+ Feature: Time steps
8
+ Scenario: /^the (?:date|time) is "?(\d{4}-\d{2}-\d{2}(?: \d{1,2}:\d{2})?)"?$/
9
+ Given the time is "2020-02-03 02:12"
10
+ When I go to "/static_pages/time"
11
+ Then I should see "The current date is 2020-02-03."
12
+ And I should see "The current time is 02:12."
13
+
14
+ Given the time is 23:24
15
+ When I go to "/static_pages/time"
16
+ Then I should see "The current time is 23:24."
17
+
18
+ Scenario: Set just the date
19
+ Given the date is "2020-02-03"
20
+ When I go to "/static_pages/time"
21
+ Then I should see "The current date is 2020-02-03."
22
+
23
+ Scenario: it is (\d+|an?|some|a few) (seconds?|minutes?|hours?|days?|weeks?|months?|years?) (later|earlier)
24
+ Given the time is "23:00"
25
+ When it is 24 minutes later
26
+ And I go to "/static_pages/time"
27
+ Then I should see "The current time is 23:24."
28
+
29
+ When it is an hour earlier
30
+ And I go to "/static_pages/time"
31
+ Then I should see "The current time is 22:24"