cucumber-rails 2.0.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +135 -18
- data/CONTRIBUTING.md +14 -2
- data/LICENSE +1 -1
- data/README.md +5 -24
- data/lib/cucumber/rails.rb +11 -13
- data/lib/cucumber/rails/action_dispatch.rb +21 -0
- data/lib/cucumber/rails/application.rb +11 -8
- data/lib/cucumber/rails/capybara/javascript_emulation.rb +27 -16
- data/lib/cucumber/rails/database.rb +7 -57
- data/lib/cucumber/rails/database/deletion_strategy.rb +13 -0
- data/lib/cucumber/rails/database/shared_connection_strategy.rb +27 -0
- data/lib/cucumber/rails/database/strategy.rb +35 -0
- data/lib/cucumber/rails/database/truncation_strategy.rb +13 -0
- data/lib/cucumber/rails/hooks/database_cleaner.rb +9 -3
- data/lib/cucumber/rails/hooks/mail.rb +1 -1
- data/lib/cucumber/rails/world.rb +2 -2
- data/lib/generators/cucumber/install_generator.rb +10 -13
- data/lib/generators/cucumber/templates/config/cucumber.yml.erb +3 -3
- data/lib/generators/cucumber/templates/tasks/cucumber.rake.erb +5 -0
- metadata +92 -99
- data/.github/ISSUE_TEMPLATE.md +0 -52
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -42
- data/.gitignore +0 -14
- data/.rspec +0 -4
- data/.rubocop.yml +0 -33
- data/.rubocop_todo.yml +0 -59
- data/.travis.yml +0 -60
- data/Appraisals +0 -35
- data/Gemfile +0 -5
- data/Rakefile +0 -53
- data/bin/install_geckodriver.sh +0 -19
- data/bin/install_webpacker.sh +0 -9
- data/config/.gitignore +0 -1
- data/config/cucumber.yml +0 -17
- data/cucumber-rails.gemspec +0 -44
- data/dev_tasks/cucumber.rake +0 -5
- data/dev_tasks/rspec.rake +0 -5
- data/dev_tasks/yard.rake +0 -36
- data/dev_tasks/yard/default/layout/html/bubble_32x32.png +0 -0
- data/dev_tasks/yard/default/layout/html/footer.erb +0 -5
- data/dev_tasks/yard/default/layout/html/index.erb +0 -1
- data/dev_tasks/yard/default/layout/html/layout.erb +0 -25
- data/dev_tasks/yard/default/layout/html/logo.erb +0 -1
- data/dev_tasks/yard/default/layout/html/setup.rb +0 -9
- data/features/allow_rescue.feature +0 -65
- data/features/annotations.feature +0 -20
- data/features/capybara_javascript_drivers.feature +0 -82
- data/features/choose_javascript_database_strategy.feature +0 -125
- data/features/configuration.feature +0 -48
- data/features/database_cleaner.feature +0 -44
- data/features/disable_automatic_database_cleaning.feature +0 -49
- data/features/emulate_javascript.feature +0 -109
- data/features/install_cucumber_rails.feature +0 -14
- data/features/no_database.feature +0 -61
- data/features/raising_errors.feature +0 -22
- data/features/rerun_profile.feature +0 -47
- data/features/rest_api.feature +0 -47
- data/features/step_definitions/cucumber_rails_steps.rb +0 -69
- data/features/support/aruba.rb +0 -5
- data/features/support/cucumber_rails_helper.rb +0 -76
- data/features/support/env.rb +0 -6
- data/features/support/hooks.rb +0 -8
- data/gemfiles/rails_4_2.gemfile +0 -10
- data/gemfiles/rails_5_0.gemfile +0 -10
- data/gemfiles/rails_5_1.gemfile +0 -10
- data/gemfiles/rails_5_2.gemfile +0 -10
- data/gemfiles/rails_6_0.gemfile +0 -9
- data/lib/cucumber/rails/action_controller.rb +0 -17
- data/lib/generators/cucumber/templates/support/rails_spork.rb.erb +0 -13
- data/spec/cucumber/rails/database_spec.rb +0 -61
- data/spec/generators/cucumber/install_generator_spec.rb +0 -55
- data/spec/spec_helper.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d764b02e53187004f18c9fdc74de22286dde7a2844bb453c5dc807faaaa20b0b
|
4
|
+
data.tar.gz: 24b459b96e9f4c904c7c4b075bff63cf360e65b26b0c90b78d611bd5edab9af8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14035d2a0e522ae20fc396e8b3eea3f3f0dc78631bfb7d15ff6d3fe77763463aa0ccfc088296952bbfd3cfcefff6b0a0a64bf4bdc7eb4b6b38e44a822bb9eb97
|
7
|
+
data.tar.gz: a3d599cc9cdb5de6f2db472bbbacfafeddbf11699eb6bf05103c3b6b3f8d31f7a620bbb97786a2c74e09ecce3712e4942828e2c8e1a8f01efbfe2db1d054280b
|
data/CHANGELOG.md
CHANGED
@@ -1,20 +1,128 @@
|
|
1
|
-
Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CONTRIBUTING.md)
|
1
|
+
Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CONTRIBUTING.md)
|
2
|
+
on how to contribute to Cucumber.
|
2
3
|
|
3
|
-
## [
|
4
|
+
## [main](https://github.com/cucumber/cucumber-rails/compare/v2.4.0...main) (Not yet released)
|
4
5
|
|
5
6
|
### New Features
|
6
7
|
|
7
|
-
|
8
|
+
*
|
8
9
|
|
9
10
|
### Changed
|
10
11
|
|
11
|
-
|
12
|
+
*
|
12
13
|
|
13
14
|
### Fixed
|
14
15
|
|
15
|
-
|
16
|
+
*
|
16
17
|
|
17
|
-
## [v2.
|
18
|
+
## [v2.4.0](https://github.com/cucumber/cucumber-rails/compare/v2.3.0...v2.4.0) (2021-07-21)
|
19
|
+
|
20
|
+
### New Features
|
21
|
+
|
22
|
+
* Added new docker / Makefile script to permit releasing from repo ([#502](https://github.com/cucumber/cucumber-rails/pull/502) [luke-hill])
|
23
|
+
* Gem update: allowed cucumber 6/7 ([#515](https://github.com/cucumber/cucumber-rails/pull/515) /
|
24
|
+
[#519](https://github.com/cucumber/cucumber-rails/pull/519))
|
25
|
+
* Add support for Ruby 3 ([#517](https://github.com/cucumber/cucumber-rails/pull/517/))
|
26
|
+
|
27
|
+
### Changed
|
28
|
+
|
29
|
+
* Updated rubocop to use new major versions ([#504](https://github.com/cucumber/cucumber-rails/pull/504) /
|
30
|
+
[#519](https://github.com/cucumber/cucumber-rails/pull/519) [luke-hill])
|
31
|
+
|
32
|
+
### Removed
|
33
|
+
|
34
|
+
* Removed traces of legacy spork setup / help (No longer used) ([#518](https://github.com/cucumber/cucumber-rails/pull/518))
|
35
|
+
|
36
|
+
## [v2.3.0](https://github.com/cucumber/cucumber-rails/compare/v2.2.0...v2.3.0) (2021-03-30)
|
37
|
+
|
38
|
+
### Changed
|
39
|
+
|
40
|
+
* Changed dependency from rails to railties to avoid pulling in optional Rails gems like actioncable ([#486](https://github.com/cucumber/cucumber-rails/pull/486) [langalex])
|
41
|
+
|
42
|
+
* Lightened gem binary by removing un-needed files ([#496](https://github.com/cucumber/cucumber-rails/pull/496) [orien])
|
43
|
+
|
44
|
+
### Fixed
|
45
|
+
|
46
|
+
* Fixed up a couple of legacy capybara specs to use a better format ([#498](https://github.com/cucumber/cucumber-rails/pull/498) [luke-hill])
|
47
|
+
|
48
|
+
## [v2.2.0](https://github.com/cucumber/cucumber-rails/compare/v2.1.0...v2.2.0) (2020-08-10)
|
49
|
+
|
50
|
+
### New Features
|
51
|
+
|
52
|
+
* Added more documentation and tests around Javascript tagged scenarios
|
53
|
+
([#480](https://github.com/cucumber/cucumber-rails/pull/480) [luke-hill])
|
54
|
+
|
55
|
+
* Gem Updates
|
56
|
+
* Allowed cucumber5, updated other gem dependencies
|
57
|
+
* Updated travis runs and gem builds tested against
|
58
|
+
([#482](https://github.com/cucumber/cucumber-rails/pull/482) [luke-hill])
|
59
|
+
|
60
|
+
### Changed
|
61
|
+
|
62
|
+
* Dropped Rails 4.2 support ([#392](https://github.com/cucumber/cucumber-rails/pull/392) [deivid-rodriguez])
|
63
|
+
|
64
|
+
### Fixed
|
65
|
+
|
66
|
+
* Database cleaning no longer silently fails when using database_cleaner v2 adapter gems
|
67
|
+
([#467](https://github.com/cucumber/cucumber-rails/pull/467) [botandrose])
|
68
|
+
|
69
|
+
* Restored compatibility with `database_cleaner` versions earlier than 1.8.0.beta
|
70
|
+
([#473](https://github.com/cucumber/cucumber-rails/pull/473) [cgriego])
|
71
|
+
|
72
|
+
* Restored previous `database_cleaner` behavior for apps that do not use/load ActiveRecord
|
73
|
+
([#474](https://github.com/cucumber/cucumber-rails/pull/474) [cgriego])
|
74
|
+
|
75
|
+
* Restored previous compatibility around standard Rails Modules not being loaded
|
76
|
+
([#484](https://github.com/cucumber/cucumber-rails/pull/484) [Draiken])
|
77
|
+
|
78
|
+
## [v2.1.0](https://github.com/cucumber/cucumber-rails/compare/v2.0.0...v2.1.0) (2020-06-15)
|
79
|
+
|
80
|
+
### New Features
|
81
|
+
|
82
|
+
* Added metadata to allow gem to be searched / indexed by rubygems
|
83
|
+
([#447](https://github.com/cucumber/cucumber-rails/pull/447) [orien])
|
84
|
+
|
85
|
+
* Allow Cucumber 4 to be used as an option for cucumber-rails
|
86
|
+
* NB: Cucumber4 changes quite a lot of logic with auto-loaders. This means that any previous
|
87
|
+
logic that relied implicitly on load-order "may" be affected
|
88
|
+
([#453](https://github.com/cucumber/cucumber-rails/pull/453) [luke-hill] / [deivid-rodriguez])
|
89
|
+
|
90
|
+
### Changed
|
91
|
+
|
92
|
+
* Dropped Ruby 2.3 support (target 2.4 - 2.7) ([#466](https://github.com/cucumber/cucumber-rails/pull/466) [mvz])
|
93
|
+
|
94
|
+
* Refactored suite to remove a lot of old Rails3/4.0 "ism's"
|
95
|
+
* Also migrated a lot of old cucumber styles to cucumber4
|
96
|
+
([#441](https://github.com/cucumber/cucumber-rails/pull/441) [luke-hill])
|
97
|
+
|
98
|
+
* Refactored alias logic for overriding Rails methods to use `Module#prepend`
|
99
|
+
([#457](https://github.com/cucumber/cucumber-rails/pull/457) [wagenet])
|
100
|
+
|
101
|
+
* `database_cleaner` (when used), at a version `>= 1.8` will now silence all warnings
|
102
|
+
* The suite internally will only test a version `>= 1.8`, so other versions will work but are un-maintained
|
103
|
+
([#463](https://github.com/cucumber/cucumber-rails/pull/463) [deivid-rodriguez])
|
104
|
+
|
105
|
+
### Fixed
|
106
|
+
|
107
|
+
* Various rubocop / rspec styling fixes
|
108
|
+
([#445](https://github.com/cucumber/cucumber-rails/pull/445) /
|
109
|
+
[#449](https://github.com/cucumber/cucumber-rails/pull/449) /
|
110
|
+
[#450](https://github.com/cucumber/cucumber-rails/pull/450) /
|
111
|
+
[#451](https://github.com/cucumber/cucumber-rails/pull/451) /
|
112
|
+
[#452](https://github.com/cucumber/cucumber-rails/pull/452) /
|
113
|
+
[#465](https://github.com/cucumber/cucumber-rails/pull/465)
|
114
|
+
[mvz] / [luke-hill])
|
115
|
+
|
116
|
+
* Various CI fixes
|
117
|
+
([#444](https://github.com/cucumber/cucumber-rails/pull/444) /
|
118
|
+
[#460](https://github.com/cucumber/cucumber-rails/pull/460) /
|
119
|
+
[#464](https://github.com/cucumber/cucumber-rails/pull/464)
|
120
|
+
[mvz] / [damonjmurray] / [deivid-rodriguez])
|
121
|
+
|
122
|
+
* Avoid printing a warning about `config.cache_classes` being set to `false` when
|
123
|
+
Spring is used ([#462](https://github.com/cucumber/cucumber-rails/pull/462) [janko])
|
124
|
+
|
125
|
+
## [v2.0.0](https://github.com/cucumber/cucumber-rails/compare/v1.8.0...v2.0.0) (2019-09-13)
|
18
126
|
|
19
127
|
### New Features
|
20
128
|
|
@@ -26,7 +134,7 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
|
|
26
134
|
|
27
135
|
* **Breaking change:** `web_steps` have been completely removed from cucumber-rails
|
28
136
|
([#437](https://github.com/cucumber/cucumber-rails/pull/437) [luke-hill])
|
29
|
-
|
137
|
+
|
30
138
|
* Altered some branching logic in tests designed to cater for old ruby/rails versions
|
31
139
|
([#433](https://github.com/cucumber/cucumber-rails/pull/433) [luke-hill])
|
32
140
|
|
@@ -34,15 +142,15 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
|
|
34
142
|
|
35
143
|
### Changed
|
36
144
|
|
37
|
-
*
|
38
|
-
|
145
|
+
* Dropped Ruby 2.2 support (target 2.3 and up) ([#424](https://github.com/cucumber/cucumber-rails/pull/424) [mvz])
|
146
|
+
|
39
147
|
* Begin to update the core runtime / development dependencies to something a little more recent
|
40
148
|
([#413](https://github.com/cucumber/cucumber-rails/pull/413) /
|
41
149
|
[#431](https://github.com/cucumber/cucumber-rails/pull/431) /
|
42
150
|
[#432](https://github.com/cucumber/cucumber-rails/pull/432)
|
43
|
-
[mvz] /
|
151
|
+
[mvz] /
|
44
152
|
[luke-hill])
|
45
|
-
|
153
|
+
|
46
154
|
### Fixed
|
47
155
|
|
48
156
|
* Various rubocop / styling issues that had built up over time
|
@@ -54,21 +162,21 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
|
|
54
162
|
[#421](https://github.com/cucumber/cucumber-rails/pull/434)
|
55
163
|
[luke-hill] /
|
56
164
|
[mvz])
|
57
|
-
|
165
|
+
|
58
166
|
* Generic Travis Healthcheck (Fixed up polluted logs and use newer Ubuntu OS)
|
59
167
|
([#415](https://github.com/cucumber/cucumber-rails/pull/415) /
|
60
168
|
[#417](https://github.com/cucumber/cucumber-rails/pull/417)
|
61
169
|
[luke-hill])
|
62
|
-
|
170
|
+
|
63
171
|
* Rails6 not building correctly
|
64
172
|
([#418](https://github.com/cucumber/cucumber-rails/pull/418)
|
65
173
|
[luke-hill])
|
66
|
-
|
174
|
+
|
67
175
|
* Provisional Ruby 2.7 builds not working
|
68
176
|
([#427](https://github.com/cucumber/cucumber-rails/pull/427)
|
69
177
|
[amatsuda] /
|
70
178
|
[luke-hill])
|
71
|
-
|
179
|
+
|
72
180
|
## [v1.7.0](https://github.com/cucumber/cucumber-rails/compare/v1.6.0...v1.7.0) (2019-04-17)
|
73
181
|
|
74
182
|
### Changed
|
@@ -88,7 +196,7 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
|
|
88
196
|
[xtrasimplicity] /
|
89
197
|
[deivid-rodriguez] /
|
90
198
|
[mvz])
|
91
|
-
|
199
|
+
|
92
200
|
* Various build issues that had built up over the previous year
|
93
201
|
([#403](https://github.com/cucumber/cucumber-rails/pull/403) /
|
94
202
|
[#404](https://github.com/cucumber/cucumber-rails/pull/404) /
|
@@ -108,7 +216,7 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
|
|
108
216
|
* Switched to Ruby 1.9 hash syntax. ([#371](https://github.com/cucumber/cucumber-rails/pull/371) [mvz](https://github.com/mvz))
|
109
217
|
* Added support to handle rerun files with multiple lines. ([#373]((https://github.com/cucumber/cucumber-rails/pull/345)) [mvz](https://github.com/mvz))
|
110
218
|
* Added support for Rails 5.2 and Capybara 3. ([#378](https://github.com/cucumber/cucumber-rails/pull/378/) [gobijan](https://github.com/gobijan), [radar](https://github.com/radar), [xtrasimplicity](https://github.com/xtrasimplicity))
|
111
|
-
|
219
|
+
|
112
220
|
### Fixed
|
113
221
|
|
114
222
|
* Fix typo ([#343](https://github.com/cucumber/cucumber-rails/pull/343) Olle Jonsson)
|
@@ -123,7 +231,7 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
|
|
123
231
|
## [v1.4.5](https://github.com/cucumber/cucumber-rails/compare/1.4.4...1.4.5) (2016-09-27)
|
124
232
|
|
125
233
|
* Add support for Cucumber 3+ (Steve Tooke)
|
126
|
-
|
234
|
+
|
127
235
|
## [v1.4.4](https://github.com/cucumber/cucumber-rails/compare/1.4.3...1.4.4) (2016-08-05)
|
128
236
|
|
129
237
|
* Ensure support for Rails 5
|
@@ -567,3 +675,12 @@ and to celebrate that cucumber-rails now supports Capybara as an alternative to
|
|
567
675
|
[luke-hill]: https://github.com/luke-hill
|
568
676
|
[amatsuda]: https://github.com/amatsuda
|
569
677
|
[xtrasimplicity]: https://github.com/xtrasimplicity
|
678
|
+
[janko]: https://github.com/janko
|
679
|
+
[damonjmurray]: https://github.com/damonjmurray
|
680
|
+
[orien]: https://github.com/orien
|
681
|
+
[wagenet]: https://github.com/wagenet
|
682
|
+
[cgriego]: https://github.com/cgriego
|
683
|
+
[botandrose]: https://github.com/botandrose
|
684
|
+
[Draiken]: https://github.com/Draiken
|
685
|
+
[langalex]: https://github.com/langalex
|
686
|
+
[orien]: https://github.com/orien
|
data/CONTRIBUTING.md
CHANGED
@@ -29,11 +29,23 @@ This document is a guide for those maintaining Cucumber-Rails, and others who wo
|
|
29
29
|
bundle install
|
30
30
|
bin/install_geckodriver.sh
|
31
31
|
bin/install_webpacker.sh
|
32
|
-
# Then to run tests on one specific
|
33
|
-
bundle exec appraisal
|
32
|
+
# Then to run tests on one version-specific Gemfile (e.g. gemfiles/rails_6_0.gemfile), run
|
33
|
+
bundle exec appraisal rails_6_0 rake test
|
34
34
|
# Or run tests across the full supported stack. Note that because we support many versions. This takes 5-10 minutes
|
35
35
|
bundle exec rake appraisal
|
36
36
|
|
37
|
+
## Updating Appraisal gems / dependencies of cucumber-rails
|
38
|
+
|
39
|
+
To remove and rebuild the different gemfiles (for example, to update a rails version or its
|
40
|
+
dependencies), use the following:
|
41
|
+
|
42
|
+
[bundle exec] appraisal update
|
43
|
+
|
44
|
+
If you've changed versions of the dependencies, you may find it helpful to forcefully clean
|
45
|
+
each appraisal's gem lock file in `gemfiles/`. You can do this using:
|
46
|
+
|
47
|
+
[bundle exec] rake clean
|
48
|
+
|
37
49
|
## Release Process
|
38
50
|
|
39
51
|
* Make sure `CHANGELOG.md` is updated with the upcoming version number, and has entries for all fixes.
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License
|
2
2
|
|
3
|
-
Copyright (c) 2008-
|
3
|
+
Copyright (c) 2008-2020 Aslak Hellesøy and the Cucumber Team.
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
6
6
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# Cucumber-Rails
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/cucumber-rails.svg)](http://badge.fury.io/rb/cucumber-rails)
|
4
|
-
[![Build Status](https://
|
4
|
+
[![Build Status](https://github.com/cucumber/cucumber-rails/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/cucumber/cucumber-rails/actions/workflows/build.yml)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/cucumber/cucumber-rails.svg)](https://codeclimate.com/github/cucumber/cucumber-rails)
|
6
6
|
[![Open Source Helpers](https://www.codetriage.com/cucumber/cucumber-rails/badges/users.svg)](https://www.codetriage.com/cucumber/cucumber-rails)
|
7
|
+
[![pull requests](https://oselvar.com/api/badge?label=pull%20requests&csvUrl=https%3A%2F%2Fraw.githubusercontent.com%2Fcucumber%2Foselvar-github-metrics%2Fmain%2Fdata%2Fcucumber%2Fcucumber-rails%2FpullRequests.csv)](https://oselvar.com/github/cucumber/oselvar-github-metrics/main/cucumber/cucumber-rails)
|
8
|
+
[![issues](https://oselvar.com/api/badge?label=issues&csvUrl=https%3A%2F%2Fraw.githubusercontent.com%2Fcucumber%2Foselvar-github-metrics%2Fmain%2Fdata%2Fcucumber%2Fcucumber-rails%2Fissues.csv)](https://oselvar.com/github/cucumber/oselvar-github-metrics/main/cucumber/cucumber-rails)
|
7
9
|
|
8
|
-
Cucumber-Rails brings Cucumber to Rails
|
10
|
+
Cucumber-Rails brings Cucumber to Rails 5.x and 6.x.
|
9
11
|
|
10
12
|
## Installation
|
11
13
|
|
@@ -108,17 +110,7 @@ all gemfiles, run the following commands:
|
|
108
110
|
|
109
111
|
To run the suite against a named gemfile, use the following:
|
110
112
|
|
111
|
-
[bundle exec] appraisal
|
112
|
-
|
113
|
-
To remove and rebuild the different gemfiles (for example, to update a rails version or its
|
114
|
-
dependencies), use the following:
|
115
|
-
|
116
|
-
[bundle exec] appraisal update
|
117
|
-
|
118
|
-
If you've changed versions of the dependencies, you may find it helpful to forcefully clean
|
119
|
-
each appraisal's gem lock file in `gemfiles/`. You can do this using:
|
120
|
-
|
121
|
-
[bundle exec] rake clean
|
113
|
+
[bundle exec] appraisal rails_6_0 rake test
|
122
114
|
|
123
115
|
### Adding dependencies
|
124
116
|
|
@@ -133,14 +125,3 @@ For example, rspec is a primary development dependency, so it lives in the gemsp
|
|
133
125
|
|
134
126
|
[the helper]: https://github.com/cucumber/cucumber-rails/blob/5e37c530560ae1c1a79521c38a54bae0be94242b/features/step_definitions/cucumber_rails_steps.rb#L15
|
135
127
|
|
136
|
-
### NOTE
|
137
|
-
|
138
|
-
If you get an error while trying to run the tests locally, similar to the one below:
|
139
|
-
|
140
|
-
Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
|
141
|
-
|
142
|
-
You need to install a javascript runtime.
|
143
|
-
|
144
|
-
You can do that in ubuntu by using:
|
145
|
-
|
146
|
-
sudo apt-get install nodejs
|
data/lib/cucumber/rails.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
called_from_env_rb = caller.detect { |f| f
|
3
|
+
called_from_env_rb = caller.detect { |f| f.include? '/env.rb:' }
|
4
4
|
|
5
5
|
if called_from_env_rb
|
6
6
|
env_caller = File.dirname(called_from_env_rb)
|
@@ -8,26 +8,24 @@ if called_from_env_rb
|
|
8
8
|
require 'rails'
|
9
9
|
require 'cucumber/rails/application'
|
10
10
|
ENV['RAILS_ENV'] ||= 'test'
|
11
|
-
ENV['RAILS_ROOT'] ||= File.expand_path(env_caller
|
12
|
-
require File.expand_path(ENV['RAILS_ROOT']
|
13
|
-
require 'cucumber/rails/
|
11
|
+
ENV['RAILS_ROOT'] ||= File.expand_path("#{env_caller}/../..")
|
12
|
+
require File.expand_path("#{ENV['RAILS_ROOT']}/config/environment")
|
13
|
+
require 'cucumber/rails/action_dispatch'
|
14
|
+
require 'rails/test_help'
|
14
15
|
|
15
|
-
|
16
|
-
require 'rails/test_help'
|
17
|
-
else
|
18
|
-
require 'action_dispatch/testing/test_process'
|
19
|
-
require 'action_dispatch/testing/integration'
|
20
|
-
end
|
21
|
-
|
22
|
-
unless Rails.application.config.cache_classes
|
16
|
+
unless Rails.application.config.cache_classes || defined?(Spring)
|
23
17
|
warn "WARNING: You have set Rails' config.cache_classes to false
|
24
|
-
(
|
18
|
+
(Spring needs cache_classes set to false). This is known to cause problems
|
25
19
|
with database transactions. Set config.cache_classes to true if you want to use transactions."
|
26
20
|
end
|
27
21
|
|
28
22
|
require 'cucumber/rails/world'
|
29
23
|
require 'cucumber/rails/hooks'
|
30
24
|
require 'cucumber/rails/capybara'
|
25
|
+
require 'cucumber/rails/database/strategy'
|
26
|
+
require 'cucumber/rails/database/deletion_strategy'
|
27
|
+
require 'cucumber/rails/database/shared_connection_strategy'
|
28
|
+
require 'cucumber/rails/database/truncation_strategy'
|
31
29
|
require 'cucumber/rails/database'
|
32
30
|
|
33
31
|
MultiTest.disable_autorun
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
ActionController::Base.class_eval do
|
4
|
+
cattr_accessor :allow_rescue
|
5
|
+
end
|
6
|
+
|
7
|
+
module Cucumber
|
8
|
+
module Rails
|
9
|
+
module ActionDispatch
|
10
|
+
module ShowExceptions
|
11
|
+
def call(env)
|
12
|
+
env['action_dispatch.show_detailed_exceptions'] = !ActionController::Base.allow_rescue
|
13
|
+
env['action_dispatch.show_exceptions'] = !env['action_dispatch.show_detailed_exceptions']
|
14
|
+
super(env)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
ActionDispatch::ShowExceptions.prepend(Cucumber::Rails::ActionDispatch::ShowExceptions)
|
@@ -7,17 +7,20 @@ require 'rails/application'
|
|
7
7
|
# Instead we are overriding ActionDispatch::ShowExceptions to be able to
|
8
8
|
# toggle whether or not exceptions are raised.
|
9
9
|
|
10
|
-
module
|
11
|
-
|
12
|
-
|
10
|
+
module Cucumber
|
11
|
+
module Rails
|
12
|
+
module Application
|
13
|
+
def initialize!
|
14
|
+
ad = config.action_dispatch
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
+
def ad.show_exceptions
|
17
|
+
true
|
18
|
+
end
|
16
19
|
|
17
|
-
|
18
|
-
true
|
20
|
+
super
|
19
21
|
end
|
20
|
-
__cucumber_orig_initialize__
|
21
22
|
end
|
22
23
|
end
|
23
24
|
end
|
25
|
+
|
26
|
+
Rails::Application.prepend(Cucumber::Rails::Application)
|
@@ -48,27 +48,38 @@ module Cucumber
|
|
48
48
|
js_form['action'] = action
|
49
49
|
js_form['method'] = method
|
50
50
|
|
51
|
-
|
52
|
-
input = document.create_element('input')
|
53
|
-
input['type'] = 'hidden'
|
54
|
-
input['name'] = '_method'
|
55
|
-
input['value'] = emulated_method
|
56
|
-
js_form.add_child(input)
|
57
|
-
end
|
51
|
+
add_hidden_method_input(document, js_form) unless same?(emulated_method, method)
|
58
52
|
|
59
|
-
# rails will wipe the session if the CSRF token is not sent
|
60
|
-
|
61
|
-
if csrf? && !emulated_method.casecmp('get').zero?
|
62
|
-
input = document.create_element('input')
|
63
|
-
input['type'] = 'hidden'
|
64
|
-
input['name'] = csrf_param
|
65
|
-
input['value'] = csrf_token
|
66
|
-
js_form.add_child(input)
|
67
|
-
end
|
53
|
+
# rails will wipe the session if the CSRF token is not sent with non-GET requests
|
54
|
+
add_hidden_csrf_input(document, js_form) if csrf? && !get?(emulated_method)
|
68
55
|
|
69
56
|
js_form
|
70
57
|
end
|
71
58
|
|
59
|
+
def same?(emulated_method, method)
|
60
|
+
emulated_method.casecmp(method).zero?
|
61
|
+
end
|
62
|
+
|
63
|
+
def add_hidden_method_input(document, js_form)
|
64
|
+
input = document.create_element('input')
|
65
|
+
input['type'] = 'hidden'
|
66
|
+
input['name'] = '_method'
|
67
|
+
input['value'] = emulated_method
|
68
|
+
js_form.add_child(input)
|
69
|
+
end
|
70
|
+
|
71
|
+
def get?(emulated_method)
|
72
|
+
same?(emulated_method, 'get')
|
73
|
+
end
|
74
|
+
|
75
|
+
def add_hidden_csrf_input(document, js_form)
|
76
|
+
input = document.create_element('input')
|
77
|
+
input['type'] = 'hidden'
|
78
|
+
input['name'] = csrf_param
|
79
|
+
input['value'] = csrf_token
|
80
|
+
js_form.add_child(input)
|
81
|
+
end
|
82
|
+
|
72
83
|
def link_with_non_get_http_method?
|
73
84
|
tag_name == 'a' &&
|
74
85
|
element_node['data-method'] &&
|