rspec-rails 6.1.1 → 6.1.5

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: b5ff6b0dc14db86b07e0cc46cd193329c85e21d15c9863ccbb5b73c54972daa6
4
- data.tar.gz: c7bd505a3bfd16f881fb04b04e98ff7df9910d230eb17183fc68621a74d4b9d9
3
+ metadata.gz: 794b82d1aea01113c12d4d6d6baab45e129466eb3da90a6f237f97a600489c44
4
+ data.tar.gz: 492866fad93a1945fdb95b6ed10b0ec1739575d8769f83845f7572b450042b2f
5
5
  SHA512:
6
- metadata.gz: 6abbc3617dd82480b86c99c5d9347c94f8ac62bb944cf4ce1a223bea60046d9108be76fc3045a2e5f8549ad9813f7e831882f9ddee31de9d4215f643ce8a6d43
7
- data.tar.gz: 07b551b367df408eaaa847307a6abd28a566a6a17ee4b552dc99a8bad95794f262884dc6e34a4d5717146fa001f89f6060cd1784818ed29f11f5361753fa606d
6
+ metadata.gz: da28fe40ba3272d1a91e9c4be4d92a3aa88fc041ce69f904bc4e121b82e21affc6946a29df87be201bdda938a44f2057b3ac8c79dcfa20ada543bd604cbbeea7
7
+ data.tar.gz: 69ac337cdc6b192929d1812e69ab148154484500bf655a47bd8575d664ace8101b2ec9b8d054133f1117371099402f4e07f4bc02066666a57148a0f658a67ad6
checksums.yaml.gz.sig CHANGED
Binary file
data/Changelog.md CHANGED
@@ -1,5 +1,40 @@
1
1
  ### Development
2
- [Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.1...6-1-maintenance)
2
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.5...6-1-maintenance)
3
+
4
+ ### 6.1.5 / 2024-09-02
5
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.4...v6.1.5)
6
+
7
+ Bug Fixes:
8
+
9
+ * Restore old order of requiring support files. (Franz Liedke, #2785)
10
+ * Prevent running `rake spec:statsetup` on Rails main / 8.0.0. (Petrik de Heus, #2781)
11
+
12
+ ### 6.1.4 / 2024-08-15
13
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.3...v6.1.4)
14
+
15
+ Bug Fixes:
16
+
17
+ * Prevent `have_http_status` matcher raising an error when encountering a raw `Rack::MockResponse`.
18
+ (Christophe Bliard, #2771)
19
+ * Move Rails version conditional from index scaffold generated file to template. (Matt Jankowski, #2777)
20
+
21
+ ### 6.1.3 / 2024-06-19
22
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.2...v6.1.3)
23
+
24
+ Bug Fixes:
25
+
26
+ * Reset `ActiveSupport::CurrentAttributes` between examples. (Javier Julio, #2752)
27
+ * Fix a broken link in generated mailer previews. (Chiara Núñez, #2764)
28
+ * Fix `have_status_code` behaviour with deprecated status names by delegating
29
+ to `Rack::Utils.status_code/1` to set the expected status code. (Darren Boyd, #2765)
30
+
31
+ ### 6.1.2 / 2024-03-19
32
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.1...v6.1.2)
33
+
34
+ Bug Fixes:
35
+
36
+ * Fix generated mailer paths to match Rails convention. (Patrício dos Santos, #2735)
37
+ * Fix class in template for generator specs. (Nicolas Buduroi, #2744)
3
38
 
4
39
  ### 6.1.1 / 2024-01-25
5
40
  [Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.0...v6.1.1)
@@ -181,7 +216,7 @@ Enhancements:
181
216
  (Eloy Espinaco, Luka Lüdicke, #2355, #2356, #2378)
182
217
  * Generated scaffold now includes engine route helpers when inside a mountable engine.
183
218
  (Andrew W. Lee, #2372)
184
- * Improve request spec "controller" scafold when no action is specified.
219
+ * Improve request spec "controller" scaffold when no action is specified.
185
220
  (Thomas Hareau, #2399)
186
221
  * Introduce testing snippets concept (Phil Pirozhkov, Benoit Tigeot, #2423)
187
222
  * Prevent collisions with `let(:name)` for Rails 6.1 and `let(:method_name)` on older
@@ -584,7 +619,7 @@ Enhancements:
584
619
  * Add support for PATCH to route specs created via scaffold. (Igor Zubkov, #1336)
585
620
  * Improve controller and routing spec calls to `routes` by using `yield`
586
621
  instead of `call`. (Anton Davydov, #1308)
587
- * Add support for `ActiveJob` specs as standard `RSpec::Rails::RailsExampleGoup`s
622
+ * Add support for `ActiveJob` specs as standard `RSpec::Rails::RailsExampleGroup`s
588
623
  via both `type: :job` and inferring type from spec directory `spec/jobs`.
589
624
  (Gabe Martin-Dempesy, #1361)
590
625
  * Include `RSpec::Rails::FixtureSupport` into example groups using metadata
@@ -4,7 +4,7 @@ module Rspec
4
4
  module Generators
5
5
  # @private
6
6
  class GeneratorGenerator < Base
7
- class_option :generator_specs, type: :boolean, default: true, desc: "Generate generator specs"
7
+ class_option :generator_specs, type: :boolean, default: true, desc: 'Generate generator specs'
8
8
 
9
9
  def generate_generator_spec
10
10
  return unless options[:generator_specs]
@@ -17,7 +17,7 @@ module Rspec
17
17
  end
18
18
 
19
19
  def filename
20
- "#{table_name}_generator_spec.rb"
20
+ "#{file_name}_generator_spec.rb"
21
21
  end
22
22
  end
23
23
  end
@@ -1,6 +1,5 @@
1
1
  require 'rails_helper'
2
2
 
3
- RSpec.describe "<%= class_name.pluralize %>", <%= type_metatag(:generator) %> do
4
-
3
+ RSpec.describe "<%= class_name %>Generator", <%= type_metatag(:generator) %> do
5
4
  pending "add some scenarios (or delete) #{__FILE__}"
6
5
  end
@@ -20,7 +20,7 @@ require 'rspec/rails'
20
20
  # directory. Alternatively, in the individual `*_spec.rb` files, manually
21
21
  # require only the support files necessary.
22
22
  #
23
- # Rails.root.glob('spec/support/**/*.rb').sort.each { |f| require f }
23
+ # Rails.root.glob('spec/support/**/*.rb').sort_by(&:to_s).each { |f| require f }
24
24
 
25
25
  <% if RSpec::Rails::FeatureCheck.has_active_record_migration? -%>
26
26
  # Checks for pending migrations and applies them before tests are run.
@@ -8,7 +8,8 @@ module Rspec
8
8
  argument :actions, type: :array, default: [], banner: "method method"
9
9
 
10
10
  def generate_mailer_spec
11
- template "mailer_spec.rb", target_path('mailers', class_path, "#{file_name}_spec.rb")
11
+ file_suffix = file_name.end_with?('mailer') ? 'spec.rb' : 'mailer_spec.rb'
12
+ template "mailer_spec.rb", target_path('mailers', class_path, [file_name, file_suffix].join('_'))
12
13
  end
13
14
 
14
15
  def generate_fixtures_files
@@ -21,7 +22,8 @@ module Rspec
21
22
  def generate_preview_files
22
23
  return unless RSpec::Rails::FeatureCheck.has_action_mailer_preview?
23
24
 
24
- template "preview.rb", target_path("mailers/previews", class_path, "#{file_name}_preview.rb")
25
+ file_suffix = file_name.end_with?('mailer') ? 'preview.rb' : 'mailer_preview.rb'
26
+ template "preview.rb", target_path("mailers/previews", class_path, [file_name, file_suffix].join('_'))
25
27
  end
26
28
  end
27
29
  end
@@ -1,9 +1,9 @@
1
1
  <% module_namespacing do -%>
2
- # Preview all emails at http://localhost:3000/rails/mailers/<%= file_path %>
3
- class <%= class_name %>Preview < ActionMailer::Preview
2
+ # Preview all emails at http://localhost:3000/rails/mailers/<%= file_path %>_mailer
3
+ class <%= class_name %><%= 'Mailer' unless class_name.end_with?('Mailer') %>Preview < ActionMailer::Preview
4
4
  <% actions.each do |action| -%>
5
5
 
6
- # Preview this email at http://localhost:3000/rails/mailers/<%= file_path %>/<%= action %>
6
+ # Preview this email at http://localhost:3000/rails/mailers/<%= file_path %>_mailer/<%= action %>
7
7
  def <%= action %>
8
8
  <%= class_name.sub(/(Mailer)?$/, 'Mailer') %>.<%= action %>
9
9
  end
@@ -18,7 +18,7 @@ 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
- cell_selector = Rails::VERSION::STRING >= '7' ? 'div>p' : 'tr>td'
21
+ cell_selector = <%= Rails::VERSION::STRING >= '7' ? "'div>p'" : "'tr>td'" %>
22
22
  <% for attribute in output_attributes -%>
23
23
  assert_select cell_selector, text: Regexp.new(<%= value_for(attribute) %>.to_s), count: 2
24
24
  <% end -%>
@@ -69,7 +69,7 @@ module RSpec
69
69
  #
70
70
  # @param message [Hash, Mail::Message] a mail message or hash of
71
71
  # attributes used to build one
72
- # @return [ActionMaibox::InboundMessage]
72
+ # @return [ActionMailbox::InboundMessage]
73
73
  def process(message)
74
74
  MailboxExampleGroup.create_inbound_email(message).tap do |mail|
75
75
  self.class.mailbox_class.receive(mail)
@@ -3,6 +3,7 @@
3
3
  require 'rspec/rails/matchers'
4
4
 
5
5
  if ::Rails::VERSION::MAJOR >= 7
6
+ require 'active_support/current_attributes/test_helper'
6
7
  require 'active_support/execution_context/test_helper'
7
8
  end
8
9
 
@@ -18,6 +19,7 @@ module RSpec
18
19
  include RSpec::Rails::FixtureSupport
19
20
  if ::Rails::VERSION::MAJOR >= 7
20
21
  include RSpec::Rails::TaggedLoggingAdapter
22
+ include ActiveSupport::CurrentAttributes::TestHelper
21
23
  include ActiveSupport::ExecutionContext::TestHelper
22
24
  end
23
25
  end
@@ -1,5 +1,3 @@
1
- require "action_dispatch/testing/assertions/routing"
2
-
3
1
  module RSpec
4
2
  module Rails
5
3
  # @private
@@ -384,33 +384,33 @@ module RSpec
384
384
  #
385
385
  # @example
386
386
  # expect {
387
- # perform_jobs { HeavyLiftingJob.perform_later }
387
+ # perform_enqueued_jobs { HeavyLiftingJob.perform_later }
388
388
  # }.to have_performed_job
389
389
  #
390
390
  # expect {
391
- # perform_jobs {
391
+ # perform_enqueued_jobs {
392
392
  # HelloJob.perform_later
393
393
  # HeavyLiftingJob.perform_later
394
394
  # }
395
395
  # }.to have_performed_job(HelloJob).exactly(:once)
396
396
  #
397
397
  # expect {
398
- # perform_jobs { 3.times { HelloJob.perform_later } }
398
+ # perform_enqueued_jobs { 3.times { HelloJob.perform_later } }
399
399
  # }.to have_performed_job(HelloJob).at_least(2).times
400
400
  #
401
401
  # expect {
402
- # perform_jobs { HelloJob.perform_later }
402
+ # perform_enqueued_jobs { HelloJob.perform_later }
403
403
  # }.to have_performed_job(HelloJob).at_most(:twice)
404
404
  #
405
405
  # expect {
406
- # perform_jobs {
406
+ # perform_enqueued_jobs {
407
407
  # HelloJob.perform_later
408
408
  # HeavyLiftingJob.perform_later
409
409
  # }
410
410
  # }.to have_performed_job(HelloJob).and have_performed_job(HeavyLiftingJob)
411
411
  #
412
412
  # expect {
413
- # perform_jobs {
413
+ # perform_enqueued_jobs {
414
414
  # HelloJob.set(wait_until: Date.tomorrow.noon, queue: "low").perform_later(42)
415
415
  # }
416
416
  # }.to have_performed_job.with(42).on_queue("low").at(Date.tomorrow.noon)
@@ -33,7 +33,7 @@ module RSpec
33
33
  # @param obj [Object] object to convert to a response
34
34
  # @return [ActionDispatch::TestResponse]
35
35
  def as_test_response(obj)
36
- if ::ActionDispatch::Response === obj
36
+ if ::ActionDispatch::Response === obj || ::Rack::MockResponse === obj
37
37
  ::ActionDispatch::TestResponse.from_response(obj)
38
38
  elsif ::ActionDispatch::TestResponse === obj
39
39
  obj
@@ -216,11 +216,7 @@ module RSpec
216
216
  # @see Rack::Utils::SYMBOL_TO_STATUS_CODE
217
217
  # @raise [ArgumentError] if an associated code could not be found
218
218
  def set_expected_code!
219
- @expected ||=
220
- Rack::Utils::SYMBOL_TO_STATUS_CODE.fetch(expected_status) do
221
- raise ArgumentError,
222
- "Invalid HTTP status: #{expected_status.inspect}"
223
- end
219
+ @expected ||= Rack::Utils.status_code(expected_status)
224
220
  end
225
221
  end
226
222
 
@@ -5,7 +5,9 @@ end
5
5
 
6
6
  task default: :spec
7
7
 
8
- task stats: "spec:statsetup"
8
+ if ::Rails::VERSION::STRING < "8.0.0"
9
+ task stats: "spec:statsetup"
10
+ end
9
11
 
10
12
  desc "Run all specs in spec directory (excluding plugin specs)"
11
13
  RSpec::Core::RakeTask.new(spec: "spec:prepare")
@@ -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 = '6.1.1'
6
+ STRING = '6.1.5'
7
7
  end
8
8
  end
9
9
  end
data/lib/rspec-rails.rb CHANGED
@@ -9,6 +9,7 @@ module RSpec
9
9
  # As of Rails 5.1.0 you can register directories to work with `rake notes`
10
10
  require 'rails/source_annotation_extractor'
11
11
  ::Rails::SourceAnnotationExtractor::Annotation.register_directories("spec")
12
+
12
13
  generators = config.app_generators
13
14
  generators.integration_tool :rspec
14
15
  generators.test_framework :rspec
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: 6.1.1
4
+ version: 6.1.5
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-01-25 00:00:00.000000000 Z
47
+ date: 2024-09-02 00:00:00.000000000 Z
48
48
  dependencies:
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: actionpack
@@ -94,56 +94,56 @@ dependencies:
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '3.12'
97
+ version: '3.13'
98
98
  type: :runtime
99
99
  prerelease: false
100
100
  version_requirements: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: '3.12'
104
+ version: '3.13'
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: rspec-expectations
107
107
  requirement: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: '3.12'
111
+ version: '3.13'
112
112
  type: :runtime
113
113
  prerelease: false
114
114
  version_requirements: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: '3.12'
118
+ version: '3.13'
119
119
  - !ruby/object:Gem::Dependency
120
120
  name: rspec-mocks
121
121
  requirement: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: '3.12'
125
+ version: '3.13'
126
126
  type: :runtime
127
127
  prerelease: false
128
128
  version_requirements: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: '3.12'
132
+ version: '3.13'
133
133
  - !ruby/object:Gem::Dependency
134
134
  name: rspec-support
135
135
  requirement: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - "~>"
138
138
  - !ruby/object:Gem::Version
139
- version: '3.12'
139
+ version: '3.13'
140
140
  type: :runtime
141
141
  prerelease: false
142
142
  version_requirements: !ruby/object:Gem::Requirement
143
143
  requirements:
144
144
  - - "~>"
145
145
  - !ruby/object:Gem::Version
146
- version: '3.12'
146
+ version: '3.13'
147
147
  - !ruby/object:Gem::Dependency
148
148
  name: ammeter
149
149
  requirement: !ruby/object:Gem::Requirement
@@ -186,7 +186,7 @@ dependencies:
186
186
  - - "~>"
187
187
  - !ruby/object:Gem::Version
188
188
  version: '7.0'
189
- description: rspec-rails is a testing framework for Rails 5+.
189
+ description: rspec-rails integrates the Rails testing helpers into RSpec.
190
190
  email: rspec@googlegroups.com
191
191
  executables: []
192
192
  extensions: []
@@ -297,7 +297,7 @@ licenses:
297
297
  - MIT
298
298
  metadata:
299
299
  bug_tracker_uri: https://github.com/rspec/rspec-rails/issues
300
- changelog_uri: https://github.com/rspec/rspec-rails/blob/v6.1.1/Changelog.md
300
+ changelog_uri: https://github.com/rspec/rspec-rails/blob/v6.1.5/Changelog.md
301
301
  documentation_uri: https://rspec.info/documentation/
302
302
  mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
303
303
  source_code_uri: https://github.com/rspec/rspec-rails
@@ -317,7 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
317
317
  - !ruby/object:Gem::Version
318
318
  version: '0'
319
319
  requirements: []
320
- rubygems_version: 3.5.3
320
+ rubygems_version: 3.5.11
321
321
  signing_key:
322
322
  specification_version: 4
323
323
  summary: RSpec for Rails
metadata.gz.sig CHANGED
Binary file