rspec-rails 7.0.2 → 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: 1a6888a2a7b5d0fe8832fc69e0c3e691652ea27ecaf46868396c7c58350761bf
4
- data.tar.gz: 3597b3c0c7488c93da0e5631d3a24a3845f9436287a9ca22afae251519ecbb7d
3
+ metadata.gz: 725cbfd52d9f763648a595bba0a46d7c0905548e04b988f7c451a0b23ec5e283
4
+ data.tar.gz: ae2f038303eca35e63674c059e4ebe3b3788c47e52bd397ed67c5b857b8f2e19
5
5
  SHA512:
6
- metadata.gz: 95e2e9eb8c3209df0a595c7a8bc22e2a829eadc659c65bc60d26b07b3e7978ff408be28bc82782030062c7a237343da0d84b284e3a4dc85fa5c864b1bd9f95b0
7
- data.tar.gz: 6b7624ed2c15001ecf099da01153be86163783650f9a68f6d071732c43f880b10e5286dc326cd5434b7c98e67bc5a61c93710e9277468ec860e7329e5b28b72b
6
+ metadata.gz: 3949cffce869076c1b3d84806c76ce5c609b8ae7cc5cd906b44ed09d8df3be4c7d7603c4a2d0430d2337fe7d828b8879025bf32fcacecbb2da010f2108949479
7
+ data.tar.gz: 0a9c1d5d4968a49d52d6d68078761241431a28c8e2f023d3228536839c7a550d637996b050fbc771f475cc2b3951f0846be429a31fba9d124138f3d8b67d66e3
checksums.yaml.gz.sig CHANGED
Binary file
data/Changelog.md CHANGED
@@ -1,5 +1,17 @@
1
1
  ### Development
2
- [Full Changelog](https://github.com/rspec/rspec-rails/compare/v7.0.2...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)
3
15
 
4
16
  ### 7.0.2 / 2024-11-09
5
17
  [Full Changelog](https://github.com/rspec/rspec-rails/compare/v7.0.1...v7.0.2)
data/README.md CHANGED
@@ -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)
@@ -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
 
@@ -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.2'
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.2
4
+ version: 7.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chelimsky
@@ -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.2/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
metadata.gz.sig CHANGED
Binary file