shoulda-matchers-cucumber 1.0.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50ced520daee6e1a6ddab27c1634064bc219903643d712b3a7cf0a3cbb12e761
4
- data.tar.gz: 6f92423182000b4fb889ddaa20b718d3eb83353de79777505d842090a2c3c923
3
+ metadata.gz: 824f03fd5bed53147cd0b3815d940a19f7494e3236f6c44a2d98b8d1779fefa0
4
+ data.tar.gz: 33767e0469e08971115e022690e414b1a4b4bf837caf20a4f59244165fed3008
5
5
  SHA512:
6
- metadata.gz: 983e998e5b105f8b4b844334b3d8e3c1dc28aab46f471da9784b0fc299543e3290af3d5107a0cd893f68852c11fb3fc343f429b61129f1e73248ed4097827cbd
7
- data.tar.gz: d9c4e4dcc4f88bbdf1a6aeb894b3b8c9630683e9f5696b4ba6d8922452a5ca8d2b9c11349a622d0c55d631918fe54ed4869167d5b3eb1e75e8794e27410e11ca
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/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
- Then, configure the gem to integrate with RSpec specifying the test framework as `:cucumber`:
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 :cucumber
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:
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'shoulda-matchers-cucumber', path: '..'
4
+ gem 'rails', '~> 7.0.8'
5
+ gem 'cucumber', '~> 5.0'
6
+ gem 'shoulda-matchers', '~> 4.5'
7
+ gem 'sqlite3', '~> 1.4'
8
+ gem 'rspec', '~> 3.0'
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'shoulda-matchers-cucumber', path: '..'
4
+ gem 'rails', '~> 7.0.8'
5
+ gem 'cucumber', '~> 9.2'
6
+ gem 'shoulda-matchers', '~> 6.5.0'
7
+ gem 'sqlite3', '~> 1.4'
8
+ gem 'rspec', '~> 3.0'
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'shoulda-matchers-cucumber', path: '..'
4
+ gem 'rails', '~> 7.2.0'
5
+ gem 'cucumber', '~> 12.0'
6
+ gem 'shoulda-matchers', '~> 8.0'
7
+ gem 'sqlite3', '>= 2.1', '< 3'
8
+ gem 'rspec', '~> 3.0'
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'shoulda-matchers-cucumber', path: '..'
4
+ gem 'rails', '~> 8.1.0'
5
+ gem 'cucumber', '~> 12.0'
6
+ gem 'shoulda-matchers', '~> 8.0'
7
+ gem 'sqlite3', '>= 2.1', '< 3'
8
+ gem 'rspec', '~> 3.0'
@@ -1,7 +1,7 @@
1
1
  module Shoulda
2
2
  module Matchers
3
3
  module Cucumber
4
- VERSION = "1.0.1"
4
+ VERSION = "2.0.0"
5
5
  end
6
6
  end
7
7
  end
@@ -1,2 +1,3 @@
1
1
  require "shoulda/matchers/cucumber/version"
2
+ require "rspec/expectations"
2
3
  require "shoulda/matchers/integrations/test_frameworks/cucumber"
@@ -5,25 +5,17 @@ module Shoulda
5
5
  module Integrations
6
6
  module TestFrameworks
7
7
  # @private
8
- class RspecExpectations
8
+ class Cucumber
9
9
  Integrations.register_test_framework(self, :cucumber)
10
10
 
11
11
  def validate!
12
- return if defined?(::RSpec) && defined?(::RSpec::Matchers)
12
+ return if defined?(::Cucumber::Glue::Dsl)
13
13
 
14
14
  raise_error
15
15
  end
16
16
 
17
- def include(*modules, **_options)
18
- ::RSpec::Matchers.send(:include, *modules)
19
- rescue NameError
20
- if (require("rspec/expectations"))
21
- retry
22
- else
23
- raise_error
24
- end
25
- rescue LoadError
26
- raise_error
17
+ def include *modules, **_options
18
+ Object.new.extend(::Cucumber::Glue::Dsl).World(::RSpec::Matchers, *modules)
27
19
  end
28
20
 
29
21
  def n_unit?
@@ -36,10 +28,8 @@ module Shoulda
36
28
 
37
29
  def raise_error
38
30
  raise TestFrameworkNotFound, <<-EOT
39
- You have to include the 'rspec-expectations' gem to Gemfile, and add
40
- the line before requiring the shoulda matchers:
41
-
42
- require 'rspec/expectations'
31
+ Load and configure shoulda-matchers-cucumber from features/support/env.rb
32
+ while Cucumber is loading the support code.
43
33
  EOT
44
34
  end
45
35
  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", "~> 5.0.0"
44
- spec.add_development_dependency "pg", "~> 1.2.3"
45
- spec.add_development_dependency "bootsnap", "~> 1.4.6"
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
47
  spec.add_development_dependency "cucumber-rails", "~> 2.2"
48
- spec.add_runtime_dependency "shoulda-matchers", ">= 3.0.0", "< 5.0.0"
49
- spec.add_runtime_dependency "cucumber", ">= 5.0.0", "< 6.0.0"
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: 1.0.1
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: 2020-12-24 00:00:00.000000000 Z
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: 5.0.0
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: 5.0.0
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.3
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
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '1.2'
106
+ - - "<"
95
107
  - !ruby/object:Gem::Version
96
- version: 1.2.3
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: 1.4.6
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: 1.4.6
128
+ version: '2.0'
111
129
  - !ruby/object:Gem::Dependency
112
130
  name: listen
113
131
  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: 5.0.0
166
+ version: 9.0.0
149
167
  type: :runtime
150
168
  prerelease: false
151
169
  version_requirements: !ruby/object:Gem::Requirement
@@ -155,7 +173,7 @@ dependencies:
155
173
  version: 3.0.0
156
174
  - - "<"
157
175
  - !ruby/object:Gem::Version
158
- version: 5.0.0
176
+ version: 9.0.0
159
177
  - !ruby/object:Gem::Dependency
160
178
  name: cucumber
161
179
  requirement: !ruby/object:Gem::Requirement
@@ -165,7 +183,7 @@ dependencies:
165
183
  version: 5.0.0
166
184
  - - "<"
167
185
  - !ruby/object:Gem::Version
168
- version: 6.0.0
186
+ version: 13.0.0
169
187
  type: :runtime
170
188
  prerelease: false
171
189
  version_requirements: !ruby/object:Gem::Requirement
@@ -175,7 +193,7 @@ dependencies:
175
193
  version: 5.0.0
176
194
  - - "<"
177
195
  - !ruby/object:Gem::Version
178
- version: 6.0.0
196
+ version: 13.0.0
179
197
  - !ruby/object:Gem::Dependency
180
198
  name: rspec-expectations
181
199
  requirement: !ruby/object:Gem::Requirement
@@ -198,6 +216,7 @@ executables: []
198
216
  extensions: []
199
217
  extra_rdoc_files: []
200
218
  files:
219
+ - ".forgejo/workflows/test.yml"
201
220
  - ".gitignore"
202
221
  - ".rspec"
203
222
  - ".travis.yml"
@@ -209,6 +228,10 @@ files:
209
228
  - Rakefile
210
229
  - bin/console
211
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
212
235
  - lib/shoulda-matchers/cucumber.rb
213
236
  - lib/shoulda/matchers/cucumber.rb
214
237
  - lib/shoulda/matchers/cucumber/version.rb
@@ -222,7 +245,7 @@ metadata:
222
245
  homepage_uri: https://github.com/majioa/shoulda-matchers-cucumber
223
246
  source_code_uri: https://github.com/majioa/shoulda-matchers-cucumber
224
247
  changelog_uri: https://github.com/majioa/shoulda-matchers-cucumber/CHANGELOG.md
225
- post_install_message:
248
+ post_install_message:
226
249
  rdoc_options: []
227
250
  require_paths:
228
251
  - lib
@@ -237,8 +260,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
260
  - !ruby/object:Gem::Version
238
261
  version: '0'
239
262
  requirements: []
240
- rubygems_version: 3.1.2
241
- signing_key:
263
+ rubygems_version: 3.5.22
264
+ signing_key:
242
265
  specification_version: 4
243
266
  summary: Use shoulda matchers and rspec-expectations directly in cucumber
244
267
  test_files: []