shoulda-matchers-cucumber 1.0.0 → 2.0.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/.forgejo/workflows/test.yml +38 -0
- data/.gitignore +3 -1
- data/CHANGELOG.md +7 -0
- data/README.md +25 -4
- data/gemfiles/legacy.gemfile +8 -0
- data/gemfiles/rails_7_0.gemfile +8 -0
- data/gemfiles/rails_7_2.gemfile +8 -0
- data/gemfiles/rails_8_1.gemfile +8 -0
- data/lib/shoulda/matchers/cucumber/version.rb +1 -1
- data/lib/shoulda/matchers/cucumber.rb +1 -0
- data/lib/shoulda/matchers/integrations/test_frameworks/cucumber.rb +12 -9
- data/shoulda-matchers-cucumber.gemspec +6 -6
- metadata +55 -26
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 824f03fd5bed53147cd0b3815d940a19f7494e3236f6c44a2d98b8d1779fefa0
|
|
4
|
+
data.tar.gz: 33767e0469e08971115e022690e414b1a4b4bf837caf20a4f59244165fed3008
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9168bbcb522d642f58405a0500222cc6095ac8e052db0f950a084d23097e51eaab99774655754ed4777873a07066dd1feff58e021574de42b8041a3018c80e86
|
|
7
|
+
data.tar.gz: 3ae38635218a9d497ac0bc043f197951a998a80c4bc604f9e1bc9aaead6aa5fbbf04536cdba56a8b1e60eadebb0851aabd51b1dbf71b9916dc2be69930407af9
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Cucumber compatibility
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: codeberg-medium
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
include:
|
|
15
|
+
- image: ruby:3.1-bookworm
|
|
16
|
+
gemfile: gemfiles/legacy.gemfile
|
|
17
|
+
- image: ruby:3.1-bookworm
|
|
18
|
+
gemfile: gemfiles/rails_7_0.gemfile
|
|
19
|
+
- image: ruby:3.4-bookworm
|
|
20
|
+
gemfile: gemfiles/rails_7_2.gemfile
|
|
21
|
+
- image: ruby:3.4-bookworm
|
|
22
|
+
gemfile: gemfiles/rails_8_1.gemfile
|
|
23
|
+
container:
|
|
24
|
+
image: ${{ matrix.image }}
|
|
25
|
+
env:
|
|
26
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
|
27
|
+
steps:
|
|
28
|
+
- name: Install bootstrap Node.js and SQLite headers
|
|
29
|
+
run: |
|
|
30
|
+
apt-get update
|
|
31
|
+
apt-get install -y --no-install-recommends nodejs libsqlite3-dev
|
|
32
|
+
- uses: https://code.forgejo.org/actions/checkout@v4
|
|
33
|
+
with:
|
|
34
|
+
persist-credentials: false
|
|
35
|
+
- name: Install dependencies and run the integration suite
|
|
36
|
+
run: |
|
|
37
|
+
bundle install --jobs 4 --retry 3
|
|
38
|
+
bundle exec rspec
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
[2.0.0]:
|
|
2
|
+
|
|
3
|
+
- Register Shoulda matchers and RSpec matchers in Cucumber World. Code that used Shoulda matchers outside Cucumber must configure its own test framework.
|
|
4
|
+
- Require and configure the adapter in `features/support/env.rb` so Cucumber can register the matchers while loading its support files. The adapter loads `rspec/expectations` automatically.
|
|
5
|
+
- Support Cucumber 5–12 and Shoulda Matchers 3–8.
|
|
6
|
+
- Run integration tests for the legacy dependency profile and Rails 7.0, 7.2, and 8.1 in CI.
|
|
7
|
+
|
|
1
8
|
[0.1.0]:
|
|
2
9
|
+ integration module supporting the rspec-exceptation syntax in the cucumber
|
|
3
10
|
+ rspec test for the gem
|
data/README.md
CHANGED
|
@@ -40,17 +40,38 @@ Or install it yourself as:
|
|
|
40
40
|
Now you can use matchers in your tests as for Cucumber without picking-up the whole RSpec suite.
|
|
41
41
|
|
|
42
42
|
## Configuring
|
|
43
|
-
|
|
43
|
+
Require the adapter in `features/support/env.rb`, then select `:cucumber` and
|
|
44
|
+
the libraries needed by your steps:
|
|
44
45
|
|
|
45
46
|
``` ruby
|
|
47
|
+
require 'shoulda-matchers/cucumber'
|
|
48
|
+
|
|
46
49
|
Shoulda::Matchers.configure do |config|
|
|
47
50
|
config.integrate do |with|
|
|
48
|
-
with.test_framework
|
|
49
|
-
|
|
51
|
+
with.test_framework(:cucumber)
|
|
52
|
+
with.library(:active_model)
|
|
53
|
+
with.library(:active_record)
|
|
50
54
|
end
|
|
51
55
|
end
|
|
52
56
|
```
|
|
53
57
|
|
|
58
|
+
The adapter loads RSpec Expectations and includes the selected matchers in the
|
|
59
|
+
Cucumber World. It does not load RSpec Core or change `RSpec::Matchers` globally.
|
|
60
|
+
Both `shoulda-matchers/cucumber` and `shoulda/matchers/cucumber` are supported.
|
|
61
|
+
The supported dependency ranges are Cucumber 5–12 and Shoulda Matchers 3–8;
|
|
62
|
+
each release must also support the Ruby and Rails versions in your bundle.
|
|
63
|
+
|
|
64
|
+
Run the integration suite with a compatibility profile, for example:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
BUNDLE_GEMFILE=gemfiles/rails_7_0.gemfile bundle install
|
|
68
|
+
BUNDLE_GEMFILE=gemfiles/rails_7_0.gemfile bundle exec rspec
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The other profiles are `legacy`, `rails_7_2`, and `rails_8_1`. They exercise real
|
|
72
|
+
Cucumber scenarios with model and database matchers using an isolated SQLite
|
|
73
|
+
database.
|
|
74
|
+
|
|
54
75
|
## Usage
|
|
55
76
|
|
|
56
77
|
Write your cucumer rules as usual:
|
|
@@ -63,7 +84,7 @@ Scenario: Valid model of User
|
|
|
63
84
|
Then the model is valid
|
|
64
85
|
```
|
|
65
86
|
|
|
66
|
-
Then write its steps using
|
|
87
|
+
Then write its steps using shoulda matchers' syntax:
|
|
67
88
|
|
|
68
89
|
```ruby
|
|
69
90
|
Given("default User model") do
|
|
@@ -5,21 +5,17 @@ module Shoulda
|
|
|
5
5
|
module Integrations
|
|
6
6
|
module TestFrameworks
|
|
7
7
|
# @private
|
|
8
|
-
class
|
|
8
|
+
class Cucumber
|
|
9
9
|
Integrations.register_test_framework(self, :cucumber)
|
|
10
10
|
|
|
11
11
|
def validate!
|
|
12
|
-
return if defined?
|
|
13
|
-
raise TestFrameworkNotFound, <<-EOT
|
|
14
|
-
You have to include the 'rspec-expectations' gem to Gemfile, and add
|
|
15
|
-
the line before requiring the shoulda matchers:
|
|
12
|
+
return if defined?(::Cucumber::Glue::Dsl)
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
EOT
|
|
14
|
+
raise_error
|
|
19
15
|
end
|
|
20
16
|
|
|
21
|
-
def include
|
|
22
|
-
RSpec::Matchers
|
|
17
|
+
def include *modules, **_options
|
|
18
|
+
Object.new.extend(::Cucumber::Glue::Dsl).World(::RSpec::Matchers, *modules)
|
|
23
19
|
end
|
|
24
20
|
|
|
25
21
|
def n_unit?
|
|
@@ -29,6 +25,13 @@ EOT
|
|
|
29
25
|
def present?
|
|
30
26
|
true
|
|
31
27
|
end
|
|
28
|
+
|
|
29
|
+
def raise_error
|
|
30
|
+
raise TestFrameworkNotFound, <<-EOT
|
|
31
|
+
Load and configure shoulda-matchers-cucumber from features/support/env.rb
|
|
32
|
+
while Cucumber is loading the support code.
|
|
33
|
+
EOT
|
|
34
|
+
end
|
|
32
35
|
end
|
|
33
36
|
end
|
|
34
37
|
end
|
|
@@ -40,12 +40,12 @@ Gem::Specification.new do |spec|
|
|
|
40
40
|
spec.add_development_dependency "rake", "~> 13.0"
|
|
41
41
|
spec.add_development_dependency "rspec", "~> 3.0"
|
|
42
42
|
spec.add_development_dependency "pry", "~> 0.13.1"
|
|
43
|
-
spec.add_development_dependency "rails", "
|
|
44
|
-
spec.add_development_dependency "pg", "
|
|
45
|
-
spec.add_development_dependency "bootsnap", "
|
|
43
|
+
spec.add_development_dependency "rails", ">= 7.0", "< 9.0"
|
|
44
|
+
spec.add_development_dependency "pg", ">= 1.2", "< 2.0"
|
|
45
|
+
spec.add_development_dependency "bootsnap", ">= 1.4", "< 2.0"
|
|
46
46
|
spec.add_development_dependency "listen", "~> 3.0.5"
|
|
47
|
-
spec.add_development_dependency "cucumber-rails", "~> 2.
|
|
48
|
-
spec.add_runtime_dependency "shoulda-matchers", ">= 3.0.0", "<
|
|
49
|
-
spec.add_runtime_dependency "cucumber", "
|
|
47
|
+
spec.add_development_dependency "cucumber-rails", "~> 2.2"
|
|
48
|
+
spec.add_runtime_dependency "shoulda-matchers", ">= 3.0.0", "< 9.0.0"
|
|
49
|
+
spec.add_runtime_dependency "cucumber", ">= 5.0.0", "< 13.0.0"
|
|
50
50
|
spec.add_runtime_dependency "rspec-expectations", "~> 3.0"
|
|
51
51
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shoulda-matchers-cucumber
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Малъ Скрылёвъ (Malo Skrylevo)
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-11-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -70,44 +70,62 @@ dependencies:
|
|
|
70
70
|
name: rails
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
|
-
- - "
|
|
73
|
+
- - ">="
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version:
|
|
75
|
+
version: '7.0'
|
|
76
|
+
- - "<"
|
|
77
|
+
- !ruby/object:Gem::Version
|
|
78
|
+
version: '9.0'
|
|
76
79
|
type: :development
|
|
77
80
|
prerelease: false
|
|
78
81
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
82
|
requirements:
|
|
80
|
-
- - "
|
|
83
|
+
- - ">="
|
|
81
84
|
- !ruby/object:Gem::Version
|
|
82
|
-
version:
|
|
85
|
+
version: '7.0'
|
|
86
|
+
- - "<"
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '9.0'
|
|
83
89
|
- !ruby/object:Gem::Dependency
|
|
84
90
|
name: pg
|
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
|
86
92
|
requirements:
|
|
87
|
-
- - "
|
|
93
|
+
- - ">="
|
|
88
94
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: 1.2
|
|
95
|
+
version: '1.2'
|
|
96
|
+
- - "<"
|
|
97
|
+
- !ruby/object:Gem::Version
|
|
98
|
+
version: '2.0'
|
|
90
99
|
type: :development
|
|
91
100
|
prerelease: false
|
|
92
101
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
102
|
requirements:
|
|
94
|
-
- - "
|
|
103
|
+
- - ">="
|
|
95
104
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: 1.2
|
|
105
|
+
version: '1.2'
|
|
106
|
+
- - "<"
|
|
107
|
+
- !ruby/object:Gem::Version
|
|
108
|
+
version: '2.0'
|
|
97
109
|
- !ruby/object:Gem::Dependency
|
|
98
110
|
name: bootsnap
|
|
99
111
|
requirement: !ruby/object:Gem::Requirement
|
|
100
112
|
requirements:
|
|
101
|
-
- - "
|
|
113
|
+
- - ">="
|
|
114
|
+
- !ruby/object:Gem::Version
|
|
115
|
+
version: '1.4'
|
|
116
|
+
- - "<"
|
|
102
117
|
- !ruby/object:Gem::Version
|
|
103
|
-
version:
|
|
118
|
+
version: '2.0'
|
|
104
119
|
type: :development
|
|
105
120
|
prerelease: false
|
|
106
121
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
122
|
requirements:
|
|
108
|
-
- - "
|
|
123
|
+
- - ">="
|
|
124
|
+
- !ruby/object:Gem::Version
|
|
125
|
+
version: '1.4'
|
|
126
|
+
- - "<"
|
|
109
127
|
- !ruby/object:Gem::Version
|
|
110
|
-
version:
|
|
128
|
+
version: '2.0'
|
|
111
129
|
- !ruby/object:Gem::Dependency
|
|
112
130
|
name: listen
|
|
113
131
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -128,14 +146,14 @@ dependencies:
|
|
|
128
146
|
requirements:
|
|
129
147
|
- - "~>"
|
|
130
148
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: '2.
|
|
149
|
+
version: '2.2'
|
|
132
150
|
type: :development
|
|
133
151
|
prerelease: false
|
|
134
152
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
153
|
requirements:
|
|
136
154
|
- - "~>"
|
|
137
155
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: '2.
|
|
156
|
+
version: '2.2'
|
|
139
157
|
- !ruby/object:Gem::Dependency
|
|
140
158
|
name: shoulda-matchers
|
|
141
159
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -145,7 +163,7 @@ dependencies:
|
|
|
145
163
|
version: 3.0.0
|
|
146
164
|
- - "<"
|
|
147
165
|
- !ruby/object:Gem::Version
|
|
148
|
-
version:
|
|
166
|
+
version: 9.0.0
|
|
149
167
|
type: :runtime
|
|
150
168
|
prerelease: false
|
|
151
169
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -155,21 +173,27 @@ dependencies:
|
|
|
155
173
|
version: 3.0.0
|
|
156
174
|
- - "<"
|
|
157
175
|
- !ruby/object:Gem::Version
|
|
158
|
-
version:
|
|
176
|
+
version: 9.0.0
|
|
159
177
|
- !ruby/object:Gem::Dependency
|
|
160
178
|
name: cucumber
|
|
161
179
|
requirement: !ruby/object:Gem::Requirement
|
|
162
180
|
requirements:
|
|
163
|
-
- - "
|
|
181
|
+
- - ">="
|
|
164
182
|
- !ruby/object:Gem::Version
|
|
165
|
-
version:
|
|
183
|
+
version: 5.0.0
|
|
184
|
+
- - "<"
|
|
185
|
+
- !ruby/object:Gem::Version
|
|
186
|
+
version: 13.0.0
|
|
166
187
|
type: :runtime
|
|
167
188
|
prerelease: false
|
|
168
189
|
version_requirements: !ruby/object:Gem::Requirement
|
|
169
190
|
requirements:
|
|
170
|
-
- - "
|
|
191
|
+
- - ">="
|
|
171
192
|
- !ruby/object:Gem::Version
|
|
172
|
-
version:
|
|
193
|
+
version: 5.0.0
|
|
194
|
+
- - "<"
|
|
195
|
+
- !ruby/object:Gem::Version
|
|
196
|
+
version: 13.0.0
|
|
173
197
|
- !ruby/object:Gem::Dependency
|
|
174
198
|
name: rspec-expectations
|
|
175
199
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -192,6 +216,7 @@ executables: []
|
|
|
192
216
|
extensions: []
|
|
193
217
|
extra_rdoc_files: []
|
|
194
218
|
files:
|
|
219
|
+
- ".forgejo/workflows/test.yml"
|
|
195
220
|
- ".gitignore"
|
|
196
221
|
- ".rspec"
|
|
197
222
|
- ".travis.yml"
|
|
@@ -203,6 +228,10 @@ files:
|
|
|
203
228
|
- Rakefile
|
|
204
229
|
- bin/console
|
|
205
230
|
- bin/setup
|
|
231
|
+
- gemfiles/legacy.gemfile
|
|
232
|
+
- gemfiles/rails_7_0.gemfile
|
|
233
|
+
- gemfiles/rails_7_2.gemfile
|
|
234
|
+
- gemfiles/rails_8_1.gemfile
|
|
206
235
|
- lib/shoulda-matchers/cucumber.rb
|
|
207
236
|
- lib/shoulda/matchers/cucumber.rb
|
|
208
237
|
- lib/shoulda/matchers/cucumber/version.rb
|
|
@@ -216,7 +245,7 @@ metadata:
|
|
|
216
245
|
homepage_uri: https://github.com/majioa/shoulda-matchers-cucumber
|
|
217
246
|
source_code_uri: https://github.com/majioa/shoulda-matchers-cucumber
|
|
218
247
|
changelog_uri: https://github.com/majioa/shoulda-matchers-cucumber/CHANGELOG.md
|
|
219
|
-
post_install_message:
|
|
248
|
+
post_install_message:
|
|
220
249
|
rdoc_options: []
|
|
221
250
|
require_paths:
|
|
222
251
|
- lib
|
|
@@ -231,8 +260,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
231
260
|
- !ruby/object:Gem::Version
|
|
232
261
|
version: '0'
|
|
233
262
|
requirements: []
|
|
234
|
-
rubygems_version: 3.
|
|
235
|
-
signing_key:
|
|
263
|
+
rubygems_version: 3.5.22
|
|
264
|
+
signing_key:
|
|
236
265
|
specification_version: 4
|
|
237
266
|
summary: Use shoulda matchers and rspec-expectations directly in cucumber
|
|
238
267
|
test_files: []
|