gherkin_system 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +22 -3
- data/lib/generators/gherkin/feature/feature_generator.rb +18 -0
- data/lib/generators/gherkin/gherkin_generator.rb +12 -0
- data/lib/generators/gherkin/install/install_generator.rb +28 -0
- data/lib/generators/gherkin/steps/steps_generator.rb +28 -0
- data/lib/generators/gherkin_system/feature/feature_generator.rb +4 -10
- data/lib/generators/gherkin_system/install/install_generator.rb +4 -20
- data/lib/generators/gherkin_system/steps/steps_generator.rb +4 -20
- data/lib/gherkin_system/version.rb +1 -1
- data/skills/gherkin-system/SKILL.md +21 -2
- metadata +8 -4
- /data/lib/generators/{gherkin_system → gherkin}/feature/templates/feature.feature.tt +0 -0
- /data/lib/generators/{gherkin_system → gherkin}/install/templates/gherkin_test.rb +0 -0
- /data/lib/generators/{gherkin_system → gherkin}/steps/templates/steps.rb.tt +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fe2f737790d08aa61ad7a5ae85b770725144c2c1fd9f0beed703742097e06efb
|
|
4
|
+
data.tar.gz: 0ae13e39a441aaec9dd0aa3d23eef69799881fa45f423da1327f428095a1dd1c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 482ec736ed840dc67fde03134e8c05bccf5d120b27c1585712c62d81f222d21f5f6f452d215e91363af2d31b028e2da17dee4212c9071629e8d95cbb8d7a11cf
|
|
7
|
+
data.tar.gz: d5db2a103d97563f0a65e06f76e4be9312ea38822440c34e6b3b226dbaf09b2e709d2739563cd862aad77f3842fc99030ca436792186356d4998639cc9ae5261
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.4.0] - 2026-10-04
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `rails g gherkin` runs the install generator, matching `rails g gherkin:install`
|
|
15
|
+
- README and application skill document how to wait for navigation before URL assertions in step definitions
|
|
16
|
+
|
|
17
|
+
## [0.3.0] - 2026-10-04
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Generator commands use `gherkin:install`, `gherkin:feature NAME`, and `gherkin:steps NAME`, matching the existing `rails gherkin` commands
|
|
22
|
+
- README and application skill use the shorter generator namespace
|
|
23
|
+
- Existing `gherkin_system:` generator commands remain available for compatibility
|
|
24
|
+
|
|
10
25
|
## [0.2.0] - 2026-10-04
|
|
11
26
|
|
|
12
27
|
### Changed
|
data/README.md
CHANGED
|
@@ -15,9 +15,9 @@ gem "gherkin_system"
|
|
|
15
15
|
|
|
16
16
|
```sh
|
|
17
17
|
bundle install
|
|
18
|
-
bin/rails g
|
|
19
|
-
bin/rails g
|
|
20
|
-
bin/rails g
|
|
18
|
+
bin/rails g gherkin:install
|
|
19
|
+
bin/rails g gherkin:feature checkout
|
|
20
|
+
bin/rails g gherkin:steps checkout
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
`install` creates `test/system/gherkin_test.rb`, `features/`, and `test/support/gherkin/`. `feature` and `steps` add a `.feature` file and a steps module; wire the module into the loader with `require_relative` and `config.include_steps`.
|
|
@@ -98,6 +98,25 @@ end
|
|
|
98
98
|
|
|
99
99
|
`Given`, `When`, `Then`, `And`, and `But` share one registry. Blocks run with `instance_exec` on the system test, so instance variables set in one step are visible in the next.
|
|
100
100
|
|
|
101
|
+
## Wait for navigation
|
|
102
|
+
|
|
103
|
+
After a step triggers navigation, assert visible page content or use a Capybara waiting assertion. Do not compare `current_path` directly. A direct comparison does not wait for navigation.
|
|
104
|
+
|
|
105
|
+
```ruby
|
|
106
|
+
When("I open an order") do
|
|
107
|
+
click_on "Order details"
|
|
108
|
+
assert_current_path(/\/orders\/\d+/, url: true)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
When("I stay on the orders page") do
|
|
112
|
+
click_on "Refresh orders"
|
|
113
|
+
assert_selector "h1", text: "Orders"
|
|
114
|
+
refute_current_path(/\/orders\/\d+\/details/)
|
|
115
|
+
end
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
For a negative URL check, first assert content that only the destination page shows. This prevents a check from passing before the browser navigates.
|
|
119
|
+
|
|
101
120
|
## Hooks
|
|
102
121
|
|
|
103
122
|
```ruby
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rails/generators"
|
|
4
|
+
|
|
5
|
+
module Gherkin
|
|
6
|
+
module Generators
|
|
7
|
+
# Creates a Gherkin feature under features.
|
|
8
|
+
class FeatureGenerator < Rails::Generators::NamedBase
|
|
9
|
+
source_root File.expand_path("templates", __dir__)
|
|
10
|
+
|
|
11
|
+
desc "Creates a Gherkin feature file under features"
|
|
12
|
+
|
|
13
|
+
def create_feature
|
|
14
|
+
template "feature.feature.tt", File.join("features", "#{file_path}.feature")
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "generators/gherkin/install/install_generator"
|
|
4
|
+
|
|
5
|
+
module Gherkin
|
|
6
|
+
module Generators
|
|
7
|
+
# Runs the install generator for the bare gherkin command.
|
|
8
|
+
class GherkinGenerator < InstallGenerator
|
|
9
|
+
source_root InstallGenerator.source_root
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rails/generators"
|
|
4
|
+
|
|
5
|
+
module Gherkin
|
|
6
|
+
module Generators
|
|
7
|
+
# Scaffolds the loader, feature directory, and steps support directory.
|
|
8
|
+
class InstallGenerator < Rails::Generators::Base
|
|
9
|
+
source_root File.expand_path("templates", __dir__)
|
|
10
|
+
|
|
11
|
+
desc "Creates a Gherkin loader, features, and test/support/gherkin"
|
|
12
|
+
|
|
13
|
+
def create_loader
|
|
14
|
+
template "gherkin_test.rb", "test/system/gherkin_test.rb"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def create_features_directory
|
|
18
|
+
empty_directory "features"
|
|
19
|
+
create_file "features/.keep", ""
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def create_steps_directory
|
|
23
|
+
empty_directory "test/support/gherkin"
|
|
24
|
+
create_file "test/support/gherkin/.keep", ""
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rails/generators"
|
|
4
|
+
|
|
5
|
+
module Gherkin
|
|
6
|
+
module Generators
|
|
7
|
+
# Creates a step definition module under test/support/gherkin.
|
|
8
|
+
class StepsGenerator < Rails::Generators::NamedBase
|
|
9
|
+
source_root File.expand_path("templates", __dir__)
|
|
10
|
+
|
|
11
|
+
desc "Creates a Gherkin steps module under test/support/gherkin"
|
|
12
|
+
|
|
13
|
+
def create_steps
|
|
14
|
+
template "steps.rb.tt", File.join("test/support/gherkin", "#{file_path}_steps.rb")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def remind_loader_wiring
|
|
18
|
+
say "Remember to require and include #{steps_module_name} in test/system/gherkin_test.rb", :green
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def steps_module_name
|
|
24
|
+
"#{class_name}Steps"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "
|
|
3
|
+
require "generators/gherkin/feature/feature_generator"
|
|
4
4
|
|
|
5
5
|
module GherkinSystem
|
|
6
6
|
module Generators
|
|
7
|
-
#
|
|
8
|
-
class FeatureGenerator <
|
|
9
|
-
source_root
|
|
10
|
-
|
|
11
|
-
desc "Creates a Gherkin feature file under features"
|
|
12
|
-
|
|
13
|
-
def create_feature
|
|
14
|
-
template "feature.feature.tt", File.join("features", "#{file_path}.feature")
|
|
15
|
-
end
|
|
7
|
+
# Keeps the original generator command available.
|
|
8
|
+
class FeatureGenerator < Gherkin::Generators::FeatureGenerator
|
|
9
|
+
source_root Gherkin::Generators::FeatureGenerator.source_root
|
|
16
10
|
end
|
|
17
11
|
end
|
|
18
12
|
end
|
|
@@ -1,28 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "
|
|
3
|
+
require "generators/gherkin/install/install_generator"
|
|
4
4
|
|
|
5
5
|
module GherkinSystem
|
|
6
6
|
module Generators
|
|
7
|
-
#
|
|
8
|
-
class InstallGenerator <
|
|
9
|
-
source_root
|
|
10
|
-
|
|
11
|
-
desc "Creates gherkin_system loader, features, and test/support/gherkin"
|
|
12
|
-
|
|
13
|
-
def create_loader
|
|
14
|
-
template "gherkin_test.rb", "test/system/gherkin_test.rb"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def create_features_directory
|
|
18
|
-
empty_directory "features"
|
|
19
|
-
create_file "features/.keep", ""
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def create_steps_directory
|
|
23
|
-
empty_directory "test/support/gherkin"
|
|
24
|
-
create_file "test/support/gherkin/.keep", ""
|
|
25
|
-
end
|
|
7
|
+
# Keeps the original generator command available.
|
|
8
|
+
class InstallGenerator < Gherkin::Generators::InstallGenerator
|
|
9
|
+
source_root Gherkin::Generators::InstallGenerator.source_root
|
|
26
10
|
end
|
|
27
11
|
end
|
|
28
12
|
end
|
|
@@ -1,28 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "
|
|
3
|
+
require "generators/gherkin/steps/steps_generator"
|
|
4
4
|
|
|
5
5
|
module GherkinSystem
|
|
6
6
|
module Generators
|
|
7
|
-
#
|
|
8
|
-
class StepsGenerator <
|
|
9
|
-
source_root
|
|
10
|
-
|
|
11
|
-
desc "Creates a gherkin_system steps module under test/support/gherkin"
|
|
12
|
-
|
|
13
|
-
def create_steps
|
|
14
|
-
template "steps.rb.tt", File.join("test/support/gherkin", "#{file_path}_steps.rb")
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def remind_loader_wiring
|
|
18
|
-
say "Remember to require and include #{steps_module_name} in test/system/gherkin_test.rb", :green
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
private
|
|
22
|
-
|
|
23
|
-
def steps_module_name
|
|
24
|
-
"#{class_name}Steps"
|
|
25
|
-
end
|
|
7
|
+
# Keeps the original generator command available.
|
|
8
|
+
class StepsGenerator < Gherkin::Generators::StepsGenerator
|
|
9
|
+
source_root Gherkin::Generators::StepsGenerator.source_root
|
|
26
10
|
end
|
|
27
11
|
end
|
|
28
12
|
end
|
|
@@ -14,7 +14,7 @@ Do not add cucumber-rails, a Cucumber World, or a second test runner. Do not use
|
|
|
14
14
|
|
|
15
15
|
## Add a scenario
|
|
16
16
|
|
|
17
|
-
1. Scaffold with `bin/rails g
|
|
17
|
+
1. Scaffold with `bin/rails g gherkin:feature NAME` and `bin/rails g gherkin:steps NAME` (or write the files by hand under `features/**/*.feature` and `test/support/gherkin/*_steps.rb`).
|
|
18
18
|
2. Require the steps file from `test/system/gherkin_test.rb` before `GherkinSystem.load!`.
|
|
19
19
|
3. Run `bin/rails gherkin:check`.
|
|
20
20
|
4. Run the scenario with `bin/rails gherkin path/to/file.feature:LINE`.
|
|
@@ -22,7 +22,7 @@ Do not add cucumber-rails, a Cucumber World, or a second test runner. Do not use
|
|
|
22
22
|
Create the loader once if it is missing:
|
|
23
23
|
|
|
24
24
|
```sh
|
|
25
|
-
bin/rails g
|
|
25
|
+
bin/rails g gherkin:install
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
Then require step modules and register them before `load!`:
|
|
@@ -87,6 +87,25 @@ end
|
|
|
87
87
|
- Prefer Cucumber Expressions (`{string}`, `{int}`). Use a regex only to match an existing definition.
|
|
88
88
|
- Data tables arrive as an object with `#hashes` (string keys) and `#raw`. Doc strings arrive as the content string.
|
|
89
89
|
|
|
90
|
+
## Wait for navigation
|
|
91
|
+
|
|
92
|
+
After a step triggers navigation, assert visible page content or use a Capybara waiting assertion. Do not compare `current_path` directly. A direct comparison does not wait for navigation.
|
|
93
|
+
|
|
94
|
+
```ruby
|
|
95
|
+
When("I open an order") do
|
|
96
|
+
click_on "Order details"
|
|
97
|
+
assert_current_path(/\/orders\/\d+/, url: true)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
When("I stay on the orders page") do
|
|
101
|
+
click_on "Refresh orders"
|
|
102
|
+
assert_selector "h1", text: "Orders"
|
|
103
|
+
refute_current_path(/\/orders\/\d+\/details/)
|
|
104
|
+
end
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
For a negative URL check, first assert content that only the destination page shows. This prevents a check from passing before the browser navigates.
|
|
108
|
+
|
|
90
109
|
## Hooks
|
|
91
110
|
|
|
92
111
|
```ruby
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gherkin_system
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Paluy
|
|
@@ -98,12 +98,16 @@ files:
|
|
|
98
98
|
- LICENSE
|
|
99
99
|
- LICENSE.txt
|
|
100
100
|
- README.md
|
|
101
|
+
- lib/generators/gherkin/feature/feature_generator.rb
|
|
102
|
+
- lib/generators/gherkin/feature/templates/feature.feature.tt
|
|
103
|
+
- lib/generators/gherkin/gherkin_generator.rb
|
|
104
|
+
- lib/generators/gherkin/install/install_generator.rb
|
|
105
|
+
- lib/generators/gherkin/install/templates/gherkin_test.rb
|
|
106
|
+
- lib/generators/gherkin/steps/steps_generator.rb
|
|
107
|
+
- lib/generators/gherkin/steps/templates/steps.rb.tt
|
|
101
108
|
- lib/generators/gherkin_system/feature/feature_generator.rb
|
|
102
|
-
- lib/generators/gherkin_system/feature/templates/feature.feature.tt
|
|
103
109
|
- lib/generators/gherkin_system/install/install_generator.rb
|
|
104
|
-
- lib/generators/gherkin_system/install/templates/gherkin_test.rb
|
|
105
110
|
- lib/generators/gherkin_system/steps/steps_generator.rb
|
|
106
|
-
- lib/generators/gherkin_system/steps/templates/steps.rb.tt
|
|
107
111
|
- lib/gherkin_system.rb
|
|
108
112
|
- lib/gherkin_system/checker.rb
|
|
109
113
|
- lib/gherkin_system/cli.rb
|
|
File without changes
|
|
File without changes
|
|
File without changes
|