rspec-rails 7.1.1 → 8.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
- checksums.yaml.gz.sig +0 -0
- data/Changelog.md +14 -1
- data/README.md +27 -28
- data/lib/generators/rspec/authentication/authentication_generator.rb +25 -0
- data/lib/generators/rspec/authentication/templates/user_spec.rb +5 -0
- data/lib/generators/rspec/authentication/templates/users.yml +11 -0
- data/lib/generators/rspec/install/templates/spec/rails_helper.rb +7 -7
- data/lib/rspec/rails/configuration.rb +3 -67
- data/lib/rspec/rails/example/system_example_group.rb +38 -41
- data/lib/rspec/rails/fixture_file_upload_support.rb +2 -8
- data/lib/rspec/rails/fixture_support.rb +12 -42
- data/lib/rspec/rails/version.rb +1 -1
- data/lib/rspec-rails.rb +3 -11
- data.tar.gz.sig +0 -0
- metadata +13 -10
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08c9fcbd99484f0483c170223cf76299aabd55600e8559a8ce79c7d3e75afbf8'
|
4
|
+
data.tar.gz: bc141422cea3d73f476c5ac7fbb93a95bdc0c42549bbc17d01842fc8bc66da17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a92d84a15c6e7a807e71c56a2d0eced926b9574a39757889f9c79b2b72b0f3db51d357dd36cb77a73f8da2401c378a533904c25946bff5f3e16d302cdc57b6b
|
7
|
+
data.tar.gz: 937cd70667b298c09c65cd711752642c0de703737229e99eea09829b392fe8a6ddf3f9e094d1fab758cbc622d37e9b4a0718f52a275ce089d74cae4faa7d46f2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
### Development
|
2
|
-
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v7.1.1...
|
2
|
+
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v7.1.1...v8.0.0)
|
3
|
+
|
4
|
+
### 8.0.0 / 2025-04-30
|
5
|
+
|
6
|
+
Enhancements:
|
7
|
+
|
8
|
+
* Add Rails 8 authentication generator support. (Jerome Dalbert, rspec/rspec-rails#2811)
|
9
|
+
* Improve install generator comment for `ActiveRecord::Migration.maintain_test_schema!`
|
10
|
+
(rspec/rspec-rails#2832)
|
11
|
+
* Add support for `served_by` in system specs. (Sam Giffney, rspec/rspec-rails#2841)
|
12
|
+
|
13
|
+
Breaking Changes:
|
14
|
+
|
15
|
+
* Minimum supported Rails version is 7.2.0
|
3
16
|
|
4
17
|
### 7.1.1 / 2025-02-06
|
5
18
|
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v7.1.0...v7.1.1)
|
data/README.md
CHANGED
@@ -9,6 +9,7 @@ detailed explanations of how the application is supposed to behave,
|
|
9
9
|
expressed in plain English.
|
10
10
|
|
11
11
|
According to [RSpec Rails new versioning strategy][] use:
|
12
|
+
* **[`rspec-rails` 8.x][]** for Rails 8.0 or 7.2.
|
12
13
|
* **[`rspec-rails` 7.x][]** for Rails 7.x.
|
13
14
|
* **[`rspec-rails` 6.x][]** for Rails 6.1, 7.0 or 7.1.
|
14
15
|
* **[`rspec-rails` 5.x][]** for Rails 5.2 or 6.x.
|
@@ -28,13 +29,14 @@ According to [RSpec Rails new versioning strategy][] use:
|
|
28
29
|
[`rspec-rails` 5.x]: https://github.com/rspec/rspec-rails/tree/5-1-maintenance
|
29
30
|
[`rspec-rails` 6.x]: https://github.com/rspec/rspec-rails/tree/6-1-maintenance
|
30
31
|
[`rspec-rails` 7.x]: https://github.com/rspec/rspec-rails/tree/7-1-maintenance
|
32
|
+
[`rspec-rails` 8.x]: https://github.com/rspec/rspec-rails/tree/8-0-maintenance
|
31
33
|
[RSpec Rails new versioning strategy]: https://github.com/rspec/rspec-rails/blob/main/rfcs/versioning-strategy.md
|
32
34
|
|
33
35
|
## Installation
|
34
36
|
|
35
|
-
**IMPORTANT** This README / branch refers to the
|
37
|
+
**IMPORTANT** This README / branch refers to the 8.0.x stable release series, only bugfixes from this series will
|
36
38
|
be added here. See the [`main` branch on Github](https://github.com/rspec/rspec-rails/tree/main) if you want or
|
37
|
-
require the latest unstable features.
|
39
|
+
require the latest unstable features.https://github.com/rspec/rspec-rails/tree/8-0-maintenance) if you want or require the latest stable release.
|
38
40
|
|
39
41
|
1. Add `rspec-rails` to **both** the `:development` and `:test` groups
|
40
42
|
of your app’s `Gemfile`:
|
@@ -42,7 +44,7 @@ require the latest unstable features.
|
|
42
44
|
```ruby
|
43
45
|
# Run against this stable release
|
44
46
|
group :development, :test do
|
45
|
-
gem 'rspec-rails', '~>
|
47
|
+
gem 'rspec-rails', '~> 8.0.0'
|
46
48
|
end
|
47
49
|
|
48
50
|
# Or, run against the main branch
|
@@ -86,7 +88,7 @@ read the [`rspec-rails` upgrade notes][] to find out what to watch out for.
|
|
86
88
|
|
87
89
|
Be sure to check the general [RSpec upgrade notes][] as well.
|
88
90
|
|
89
|
-
[`rspec-rails` upgrade notes]: https://rspec.info/features/
|
91
|
+
[`rspec-rails` upgrade notes]: https://rspec.info/features/8-0/rspec-rails/upgrade
|
90
92
|
[RSpec upgrade notes]: https://rspec.info/upgrading-from-rspec-2/
|
91
93
|
|
92
94
|
## Usage
|
@@ -208,22 +210,22 @@ to test the various parts of a Rails system:
|
|
208
210
|
Follow the links above for examples of how each matcher is used.
|
209
211
|
|
210
212
|
[the matchers that come standard in RSpec]: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers
|
211
|
-
[`be_a_new`]: https://rspec.info/features/
|
212
|
-
[`render_template`]: https://rspec.info/features/
|
213
|
-
[`redirect_to`]: https://rspec.info/features/
|
214
|
-
[`route_to`]: https://rspec.info/features/
|
215
|
-
[`be_routable`]: https://rspec.info/features/
|
216
|
-
[`have_http_status`]: https://rspec.info/features/
|
217
|
-
[`match_array`]: https://rspec.info/features/
|
218
|
-
[`have_been_enqueued`]: https://rspec.info/features/
|
219
|
-
[`have_enqueued_job`]: https://rspec.info/features/
|
213
|
+
[`be_a_new`]: https://rspec.info/features/8-0/rspec-rails/matchers/new-record-matcher
|
214
|
+
[`render_template`]: https://rspec.info/features/8-0/rspec-rails/matchers/render-template-matcher
|
215
|
+
[`redirect_to`]: https://rspec.info/features/8-0/rspec-rails/matchers/redirect-to-matcher
|
216
|
+
[`route_to`]: https://rspec.info/features/8-0/rspec-rails/routing-specs/route-to-matcher
|
217
|
+
[`be_routable`]: https://rspec.info/features/8-0/rspec-rails/routing-specs/be-routable-matcher
|
218
|
+
[`have_http_status`]: https://rspec.info/features/8-0/rspec-rails/matchers/have-http-status-matcher
|
219
|
+
[`match_array`]: https://rspec.info/features/8-0/rspec-rails/matchers/relation-match-array
|
220
|
+
[`have_been_enqueued`]: https://rspec.info/features/8-0/rspec-rails/matchers/have-been-enqueued-matcher
|
221
|
+
[`have_enqueued_job`]: https://rspec.info/features/8-0/rspec-rails/matchers/have-enqueued-job-matcher
|
220
222
|
|
221
223
|
### What else does RSpec Rails add?
|
222
224
|
|
223
225
|
For a comprehensive look at RSpec Rails’ features,
|
224
226
|
read the [official Cucumber documentation][].
|
225
227
|
|
226
|
-
[official Cucumber documentation]: https://rspec.info/features/
|
228
|
+
[official Cucumber documentation]: https://rspec.info/features/8-0/rspec-rails
|
227
229
|
|
228
230
|
## What tests should I write?
|
229
231
|
|
@@ -268,20 +270,20 @@ RSpec.describe User, type: :model do
|
|
268
270
|
...
|
269
271
|
```
|
270
272
|
|
271
|
-
[request]: https://rspec.info/features/
|
272
|
-
[feature]: https://rspec.info/features/
|
273
|
-
[system]: https://rspec.info/features/
|
274
|
-
[model]: https://rspec.info/features/
|
275
|
-
[controller]: https://rspec.info/features/
|
276
|
-
[mailer]: https://rspec.info/features/
|
277
|
-
[job]: https://rspec.info/features/
|
278
|
-
[view]: https://rspec.info/features/
|
279
|
-
[routing]: https://rspec.info/features/
|
280
|
-
[helper]: https://rspec.info/features/
|
273
|
+
[request]: https://rspec.info/features/8-0/rspec-rails/request-specs/request-spec
|
274
|
+
[feature]: https://rspec.info/features/8-0/rspec-rails/feature-specs/feature-spec
|
275
|
+
[system]: https://rspec.info/features/8-0/rspec-rails/system-specs/system-specs
|
276
|
+
[model]: https://rspec.info/features/8-0/rspec-rails/model-specs
|
277
|
+
[controller]: https://rspec.info/features/8-0/rspec-rails/controller-specs
|
278
|
+
[mailer]: https://rspec.info/features/8-0/rspec-rails/mailer-specs
|
279
|
+
[job]: https://rspec.info/features/8-0/rspec-rails/job-specs/job-spec
|
280
|
+
[view]: https://rspec.info/features/8-0/rspec-rails/view-specs/view-spec
|
281
|
+
[routing]: https://rspec.info/features/8-0/rspec-rails/routing-specs
|
282
|
+
[helper]: https://rspec.info/features/8-0/rspec-rails/helper-specs/helper-spec
|
281
283
|
[`ActionDispatch::IntegrationTest`]: https://api.rubyonrails.org/classes/ActionDispatch/IntegrationTest.html
|
282
284
|
[`ActionDispatch::SystemTestCase`]: https://api.rubyonrails.org/classes/ActionDispatch/SystemTestCase.html
|
283
285
|
[`ActionController::TestCase`]: https://api.rubyonrails.org/classes/ActionController/TestCase.html
|
284
|
-
[in the appropriate folder]: https://rspec.info/features/
|
286
|
+
[in the appropriate folder]: https://rspec.info/features/8-0/rspec-rails/directory-structure
|
285
287
|
|
286
288
|
### System specs, feature specs, request specs–what’s the difference?
|
287
289
|
|
@@ -365,9 +367,6 @@ you can run the specs and Cucumber features, or submit a pull request.
|
|
365
367
|
### RSpec base libraries
|
366
368
|
|
367
369
|
* https://github.com/rspec/rspec
|
368
|
-
* https://github.com/rspec/rspec-core
|
369
|
-
* https://github.com/rspec/rspec-expectations
|
370
|
-
* https://github.com/rspec/rspec-mocks
|
371
370
|
|
372
371
|
### Recommended third-party extensions
|
373
372
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'generators/rspec'
|
2
|
+
|
3
|
+
module Rspec
|
4
|
+
module Generators
|
5
|
+
# @private
|
6
|
+
class AuthenticationGenerator < Base
|
7
|
+
def initialize(args, *options)
|
8
|
+
args.replace(['User'])
|
9
|
+
super
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_user_spec
|
13
|
+
template 'user_spec.rb', target_path('models', 'user_spec.rb')
|
14
|
+
end
|
15
|
+
|
16
|
+
hook_for :fixture_replacement
|
17
|
+
|
18
|
+
def create_fixture_file
|
19
|
+
return if options[:fixture_replacement]
|
20
|
+
|
21
|
+
template 'users.yml', target_path('fixtures', 'users.yml')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
2
|
+
|
3
|
+
<%% password_digest = BCrypt::Password.create("password") %>
|
4
|
+
|
5
|
+
one:
|
6
|
+
email_address: one@example.com
|
7
|
+
password_digest: <%%= password_digest %>
|
8
|
+
|
9
|
+
two:
|
10
|
+
email_address: two@example.com
|
11
|
+
password_digest: <%%= password_digest %>
|
@@ -28,7 +28,9 @@ require 'rspec/rails'
|
|
28
28
|
# Rails.root.glob('spec/support/**/*.rb').sort_by(&:to_s).each { |f| require f }
|
29
29
|
|
30
30
|
<% if RSpec::Rails::FeatureCheck.has_active_record_migration? -%>
|
31
|
-
#
|
31
|
+
# Ensures that the test database schema matches the current schema file.
|
32
|
+
# If there are pending migrations it will invoke `db:test:prepare` to
|
33
|
+
# recreate the test database by loading the schema.
|
32
34
|
# If you are not using ActiveRecord, you can remove these lines.
|
33
35
|
begin
|
34
36
|
ActiveRecord::Migration.maintain_test_schema!
|
@@ -39,13 +41,9 @@ end
|
|
39
41
|
RSpec.configure do |config|
|
40
42
|
<% if RSpec::Rails::FeatureCheck.has_active_record? -%>
|
41
43
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
42
|
-
<% if ::Rails::VERSION::STRING < "7.1.0" -%>
|
43
|
-
config.fixture_path = Rails.root.join('spec/fixtures')
|
44
|
-
<% else -%>
|
45
44
|
config.fixture_paths = [
|
46
45
|
Rails.root.join('spec/fixtures')
|
47
46
|
]
|
48
|
-
<% end -%>
|
49
47
|
|
50
48
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
51
49
|
# examples within a transaction, remove the following line or assign false
|
@@ -63,7 +61,9 @@ RSpec.configure do |config|
|
|
63
61
|
# note if you'd prefer not to run each example within a transaction, you
|
64
62
|
# should set use_transactional_fixtures to false.
|
65
63
|
#
|
66
|
-
# config.
|
64
|
+
# config.fixture_paths = [
|
65
|
+
# Rails.root.join('spec/fixtures')
|
66
|
+
# ]
|
67
67
|
# config.use_transactional_fixtures = true
|
68
68
|
|
69
69
|
<% end -%>
|
@@ -75,7 +75,7 @@ RSpec.configure do |config|
|
|
75
75
|
# end
|
76
76
|
#
|
77
77
|
# The different available types are documented in the features, such as in
|
78
|
-
# https://rspec.info/features/
|
78
|
+
# https://rspec.info/features/8-0/rspec-rails
|
79
79
|
#
|
80
80
|
# You can also this infer these behaviours automatically by location, e.g.
|
81
81
|
# /spec/models would pull in the same behaviour as `type: :model` but this
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# rubocop: disable Metrics/ModuleLength
|
2
1
|
module RSpec
|
3
2
|
module Rails
|
4
3
|
# Fake class to document RSpec Rails configuration options. In practice,
|
@@ -57,7 +56,7 @@ module RSpec
|
|
57
56
|
end
|
58
57
|
|
59
58
|
# @private
|
60
|
-
def self.initialize_configuration(config) # rubocop:disable Metrics/MethodLength
|
59
|
+
def self.initialize_configuration(config) # rubocop:disable Metrics/MethodLength
|
61
60
|
config.backtrace_exclusion_patterns << /vendor\//
|
62
61
|
config.backtrace_exclusion_patterns << %r{lib/rspec/rails}
|
63
62
|
|
@@ -69,12 +68,7 @@ module RSpec
|
|
69
68
|
config.add_setting :use_transactional_fixtures, alias_with: :use_transactional_examples
|
70
69
|
config.add_setting :use_instantiated_fixtures
|
71
70
|
config.add_setting :global_fixtures
|
72
|
-
|
73
|
-
if ::Rails::VERSION::STRING < "7.1.0"
|
74
|
-
config.add_setting :fixture_path
|
75
|
-
else
|
76
|
-
config.add_setting :fixture_paths
|
77
|
-
end
|
71
|
+
config.add_setting :fixture_paths
|
78
72
|
|
79
73
|
config.include RSpec::Rails::FixtureSupport, :use_fixtures
|
80
74
|
|
@@ -90,7 +84,7 @@ module RSpec
|
|
90
84
|
config.add_setting :file_fixture_path, default: 'spec/fixtures/files'
|
91
85
|
config.include RSpec::Rails::FileFixtureSupport
|
92
86
|
|
93
|
-
# Add support for
|
87
|
+
# Add support for fixture_paths on fixture_file_upload
|
94
88
|
config.include RSpec::Rails::FixtureFileUploadSupport
|
95
89
|
|
96
90
|
# This allows us to expose `render_views` as a config option even though it
|
@@ -114,40 +108,6 @@ module RSpec
|
|
114
108
|
rendering_views?
|
115
109
|
end
|
116
110
|
|
117
|
-
undef :rendering_views? if respond_to?(:rendering_views?)
|
118
|
-
def rendering_views?
|
119
|
-
!!rendering_views
|
120
|
-
end
|
121
|
-
|
122
|
-
# Define boolean predicates rather than relying on rspec-core due
|
123
|
-
# to the bug fix in rspec/rspec-core#2736, note some of these
|
124
|
-
# predicates are a bit nonsensical, but they exist for backwards
|
125
|
-
# compatibility, we can tidy these up in `rspec-rails` 5.
|
126
|
-
undef :fixture_path? if respond_to?(:fixture_path?)
|
127
|
-
def fixture_path?
|
128
|
-
!!fixture_path
|
129
|
-
end
|
130
|
-
|
131
|
-
undef :global_fixtures? if respond_to?(:global_fixtures?)
|
132
|
-
def global_fixtures?
|
133
|
-
!!global_fixtures
|
134
|
-
end
|
135
|
-
|
136
|
-
undef :infer_base_class_for_anonymous_controllers? if respond_to?(:infer_base_class_for_anonymous_controllers?)
|
137
|
-
def infer_base_class_for_anonymous_controllers?
|
138
|
-
!!infer_base_class_for_anonymous_controllers
|
139
|
-
end
|
140
|
-
|
141
|
-
undef :use_instantiated_fixtures? if respond_to?(:use_instantiated_fixtures?)
|
142
|
-
def use_instantiated_fixtures?
|
143
|
-
!!use_instantiated_fixtures
|
144
|
-
end
|
145
|
-
|
146
|
-
undef :use_transactional_fixtures? if respond_to?(:use_transactional_fixtures?)
|
147
|
-
def use_transactional_fixtures?
|
148
|
-
!!use_transactional_fixtures
|
149
|
-
end
|
150
|
-
|
151
111
|
def infer_spec_type_from_file_location!
|
152
112
|
DIRECTORY_MAPPINGS.each do |type, dir_parts|
|
153
113
|
escaped_path = Regexp.compile(dir_parts.join('[\\\/]') + '[\\\/]')
|
@@ -163,29 +123,6 @@ module RSpec
|
|
163
123
|
filter_gems_from_backtrace "activemodel", "activerecord",
|
164
124
|
"activesupport", "activejob"
|
165
125
|
end
|
166
|
-
|
167
|
-
# @deprecated TestFixtures#fixture_path is deprecated and will be removed in Rails 7.2
|
168
|
-
if ::Rails::VERSION::STRING >= "7.1.0"
|
169
|
-
def fixture_path
|
170
|
-
RSpec.deprecate(
|
171
|
-
"config.fixture_path",
|
172
|
-
replacement: "config.fixture_paths",
|
173
|
-
message: "Rails 7.1 has deprecated the singular fixture_path in favour of an array." \
|
174
|
-
"You should migrate to plural:"
|
175
|
-
)
|
176
|
-
fixture_paths&.first
|
177
|
-
end
|
178
|
-
|
179
|
-
def fixture_path=(path)
|
180
|
-
RSpec.deprecate(
|
181
|
-
"config.fixture_path = #{path.inspect}",
|
182
|
-
replacement: "config.fixture_paths = [#{path.inspect}]",
|
183
|
-
message: "Rails 7.1 has deprecated the singular fixture_path in favour of an array." \
|
184
|
-
"You should migrate to plural:"
|
185
|
-
)
|
186
|
-
self.fixture_paths = Array(path)
|
187
|
-
end
|
188
|
-
end
|
189
126
|
end
|
190
127
|
|
191
128
|
add_test_type_configurations(config)
|
@@ -219,4 +156,3 @@ module RSpec
|
|
219
156
|
initialize_configuration RSpec.configuration
|
220
157
|
end
|
221
158
|
end
|
222
|
-
# rubocop: enable Metrics/ModuleLength
|
@@ -44,64 +44,57 @@ module RSpec
|
|
44
44
|
].join("_").tr(CHARS_TO_TRANSLATE.join, "_").byteslice(0...200).scrub("") + "_#{rand(1000)}"
|
45
45
|
end
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
def [](key)
|
56
|
-
if @example_data.key?(key)
|
57
|
-
@example_data[key]
|
58
|
-
else
|
59
|
-
raise_wrong_scope_error
|
60
|
-
end
|
61
|
-
end
|
47
|
+
# @private
|
48
|
+
# Allows failure screenshot to work whilst not exposing metadata
|
49
|
+
class SuppressRailsScreenshotMetadata
|
50
|
+
def initialize
|
51
|
+
@example_data = {}
|
52
|
+
end
|
62
53
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
end
|
54
|
+
def [](key)
|
55
|
+
if @example_data.key?(key)
|
56
|
+
@example_data[key]
|
57
|
+
else
|
58
|
+
raise_wrong_scope_error
|
69
59
|
end
|
60
|
+
end
|
70
61
|
|
71
|
-
|
62
|
+
def []=(key, value)
|
63
|
+
if key == :failure_screenshot_path
|
64
|
+
@example_data[key] = value
|
65
|
+
else
|
72
66
|
raise_wrong_scope_error
|
73
67
|
end
|
68
|
+
end
|
74
69
|
|
75
|
-
|
76
|
-
|
77
|
-
def raise_wrong_scope_error
|
78
|
-
raise RSpec::Core::ExampleGroup::WrongScopeError,
|
79
|
-
"`metadata` is not available from within an example " \
|
80
|
-
"(e.g. an `it` block) or from constructs that run in the " \
|
81
|
-
"scope of an example (e.g. `before`, `let`, etc). It is " \
|
82
|
-
"only available on an example group (e.g. a `describe` or "\
|
83
|
-
"`context` block)"
|
84
|
-
end
|
70
|
+
def method_missing(_name, *_args, &_block)
|
71
|
+
raise_wrong_scope_error
|
85
72
|
end
|
86
73
|
|
87
|
-
|
88
|
-
|
89
|
-
|
74
|
+
private
|
75
|
+
|
76
|
+
def raise_wrong_scope_error
|
77
|
+
raise RSpec::Core::ExampleGroup::WrongScopeError,
|
78
|
+
"`metadata` is not available from within an example " \
|
79
|
+
"(e.g. an `it` block) or from constructs that run in the " \
|
80
|
+
"scope of an example (e.g. `before`, `let`, etc). It is " \
|
81
|
+
"only available on an example group (e.g. a `describe` or "\
|
82
|
+
"`context` block)"
|
90
83
|
end
|
91
84
|
end
|
92
85
|
|
86
|
+
# @private
|
87
|
+
def metadata
|
88
|
+
@metadata ||= SuppressRailsScreenshotMetadata.new
|
89
|
+
end
|
90
|
+
|
93
91
|
# Delegates to `Rails.application`.
|
94
92
|
def app
|
95
93
|
::Rails.application
|
96
94
|
end
|
97
95
|
|
98
96
|
# Default driver to assign if none specified.
|
99
|
-
DEFAULT_DRIVER =
|
100
|
-
if ::Rails::VERSION::STRING.to_f >= 7.2
|
101
|
-
:selenium_chrome_headless
|
102
|
-
else
|
103
|
-
:selenium
|
104
|
-
end
|
97
|
+
DEFAULT_DRIVER = :selenium_chrome_headless
|
105
98
|
|
106
99
|
included do |other|
|
107
100
|
ActiveSupport.on_load(:action_dispatch_system_test_case) do
|
@@ -153,6 +146,10 @@ module RSpec
|
|
153
146
|
@driver = ::ActionDispatch::SystemTestCase.driven_by(driver, **driver_options, &blk).tap(&:use)
|
154
147
|
end
|
155
148
|
|
149
|
+
def served_by(**options)
|
150
|
+
::ActionDispatch::SystemTestCase.served_by(**options)
|
151
|
+
end
|
152
|
+
|
156
153
|
before do
|
157
154
|
@routes = ::Rails.application.routes
|
158
155
|
end
|
@@ -14,10 +14,8 @@ module RSpec
|
|
14
14
|
resolved_fixture_path =
|
15
15
|
if respond_to?(:file_fixture_path) && !file_fixture_path.nil?
|
16
16
|
file_fixture_path.to_s
|
17
|
-
elsif respond_to?(:fixture_paths)
|
18
|
-
(RSpec.configuration.fixture_paths&.first || '').to_s
|
19
17
|
else
|
20
|
-
(RSpec.configuration.
|
18
|
+
(RSpec.configuration.fixture_paths&.first || '').to_s
|
21
19
|
end
|
22
20
|
RailsFixtureFileWrapper.file_fixture_path = File.join(resolved_fixture_path, '') unless resolved_fixture_path.strip.empty?
|
23
21
|
RailsFixtureFileWrapper.instance
|
@@ -28,11 +26,7 @@ module RSpec
|
|
28
26
|
include ActiveSupport::Testing::FileFixtures
|
29
27
|
|
30
28
|
class << self
|
31
|
-
|
32
|
-
attr_accessor :fixture_path
|
33
|
-
else
|
34
|
-
attr_accessor :fixture_paths
|
35
|
-
end
|
29
|
+
attr_accessor :fixture_paths
|
36
30
|
|
37
31
|
# Get instance of wrapper
|
38
32
|
def instance
|
@@ -20,12 +20,7 @@ module RSpec
|
|
20
20
|
if RSpec.configuration.use_active_record?
|
21
21
|
include Fixtures
|
22
22
|
|
23
|
-
|
24
|
-
if respond_to?(:fixture_paths=)
|
25
|
-
self.fixture_paths = RSpec.configuration.fixture_paths
|
26
|
-
else
|
27
|
-
self.fixture_path = RSpec.configuration.fixture_path
|
28
|
-
end
|
23
|
+
self.fixture_paths = RSpec.configuration.fixture_paths
|
29
24
|
|
30
25
|
self.use_transactional_tests = RSpec.configuration.use_transactional_fixtures
|
31
26
|
self.use_instantiated_fixtures = RSpec.configuration.use_instantiated_fixtures
|
@@ -37,50 +32,25 @@ module RSpec
|
|
37
32
|
module Fixtures
|
38
33
|
extend ActiveSupport::Concern
|
39
34
|
|
40
|
-
# rubocop:disable Metrics/BlockLength
|
41
35
|
class_methods do
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
proxy_method_warning_if_called_in_before_context_scope(method_name, fixture_name)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def proxy_method_warning_if_called_in_before_context_scope(method_name, fixture_name)
|
52
|
-
define_method(method_name) do |*args, **kwargs, &blk|
|
53
|
-
if RSpec.current_scope == :before_context_hook
|
54
|
-
RSpec.warn_with("Calling fixture method in before :context ")
|
55
|
-
else
|
56
|
-
access_fixture(fixture_name, *args, **kwargs, &blk)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
else
|
61
|
-
def fixtures(*args)
|
62
|
-
orig_methods = private_instance_methods
|
63
|
-
super.tap do
|
64
|
-
new_methods = private_instance_methods - orig_methods
|
65
|
-
new_methods.each do |method_name|
|
66
|
-
proxy_method_warning_if_called_in_before_context_scope(method_name)
|
67
|
-
end
|
36
|
+
def fixtures(*args)
|
37
|
+
super.tap do
|
38
|
+
fixture_sets.each_pair do |method_name, fixture_name|
|
39
|
+
proxy_method_warning_if_called_in_before_context_scope(method_name, fixture_name)
|
68
40
|
end
|
69
41
|
end
|
42
|
+
end
|
70
43
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
orig_implementation.bind(self).call(*args, &blk)
|
78
|
-
end
|
44
|
+
def proxy_method_warning_if_called_in_before_context_scope(method_name, fixture_name)
|
45
|
+
define_method(method_name) do |*args, **kwargs, &blk|
|
46
|
+
if RSpec.current_scope == :before_context_hook
|
47
|
+
RSpec.warn_with("Calling fixture method in before :context ")
|
48
|
+
else
|
49
|
+
access_fixture(fixture_name, *args, **kwargs, &blk)
|
79
50
|
end
|
80
51
|
end
|
81
52
|
end
|
82
53
|
end
|
83
|
-
# rubocop:enable Metrics/BlockLength
|
84
54
|
end
|
85
55
|
end
|
86
56
|
end
|
data/lib/rspec/rails/version.rb
CHANGED
data/lib/rspec-rails.rb
CHANGED
@@ -64,18 +64,10 @@ module RSpec
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
return unless options.preview_paths.empty?
|
67
|
+
def config_default_preview_path(options)
|
68
|
+
return unless options.preview_paths.empty?
|
70
69
|
|
71
|
-
|
72
|
-
end
|
73
|
-
else
|
74
|
-
def config_default_preview_path(options)
|
75
|
-
return unless options.preview_path.blank?
|
76
|
-
|
77
|
-
options.preview_path = "#{::Rails.root}/spec/mailers/previews"
|
78
|
-
end
|
70
|
+
options.preview_paths << "#{::Rails.root}/spec/mailers/previews"
|
79
71
|
end
|
80
72
|
|
81
73
|
def supports_action_mailer_previews?(config)
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 8.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Chelimsky
|
@@ -42,7 +42,7 @@ cert_chain:
|
|
42
42
|
AwP+qZPPf97FXXZGEGIYhhHpnj+Ltx9nCetRPiZ4rvYBcXgCWVQSg6eiEofrMwn/
|
43
43
|
AKMCABhZ1Y2eATsfMgdkmIZk7JIPZiSi6eUxPiCMP9M/pw==
|
44
44
|
-----END CERTIFICATE-----
|
45
|
-
date: 2025-
|
45
|
+
date: 2025-04-30 00:00:00.000000000 Z
|
46
46
|
dependencies:
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: actionpack
|
@@ -50,42 +50,42 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '7.
|
53
|
+
version: '7.2'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '7.
|
60
|
+
version: '7.2'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: activesupport
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '7.
|
67
|
+
version: '7.2'
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '7.
|
74
|
+
version: '7.2'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: railties
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '7.
|
81
|
+
version: '7.2'
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '7.
|
88
|
+
version: '7.2'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: rspec-core
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -197,6 +197,9 @@ files:
|
|
197
197
|
- LICENSE.md
|
198
198
|
- README.md
|
199
199
|
- lib/generators/rspec.rb
|
200
|
+
- lib/generators/rspec/authentication/authentication_generator.rb
|
201
|
+
- lib/generators/rspec/authentication/templates/user_spec.rb
|
202
|
+
- lib/generators/rspec/authentication/templates/users.yml
|
200
203
|
- lib/generators/rspec/channel/channel_generator.rb
|
201
204
|
- lib/generators/rspec/channel/templates/channel_spec.rb.erb
|
202
205
|
- lib/generators/rspec/controller/controller_generator.rb
|
@@ -294,7 +297,7 @@ licenses:
|
|
294
297
|
- MIT
|
295
298
|
metadata:
|
296
299
|
bug_tracker_uri: https://github.com/rspec/rspec-rails/issues
|
297
|
-
changelog_uri: https://github.com/rspec/rspec-rails/blob/
|
300
|
+
changelog_uri: https://github.com/rspec/rspec-rails/blob/v8.0.0/Changelog.md
|
298
301
|
documentation_uri: https://rspec.info/documentation/
|
299
302
|
mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
|
300
303
|
source_code_uri: https://github.com/rspec/rspec-rails
|
@@ -306,7 +309,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
306
309
|
requirements:
|
307
310
|
- - ">="
|
308
311
|
- !ruby/object:Gem::Version
|
309
|
-
version:
|
312
|
+
version: 3.0.0
|
310
313
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
311
314
|
requirements:
|
312
315
|
- - ">="
|
metadata.gz.sig
CHANGED
Binary file
|