rspec-rails 5.1.2 → 6.0.0.rc1

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: be221e5df3386cb55e14f8047e02628bc11098596dcce06749701ac0b7497782
4
- data.tar.gz: 56b12531541ff18599c13618ba2937859bb4cd860cc814b3350046ec4949e870
3
+ metadata.gz: 4e5b8e558204b4aa74489900d89ab1b5b413df21a38e5294346954432a7b0720
4
+ data.tar.gz: aa907c72c9e7e8e9b4050a7278e369623a1b038560df95fa1e1136372bcb7a2d
5
5
  SHA512:
6
- metadata.gz: a1786502c478ab9de29fbd59ce16371178776a7283698ba048b203f62aa614fc6c28e4c72b5064595f4eacd2cf309443de8d0d6803ac604e9d11a641c6f86c4b
7
- data.tar.gz: 5860654b1926c2f2cdd998d2b84ac075167f7107bd687b74dae5bb9e17d7e76ef6b0c96dd022ec7a9be5dc0fe008e845808187080e97b400bec18b35d1872e76
6
+ metadata.gz: 011d4e18b91b00620daaf0c9458d01746940d20ccf3e295274ef0842fe7e3963520dea370c42fdaeb2c041f1999735305bfcb1770d8b2a9567ef37bbb878572f
7
+ data.tar.gz: f00aca8c607b36e3c1deff9afc5c472bf5e38721266082c8918222503ef38b9e4e41d590ef154a37e68cfe70670466f6d9f6f8830c0d8ce4b7af8dea85ecaa7a
checksums.yaml.gz.sig CHANGED
Binary file
data/Changelog.md CHANGED
@@ -1,10 +1,16 @@
1
1
  ### Development
2
- [Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.1.1...5-1-maintenance)
2
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.1.1...main)
3
3
 
4
- Bug Fixes:
4
+ ### 6.0.0.rc1
5
+
6
+ Enhancements:
7
+
8
+ * Support Rails 7
9
+
10
+ Breaking Changes:
5
11
 
6
- * Fix controller scaffold templates parameter name. (Taketo Takashima, #2591)
7
- * Include generator specs in the inferred list of specs. (Jason Karns, #2597)
12
+ * Drop support for Rails below 6.1
13
+ * Drop support for Ruby below 2.5 (following supported versions of Rails 6.1)
8
14
 
9
15
  ### 5.1.1 / 2022-03-07
10
16
  [Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.1.0...v5.1.1)
@@ -31,8 +37,9 @@ Bug Fixes:
31
37
 
32
38
  * Properly name params in controller and request spec templates when
33
39
  using the `--model-name` parameter. (@kenzo-tanaka, #2534)
34
- * Fix support for `have_enqueued_mail` on Ruby 3.1 with Rails 6.1.
35
- (Fabio Napoleoni, Mikael Henriksson, Phil Pirozhkov, Jon Rowe, #2566)
40
+ * Fix parameter matching with mail delivery job and
41
+ ActionMailer::MailDeliveryJob. (Fabio Napoleoni, #2516, #2546)
42
+ * Fix Rails 7 `have_enqueued_mail` compatibility (Mikael Henriksson, #2537, #2546)
36
43
 
37
44
  ### 5.0.2 / 2021-08-14
38
45
  [Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.1...v5.0.2)
data/README.md CHANGED
@@ -9,7 +9,8 @@ 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` 5.x][]** for Rails 6.x.
12
+ * **[`rspec-rails` 6.x][]** for Rails 6.1 or 7.x.
13
+ * **[`rspec-rails` 5.x][]** for Rails 5.2 or 6.x.
13
14
  * **[`rspec-rails` 4.x][]** for Rails from 5.x or 6.x.
14
15
  * **[`rspec-rails` 3.x][]** for Rails earlier than 5.0.
15
16
  * **[`rspec-rails` 1.x][]** for Rails 2.x.
@@ -25,13 +26,14 @@ According to [RSpec Rails new versioning strategy][] use:
25
26
  [`rspec-rails` 1.x]: https://github.com/dchelimsky/rspec-rails
26
27
  [`rspec-rails` 3.x]: https://github.com/rspec/rspec-rails/tree/3-9-maintenance
27
28
  [`rspec-rails` 4.x]: https://github.com/rspec/rspec-rails/tree/4-1-maintenance
28
- [`rspec-rails` 5.x]: https://github.com/rspec/rspec-rails/tree/5-0-maintenance
29
+ [`rspec-rails` 5.x]: https://github.com/rspec/rspec-rails/tree/5-1-maintenance
30
+ [`rspec-rails` 6.x]: https://github.com/rspec/rspec-rails/tree/6-0-maintenance
29
31
  [RSpec Rails new versioning strategy]: https://github.com/rspec/rspec-rails/blob/main/rfcs/versioning-strategy.md
30
32
 
31
33
  ## Installation
32
34
 
33
35
  **IMPORTANT** This README / branch refers to the current development build.
34
- See the [`5-0-maintenance` branch on Github](https://github.com/rspec/rspec-rails/tree/5-0-maintenance) if you want or require the latest stable release.
36
+ See the [`6-0-maintenance` branch on Github](https://github.com/rspec/rspec-rails/tree/6-0-maintenance) if you want or require the latest stable release.
35
37
 
36
38
  1. Add `rspec-rails` to **both** the `:development` and `:test` groups
37
39
  of your app’s `Gemfile`:
@@ -39,7 +41,7 @@ See the [`5-0-maintenance` branch on Github](https://github.com/rspec/rspec-rail
39
41
  ```ruby
40
42
  # Run against this stable release
41
43
  group :development, :test do
42
- gem 'rspec-rails', '~> 5.0.0'
44
+ gem 'rspec-rails', '~> 6.0.0'
43
45
  end
44
46
 
45
47
  # Or, run against the main branch
@@ -28,8 +28,7 @@ require 'rspec/rails'
28
28
  begin
29
29
  ActiveRecord::Migration.maintain_test_schema!
30
30
  rescue ActiveRecord::PendingMigrationError => e
31
- puts e.to_s.strip
32
- exit 1
31
+ abort e.to_s.strip
33
32
  end
34
33
  <% end -%>
35
34
  RSpec.configure do |config|
@@ -100,7 +100,7 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
100
100
 
101
101
  it "renders a JSON response with the <%= singular_table_name %>" do
102
102
  <%= file_name %> = <%= class_name %>.create! valid_attributes
103
- put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: new_attributes}, session: valid_session
103
+ put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: valid_attributes}, session: valid_session
104
104
  expect(response).to have_http_status(:ok)
105
105
  expect(response.content_type).to eq('application/json')
106
106
  end
@@ -90,10 +90,17 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
90
90
  end
91
91
 
92
92
  context "with invalid params" do
93
+ <% if Rails.version.to_f < 7.0 %>
93
94
  it "returns a success response (i.e. to display the 'new' template)" do
94
95
  post :create, params: {<%= singular_table_name %>: invalid_attributes}, session: valid_session
95
96
  expect(response).to be_successful
96
97
  end
98
+ <% else %>
99
+ it "renders a response with 422 status (i.e. to display the 'new' template)" do
100
+ post :create, params: {<%= singular_table_name %>: invalid_attributes}, session: valid_session
101
+ expect(response).to have_http_status(:unprocessable_entity)
102
+ end
103
+ <% end %>
97
104
  end
98
105
  end
99
106
 
@@ -112,17 +119,25 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
112
119
 
113
120
  it "redirects to the <%= singular_table_name %>" do
114
121
  <%= file_name %> = <%= class_name %>.create! valid_attributes
115
- put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: new_attributes}, session: valid_session
122
+ put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: valid_attributes}, session: valid_session
116
123
  expect(response).to redirect_to(<%= file_name %>)
117
124
  end
118
125
  end
119
126
 
120
127
  context "with invalid params" do
128
+ <% if Rails.version.to_f < 7.0 %>
121
129
  it "returns a success response (i.e. to display the 'edit' template)" do
122
130
  <%= file_name %> = <%= class_name %>.create! valid_attributes
123
131
  put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: invalid_attributes}, session: valid_session
124
132
  expect(response).to be_successful
125
133
  end
134
+ <% else %>
135
+ it "renders a response with 422 status (i.e. to display the 'edit' template)" do
136
+ <%= file_name %> = <%= class_name %>.create! valid_attributes
137
+ put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: invalid_attributes}, session: valid_session
138
+ expect(response).to have_http_status(:unprocessable_entity)
139
+ end
140
+ <% end %>
126
141
  end
127
142
  end
128
143
 
@@ -18,8 +18,9 @@ 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
22
  <% for attribute in output_attributes -%>
22
- assert_select "tr>td", text: <%= value_for(attribute) %>.to_s, count: 2
23
+ assert_select cell_selector, text: Regexp.new(<%= value_for(attribute) %>.to_s), count: 2
23
24
  <% end -%>
24
25
  end
25
26
  end
@@ -83,10 +83,17 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
83
83
  }.to change(<%= class_name %>, :count).by(0)
84
84
  end
85
85
 
86
+ <% if Rails.version.to_f < 7.0 %>
86
87
  it "renders a successful response (i.e. to display the 'new' template)" do
87
88
  post <%= index_helper %>_url, params: { <%= singular_table_name %>: invalid_attributes }
88
89
  expect(response).to be_successful
89
90
  end
91
+ <% else %>
92
+ it "renders a response with 422 status (i.e. to display the 'new' template)" do
93
+ post <%= index_helper %>_url, params: { <%= singular_table_name %>: invalid_attributes }
94
+ expect(response).to have_http_status(:unprocessable_entity)
95
+ end
96
+ <% end %>
90
97
  end
91
98
  end
92
99
 
@@ -112,11 +119,19 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
112
119
  end
113
120
 
114
121
  context "with invalid parameters" do
122
+ <% if Rails.version.to_f < 7.0 %>
115
123
  it "renders a successful response (i.e. to display the 'edit' template)" do
116
124
  <%= file_name %> = <%= class_name %>.create! valid_attributes
117
125
  patch <%= show_helper %>, params: { <%= singular_table_name %>: invalid_attributes }
118
126
  expect(response).to be_successful
119
127
  end
128
+ <% else %>
129
+ it "renders a response with 422 status (i.e. to display the 'edit' template)" do
130
+ <%= file_name %> = <%= class_name %>.create! valid_attributes
131
+ patch <%= show_helper %>, params: { <%= singular_table_name %>: invalid_attributes }
132
+ expect(response).to have_http_status(:unprocessable_entity)
133
+ end
134
+ <% end %>
120
135
  end
121
136
  end
122
137
 
@@ -28,7 +28,6 @@ module RSpec
28
28
  DIRECTORY_MAPPINGS = {
29
29
  channel: %w[spec channels],
30
30
  controller: %w[spec controllers],
31
- generator: %w[spec generator],
32
31
  helper: %w[spec helpers],
33
32
  job: %w[spec jobs],
34
33
  mailer: %w[spec mailers],
@@ -150,10 +150,10 @@ module RSpec
150
150
  match = path_regex.match(_default_file_to_render)
151
151
 
152
152
  render_options = {template: match[:template]}
153
- render_options[:handlers] = [match[:handler]] if match[:handler]
153
+ render_options[:handlers] = [match[:handler].to_sym] if match[:handler]
154
154
  render_options[:formats] = [match[:format].to_sym] if match[:format]
155
- render_options[:locales] = [match[:locale]] if match[:locale]
156
- render_options[:variants] = [match[:variant]] if match[:variant]
155
+ render_options[:locales] = [match[:locale].to_sym] if match[:locale]
156
+ render_options[:variants] = [match[:variant].to_sym] if match[:variant]
157
157
 
158
158
  render_options
159
159
  end
@@ -28,13 +28,17 @@ module RSpec
28
28
  end
29
29
 
30
30
  def has_action_mailer_parameterized?
31
- has_action_mailer? && defined?(::ActionMailer::Parameterized)
31
+ has_action_mailer? && defined?(::ActionMailer::Parameterized::DeliveryJob)
32
32
  end
33
33
 
34
34
  def has_action_mailer_unified_delivery?
35
35
  has_action_mailer? && defined?(::ActionMailer::MailDeliveryJob)
36
36
  end
37
37
 
38
+ def has_action_mailer_legacy_delivery_job?
39
+ defined?(ActionMailer::DeliveryJob)
40
+ end
41
+
38
42
  def has_action_mailbox?
39
43
  defined?(::ActionMailbox)
40
44
  end
@@ -46,7 +46,7 @@ module RSpec
46
46
  def proxy_method_warning_if_called_in_before_context_scope(method_name)
47
47
  orig_implementation = instance_method(method_name)
48
48
  define_method(method_name) do |*args, &blk|
49
- if inspect.include?("before(:context)")
49
+ if RSpec.current_scope == :before_context_hook
50
50
  RSpec.warn_with("Calling fixture method in before :context ")
51
51
  else
52
52
  orig_implementation.bind(self).call(*args, &blk)
@@ -158,7 +158,7 @@ module RSpec
158
158
  end
159
159
 
160
160
  def legacy_mail?(job)
161
- job[:job] <= ActionMailer::DeliveryJob
161
+ RSpec::Rails::FeatureCheck.has_action_mailer_legacy_delivery_job? && job[:job] <= ActionMailer::DeliveryJob
162
162
  end
163
163
 
164
164
  def parameterized_mail?(job)
@@ -169,6 +169,7 @@ module RSpec
169
169
  RSpec::Rails::FeatureCheck.has_action_mailer_unified_delivery? && job[:job] <= ActionMailer::MailDeliveryJob
170
170
  end
171
171
  end
172
+
172
173
  # @api public
173
174
  # Passes if an email has been enqueued inside block.
174
175
  # May chain with to specify expected arguments.
@@ -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 = '5.1.2'
6
+ STRING = '6.0.0.rc1'
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: 5.1.2
4
+ version: 6.0.0.rc1
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: 2022-04-24 00:00:00.000000000 Z
47
+ date: 2022-04-03 00:00:00.000000000 Z
48
48
  dependencies:
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: actionpack
@@ -52,98 +52,98 @@ dependencies:
52
52
  requirements:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: '5.2'
55
+ version: '6.1'
56
56
  type: :runtime
57
57
  prerelease: false
58
58
  version_requirements: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: '5.2'
62
+ version: '6.1'
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: activesupport
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: '5.2'
69
+ version: '6.1'
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: '5.2'
76
+ version: '6.1'
77
77
  - !ruby/object:Gem::Dependency
78
78
  name: railties
79
79
  requirement: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
- version: '5.2'
83
+ version: '6.1'
84
84
  type: :runtime
85
85
  prerelease: false
86
86
  version_requirements: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - ">="
89
89
  - !ruby/object:Gem::Version
90
- version: '5.2'
90
+ version: '6.1'
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rspec-core
93
93
  requirement: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '3.10'
97
+ version: '3.11'
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.10'
104
+ version: '3.11'
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.10'
111
+ version: '3.11'
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.10'
118
+ version: '3.11'
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.10'
125
+ version: '3.11'
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.10'
132
+ version: '3.11'
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.10'
139
+ version: '3.11'
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.10'
146
+ version: '3.11'
147
147
  - !ruby/object:Gem::Dependency
148
148
  name: ammeter
149
149
  requirement: !ruby/object:Gem::Requirement
@@ -308,7 +308,7 @@ licenses:
308
308
  - MIT
309
309
  metadata:
310
310
  bug_tracker_uri: https://github.com/rspec/rspec-rails/issues
311
- changelog_uri: https://github.com/rspec/rspec-rails/blob/v5.1.2/Changelog.md
311
+ changelog_uri: https://github.com/rspec/rspec-rails/blob/v6.0.0.rc1/Changelog.md
312
312
  documentation_uri: https://rspec.info/documentation/
313
313
  mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
314
314
  source_code_uri: https://github.com/rspec/rspec-rails
@@ -321,12 +321,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
321
321
  requirements:
322
322
  - - ">="
323
323
  - !ruby/object:Gem::Version
324
- version: 2.2.0
324
+ version: 2.5.0
325
325
  required_rubygems_version: !ruby/object:Gem::Requirement
326
326
  requirements:
327
- - - ">="
327
+ - - ">"
328
328
  - !ruby/object:Gem::Version
329
- version: '0'
329
+ version: 1.3.1
330
330
  requirements: []
331
331
  rubygems_version: 3.1.6
332
332
  signing_key:
metadata.gz.sig CHANGED
Binary file