rspec-rails 8.0.5 → 8.1.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: 5642a09ebd35bbee3e11f932bd086dde02370323619c4e441e3d8053465c9bce
4
- data.tar.gz: 2c6dd45826f15498f769344c2f594949e61c3461a152701c9b30d70a8bede4d2
3
+ metadata.gz: d88929c04dcfe23886634c2cee7b781424809e2a0936279d57845f6e2db1d0b4
4
+ data.tar.gz: 84b5f02cdbbf7d4f5d3ed10157d03f82482bda4a7703056c4eb226203d58d308
5
5
  SHA512:
6
- metadata.gz: 6cc54657f6e6e34db670fe2d91661e380ce271986774d68456b78bf533721ec0c9f7ae9d9e4a5dc17f98ec27a901c665842df3934d3abddef65a8e2fc37871c8
7
- data.tar.gz: 559fe906a76bea73a1409dace1a2826102eafe3ac7ab55510693c84d56d4684af5f48edd4bbed729f25558cb3b4ca894495a910e7922f89f1f0c33ebbae520fc
6
+ metadata.gz: 4118ac91cd9e2c0967477276b276d044e716a744b5cccad10dc0dc70f64f0a96b9665f5b3a17443dcd96ebe2bbcbc05d48cd036ab05d840492819296d4b5b811
7
+ data.tar.gz: d244ab16568c9101c1e1b4c541095417c36c408247d1841ac5a42a1f5ebbf53b75df960878f0abcf4438523c683b957daa7989bc8ef43d75b692a68a63bd74e8
checksums.yaml.gz.sig CHANGED
Binary file
data/Changelog.md CHANGED
@@ -1,7 +1,23 @@
1
1
  ### Development
2
- [Full Changelog](https://github.com/rspec/rspec-rails/compare/v8.0.5...8-0-maintenance)
2
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v8.1.0...8-1-maintenance)
3
3
 
4
- ### 8.0.4 / 2026-03-10
4
+ ### 8.1.0 / 2026-11-06
5
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v8.0.5...v8.1.0)
6
+
7
+ Enhancements:
8
+
9
+ * Officially support Rails 8.1, there are no changes to the behaviour of Rails 8.1 from rspec-rails 8.0.x
10
+ this release fulfils our versioning strategy and kepts CI up to date.
11
+
12
+ Bug Fixes:
13
+
14
+ * Handle having a frozen hash for `default_url_options` by assigning rather than mutating it.
15
+ (Federico Carrocera, rspec/rspec-rails#2907)
16
+ * Fix view specs manipulating a frozen array (for template prefixes) in `actionview` internals.
17
+ (Iliana Hadzhiatanasova, rspec/rspec-rails#2915)
18
+ * Refactor template rendering to prepare for future Rails releases. (Saïd M., Phil Pirozhkov, rspec/rspec-rails#2927)
19
+
20
+ ### 8.0.5 / 2026-11-06
5
21
  [Full Changelog](https://github.com/rspec/rspec-rails/compare/v8.0.4...v8.0.5)
6
22
 
7
23
  Bug Fixes:
data/README.md CHANGED
@@ -16,7 +16,7 @@ issue a major version change when removing older versions from support.
16
16
 
17
17
  Accordingly you should use:
18
18
 
19
- * **[`rspec-rails` 8.x][]** for Rails 8.0 or 7.2.
19
+ * **[`rspec-rails` 8.x][]** for Rails 8.1, 8.0 or 7.2.
20
20
  * **[`rspec-rails` 7.x][]** for Rails 7.x.
21
21
  * **[`rspec-rails` 6.x][]** for Rails 6.1, 7.0 or 7.1.
22
22
  * **[`rspec-rails` 5.x][]** for Rails 5.2 or 6.x.
@@ -41,9 +41,9 @@ Accordingly you should use:
41
41
 
42
42
  ## Installation
43
43
 
44
- **IMPORTANT** This README / branch refers to the 8.0.x stable release series, only bugfixes from this series will
44
+ **IMPORTANT** This README / branch refers to the 8.1.x stable release series, only bugfixes from this series will
45
45
  be added here. See the [`main` branch on Github](https://github.com/rspec/rspec-rails/tree/main) if you want or
46
- require the latest unstable features.https://github.com/rspec/rspec-rails/tree/8-0-maintenance) if you want or require the latest stable release.
46
+ require the latest unstable features.
47
47
 
48
48
  1. Add `rspec-rails` to **both** the `:development` and `:test` groups
49
49
  of your app’s `Gemfile`:
@@ -18,7 +18,11 @@ RSpec.describe "<%= ns_table_name %>/index", <%= type_metatag(:view) %> do
18
18
 
19
19
  it "renders a list of <%= ns_table_name %>" do
20
20
  render
21
+ <% if Rails.version.to_f < 8.1 -%>
21
22
  cell_selector = 'div>p'
23
+ <% else -%>
24
+ cell_selector = 'div>div>div'
25
+ <% end -%>
22
26
  <% for attribute in output_attributes -%>
23
27
  assert_select cell_selector, text: Regexp.new(<%= value_for(attribute) %>.to_s), count: 2
24
28
  <% end -%>
@@ -9,6 +9,9 @@ module RSpec
9
9
  # Default host to be used in Rails route helpers if none is specified.
10
10
  DEFAULT_HOST = "www.example.com"
11
11
 
12
+ # Default url options, merged into those of the example group.
13
+ DEFAULT_OPTIONS = { host: DEFAULT_HOST }.freeze
14
+
12
15
  included do
13
16
  app = ::Rails.application
14
17
  if app.respond_to?(:routes)
@@ -16,7 +19,7 @@ module RSpec
16
19
  include app.routes.mounted_helpers if app.routes.respond_to?(:mounted_helpers)
17
20
 
18
21
  if respond_to?(:default_url_options)
19
- default_url_options[:host] ||= ::RSpec::Rails::FeatureExampleGroup::DEFAULT_HOST
22
+ self.default_url_options = DEFAULT_OPTIONS.merge(default_url_options)
20
23
  end
21
24
  end
22
25
  end
@@ -21,8 +21,8 @@ if defined?(ActionMailer)
21
21
 
22
22
  included do
23
23
  include ::Rails.application.routes.url_helpers
24
- options = ::Rails.configuration.action_mailer.default_url_options || {}
25
- options.each { |key, value| default_url_options[key] = value }
24
+ options = ::Rails.configuration.action_mailer.default_url_options
25
+ self.default_url_options = default_url_options.merge(options) if options.present?
26
26
  end
27
27
 
28
28
  # Class-level DSL for mailer specs.
@@ -186,7 +186,7 @@ module RSpec
186
186
 
187
187
  before do
188
188
  _include_controller_helpers
189
- view.lookup_context.prefixes.prepend(_controller_path)
189
+ view.lookup_context.prefixes = [_controller_path] + view.lookup_context.prefixes
190
190
 
191
191
  controller.controller_path = _controller_path
192
192
 
@@ -142,7 +142,7 @@ module RSpec
142
142
  job_args = deserialize_arguments(job)
143
143
 
144
144
  mailer_method = job_args[0..1].join('.')
145
- mailer_args = job_args[3..-1]
145
+ mailer_args = job_args[3..]
146
146
 
147
147
  msg_parts = []
148
148
  msg_parts << "with #{mailer_args}" if mailer_args.any?
@@ -181,7 +181,7 @@ module RSpec
181
181
  mailer_args = args - base_mailer_args
182
182
 
183
183
  if parameterized_mail?(job)
184
- mailer_args = mailer_args[1..-1] # ignore parameterized params
184
+ mailer_args = mailer_args[1..] # ignore parameterized params
185
185
  elsif mailer_args.last.is_a?(Hash) && mailer_args.last.key?(:args)
186
186
  mailer_args = args.last[:args]
187
187
  end
@@ -3,7 +3,7 @@ module RSpec
3
3
  # Version information for RSpec Rails.
4
4
  module Version
5
5
  # Current version of RSpec Rails, in semantic versioning format.
6
- STRING = '8.0.5'
6
+ STRING = '8.1.0'
7
7
  end
8
8
  end
9
9
  end
@@ -86,29 +86,30 @@ module RSpec
86
86
 
87
87
  def method_missing(name, *args, &block)
88
88
  result = @resolver.send(name, *args, &block)
89
- nullify_templates(result)
89
+
90
+ if result.is_a?(Enumerable) && result.all? { |element| element.is_a?(::ActionView::Template) }
91
+ nullify_templates(result)
92
+ elsif result.is_a?(::ActionView::Template)
93
+ nullify_templates([result]).first
94
+ else
95
+ result
96
+ end
90
97
  end
91
98
 
92
99
  private
93
100
 
94
101
  def nullify_templates(collection)
95
- return collection unless collection.is_a?(Enumerable)
96
- return collection unless collection.all? { |element| element.is_a?(::ActionView::Template) }
97
-
98
102
  EmptyTemplateResolver.nullify_template_rendering(collection)
99
103
  end
100
104
  end
101
105
 
102
- # Delegates find_templates to the submitted path set and then returns
103
- # templates with modified source
106
+ # Looks templates up on the file system and then returns them with
107
+ # modified source
104
108
  #
105
109
  # @private
106
110
  class FileSystemResolver < ::ActionView::FileSystemResolver
107
- private
108
-
109
- def find_templates(*args)
110
- templates = super
111
- EmptyTemplateResolver.nullify_template_rendering(templates)
111
+ def find_all(*_args)
112
+ EmptyTemplateResolver.nullify_template_rendering(super)
112
113
  end
113
114
  end
114
115
  end
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: 8.0.5
4
+ version: 8.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chelimsky
@@ -321,7 +321,7 @@ licenses:
321
321
  - MIT
322
322
  metadata:
323
323
  bug_tracker_uri: https://github.com/rspec/rspec-rails/issues
324
- changelog_uri: https://github.com/rspec/rspec-rails/blob/v8.0.5/Changelog.md
324
+ changelog_uri: https://github.com/rspec/rspec-rails/blob/v8.1.0/Changelog.md
325
325
  documentation_uri: https://rspec.info/documentation/
326
326
  mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
327
327
  source_code_uri: https://github.com/rspec/rspec-rails
metadata.gz.sig CHANGED
Binary file