rspec-rails 7.0.1 → 7.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5f52b2377b281190553090f208b2d03f030aefb03395fb46afd8af1c63df3a1
4
- data.tar.gz: 1a7c088f8ee631d5f9756277724554ccc30247719849a1dd0b6d03bfd8279e11
3
+ metadata.gz: 725cbfd52d9f763648a595bba0a46d7c0905548e04b988f7c451a0b23ec5e283
4
+ data.tar.gz: ae2f038303eca35e63674c059e4ebe3b3788c47e52bd397ed67c5b857b8f2e19
5
5
  SHA512:
6
- metadata.gz: 5dbf49c52a590a8ce6d91ced03bfc78ebeb4737b8cfcc11932e8959b38c0428eca4414da31a82172ca965db65fed36e490e8c85e761f1fed0f2ef555b9b75210
7
- data.tar.gz: c47326924297943c4d0704f3da54f8ef13a849a73d3a023405cf290347698c0b486a8c692a8774cc022bbf92a80c424197bca1d44a1cd46c1a613cb0ffca3e79
6
+ metadata.gz: 3949cffce869076c1b3d84806c76ce5c609b8ae7cc5cd906b44ed09d8df3be4c7d7603c4a2d0430d2337fe7d828b8879025bf32fcacecbb2da010f2108949479
7
+ data.tar.gz: 0a9c1d5d4968a49d52d6d68078761241431a28c8e2f023d3228536839c7a550d637996b050fbc771f475cc2b3951f0846be429a31fba9d124138f3d8b67d66e3
checksums.yaml.gz.sig CHANGED
Binary file
data/Changelog.md CHANGED
@@ -1,5 +1,25 @@
1
1
  ### Development
2
- [Full Changelog](https://github.com/rspec/rspec-rails/compare/v7.0.1...7-0-maintenance)
2
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v7.1.0...7-1-maintenance)
3
+
4
+ ### 7.1.0 / 2024-11-09
5
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v7.0.2...v7.1.0)
6
+
7
+ Enhancements:
8
+
9
+ * Improve implicit description for ActionCable matchers `have_broadcasted_to` /
10
+ `have_broadcast`. (Simon Fish, #2795)
11
+ * Comment out `infer_spec_type_from_file_location!` in newly generated
12
+ `rails_helper.rb` files. (Jon Rowe, #2804)
13
+ * Allow turning off active job / mailer argument validation.
14
+ (Oli Peate, #2808)
15
+
16
+ ### 7.0.2 / 2024-11-09
17
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v7.0.1...v7.0.2)
18
+
19
+ Bug Fixes:
20
+
21
+ * Fix issue with `have_enqueued_mail` when jobs were incorrectly matched due
22
+ to refactoring in #2780. (David Runger, #2793)
3
23
 
4
24
  ### 7.0.1 / 2024-09-03
5
25
  [Full Changelog](https://github.com/rspec/rspec-rails/compare/v7.0.0...v7.0.1)
@@ -19,7 +39,7 @@ Enhancements:
19
39
  * Change default driver for system specs on Rails 7.2 to match its default.
20
40
  (Steve Polito, #2746)
21
41
  * Verify ActiveJob arguments by comparing to the method signature. (Oli Peate, #2745)
22
- * Add suggestion to rails_helper.rb to skip when not in test most. (Glauco Custódio, #2751)
42
+ * Add suggestion to rails_helper.rb to skip when not in test mode. (Glauco Custódio, #2751)
23
43
  * Add `at_priority` qualifier to `have_enqueued_job` set of matchers. (mbajur, #2759)
24
44
  * Add spec directories to `rails stats` on Rails main / 8.0.0. (Petrik de Heus, #2781)
25
45
 
data/README.md CHANGED
@@ -10,7 +10,7 @@ expressed in plain English.
10
10
 
11
11
  According to [RSpec Rails new versioning strategy][] use:
12
12
  * **[`rspec-rails` 7.x][]** for Rails 7.x.
13
- * **[`rspec-rails` 6.x][]** for Rails 6.1.
13
+ * **[`rspec-rails` 6.x][]** for Rails 6.1, 7.0 or 7.1.
14
14
  * **[`rspec-rails` 5.x][]** for Rails 5.2 or 6.x.
15
15
  * **[`rspec-rails` 4.x][]** for Rails from 5.x or 6.x.
16
16
  * **[`rspec-rails` 3.x][]** for Rails earlier than 5.0.
@@ -32,7 +32,7 @@ According to [RSpec Rails new versioning strategy][] use:
32
32
 
33
33
  ## Installation
34
34
 
35
- **IMPORTANT** This README / branch refers to the 7.0.x stable release series, only bugfixes from this series will
35
+ **IMPORTANT** This README / branch refers to the 7.1.x stable release series, only bugfixes from this series will
36
36
  be added here. See the [`main` branch on Github](https://github.com/rspec/rspec-rails/tree/main) if you want or
37
37
  require the latest unstable features.
38
38
 
@@ -67,20 +67,22 @@ RSpec.configure do |config|
67
67
  # config.use_transactional_fixtures = true
68
68
 
69
69
  <% end -%>
70
- # RSpec Rails can automatically mix in different behaviours to your tests
71
- # based on their file location, for example enabling you to call `get` and
72
- # `post` in specs under `spec/controllers`.
70
+ # RSpec Rails uses metadata to mix in different behaviours to your tests,
71
+ # for example enabling you to call `get` and `post` in request specs. e.g.:
73
72
  #
74
- # You can disable this behaviour by removing the line below, and instead
75
- # explicitly tag your specs with their type, e.g.:
76
- #
77
- # RSpec.describe UsersController, type: :controller do
73
+ # RSpec.describe UsersController, type: :request do
78
74
  # # ...
79
75
  # end
80
76
  #
81
77
  # The different available types are documented in the features, such as in
82
78
  # https://rspec.info/features/7-0/rspec-rails
83
- config.infer_spec_type_from_file_location!
79
+ #
80
+ # You can also this infer these behaviours automatically by location, e.g.
81
+ # /spec/models would pull in the same behaviour as `type: :model` but this
82
+ # behaviour is considered legacy and will be removed in a future version.
83
+ #
84
+ # To enable this behaviour uncomment the line below.
85
+ # config.infer_spec_type_from_file_location!
84
86
 
85
87
  # Filter lines from Rails gems in backtraces.
86
88
  config.filter_rails_from_backtrace!
@@ -51,6 +51,10 @@ module RSpec
51
51
  exactly(:thrice)
52
52
  end
53
53
 
54
+ def description
55
+ "have broadcasted #{base_description}"
56
+ end
57
+
54
58
  def failure_message
55
59
  "expected to broadcast #{base_message}".tap do |msg|
56
60
  if @unmatching_msgs.any?
@@ -140,18 +144,21 @@ module RSpec
140
144
  end
141
145
  end
142
146
 
143
- def base_message
147
+ def base_description
144
148
  "#{message_expectation_modifier} #{@expected_number} messages to #{stream}".tap do |msg|
145
149
  msg << " with #{data_description(@data)}" unless @data.nil?
146
- msg << ", but broadcast #{@matching_msgs_count}"
147
150
  end
148
151
  end
149
152
 
153
+ def base_message
154
+ "#{base_description}, but broadcast #{@matching_msgs_count}"
155
+ end
156
+
150
157
  def data_description(data)
151
158
  if data.is_a?(RSpec::Matchers::Composable)
152
159
  data.description
153
160
  else
154
- data
161
+ data.inspect
155
162
  end
156
163
  end
157
164
 
@@ -3,6 +3,8 @@ require "rspec/rails/matchers/action_cable/have_broadcasted_to"
3
3
  module RSpec
4
4
  module Rails
5
5
  module Matchers
6
+ extend RSpec::Matchers::DSL
7
+
6
8
  # Namespace for various implementations of ActionCable features
7
9
  #
8
10
  # @api private
@@ -50,7 +52,10 @@ module RSpec
50
52
 
51
53
  ActionCable::HaveBroadcastedTo.new(target, channel: described_class)
52
54
  end
53
- alias_method :broadcast_to, :have_broadcasted_to
55
+
56
+ alias_matcher :broadcast_to, :have_broadcasted_to do |desc|
57
+ desc.gsub("have broadcasted", "broadcast")
58
+ end
54
59
 
55
60
  private
56
61
 
@@ -178,6 +178,8 @@ module RSpec
178
178
  end
179
179
 
180
180
  def detect_args_signature_mismatch(jobs)
181
+ return if skip_signature_verification?
182
+
181
183
  jobs.each do |job|
182
184
  args = deserialize_arguments(job)
183
185
 
@@ -189,6 +191,11 @@ module RSpec
189
191
  nil
190
192
  end
191
193
 
194
+ def skip_signature_verification?
195
+ !RSpec::Mocks.configuration.verify_partial_doubles? ||
196
+ RSpec::Mocks.configuration.temporarily_suppress_partial_double_verification
197
+ end
198
+
192
199
  def check_args_signature_mismatch(job_class, job_method, args)
193
200
  signature = Support::MethodSignature.new(job_class.public_instance_method(job_method))
194
201
  verifier = Support::StrictSignatureVerifier.new(signature, args)
@@ -72,7 +72,7 @@ module RSpec
72
72
  @mailer_class ? @mailer_class.name : 'ActionMailer::Base'
73
73
  end
74
74
 
75
- def job_match?(job)
75
+ def job_matches?(job)
76
76
  legacy_mail?(job) || parameterized_mail?(job) || unified_mail?(job)
77
77
  end
78
78
 
@@ -93,6 +93,7 @@ module RSpec
93
93
 
94
94
  def detect_args_signature_mismatch(jobs)
95
95
  return if @method_name.nil?
96
+ return if skip_signature_verification?
96
97
 
97
98
  mailer_class = mailer_class_name.constantize
98
99
 
@@ -123,7 +124,7 @@ module RSpec
123
124
 
124
125
  def unmatching_mail_jobs
125
126
  @unmatching_jobs.select do |job|
126
- job_match?(job)
127
+ job_matches?(job)
127
128
  end
128
129
  end
129
130
 
@@ -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 = '7.0.1'
6
+ STRING = '7.1.0'
7
7
  end
8
8
  end
9
9
  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: 7.0.1
4
+ version: 7.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chelimsky
@@ -44,7 +44,7 @@ cert_chain:
44
44
  ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
45
45
  F3MdtaDehhjC
46
46
  -----END CERTIFICATE-----
47
- date: 2024-09-03 00:00:00.000000000 Z
47
+ date: 2024-11-09 00:00:00.000000000 Z
48
48
  dependencies:
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: actionpack
@@ -296,7 +296,7 @@ licenses:
296
296
  - MIT
297
297
  metadata:
298
298
  bug_tracker_uri: https://github.com/rspec/rspec-rails/issues
299
- changelog_uri: https://github.com/rspec/rspec-rails/blob/v7.0.1/Changelog.md
299
+ changelog_uri: https://github.com/rspec/rspec-rails/blob/v7.1.0/Changelog.md
300
300
  documentation_uri: https://rspec.info/documentation/
301
301
  mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
302
302
  source_code_uri: https://github.com/rspec/rspec-rails
@@ -316,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
316
316
  - !ruby/object:Gem::Version
317
317
  version: '0'
318
318
  requirements: []
319
- rubygems_version: 3.5.11
319
+ rubygems_version: 3.5.22
320
320
  signing_key:
321
321
  specification_version: 4
322
322
  summary: RSpec for Rails
metadata.gz.sig CHANGED
Binary file