Skip to content

Commit b9d5676

Browse files
committed
Merge pull request #2791 from rspec/cleanup-rails-6-1
Cleanup for versions 7
1 parent bbf16f9 commit b9d5676

File tree

16 files changed

+23
-178
lines changed

16 files changed

+23
-178
lines changed

Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Bug Fixes:
55

66
* Remove mutation of Rails constant in favour of public api. (Petrik de Heus, #2789)
77
* Cleanup Rails scaffold for unsupported versions. (Matt Jankowski, #2790)
8+
* Remove deprecated scaffold that was unintentionally included in 7.0.0
9+
(Jon Rowe, #2791)
810

911
### 7.0.0 / 2024-09-02
1012
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.5...v7.0.0)

Gemfile-rails-dependencies

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ def add_sqlite3_gem_dependency
2121
end
2222
end
2323

24-
if RUBY_VERSION.to_f < 2.7
25-
gem 'puma', '< 6.0.0'
26-
else
27-
gem 'puma'
28-
end
24+
gem 'puma'
2925

3026
case version = ENV['RAILS_VERSION'] || (File.exist?(version_file) && File.read(version_file).chomp) || ''
3127
when /main/

example_app_generator/generate_app.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969

7070
copy_file capybara_backport_path, 'spec/support/capybara.rb'
7171

72-
if Rails::VERSION::STRING > '7' && Rails::VERSION::STRING < '7.2'
72+
if Rails::VERSION::STRING < '7.2'
7373
create_file 'app/assets/config/manifest.js' do
7474
"//= link application.css"
7575
end

example_app_generator/spec/support/default_preview_path

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ require_file_stub 'config/environment' do
3737
module ExampleApp
3838
class Application < Rails::Application
3939
config.eager_load = false
40-
if Rails::VERSION::STRING.to_f >= 7.0
41-
config.active_support.cache_format_version = 7.0
42-
end
40+
config.active_support.cache_format_version = 7.0
4341

4442
# Don't care if the mailer can't send.
4543
config.action_mailer.raise_delivery_errors = false unless ENV['NO_ACTION_MAILER']

example_app_generator/spec/verify_mailer_preview_path_spec.rb

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def capture_exec(*ops)
4040

4141
if ENV['RAILS_VERSION'] == 'main' && Rails::VERSION::STRING == "8.0.0.alpha"
4242
before do
43-
skip('This is broken on Rails main but is skipped for green builds of 7.1.x, please fix')
43+
skip('This is broken on Rails main but is skipped for green builds, please fix')
4444
end
4545
end
4646

@@ -139,17 +139,6 @@ def have_no_preview(_opts = {})
139139
)
140140
).to eq('test-host')
141141
end
142-
143-
it 'handles action mailer not being available' do
144-
skip "Rails 7 forces eager loading on CI, loads app/mailers and fails" if Rails::VERSION::STRING.to_f >= 7.0
145-
146-
expect(
147-
capture_exec(
148-
custom_env.merge('NO_ACTION_MAILER' => 'true'),
149-
exec_script
150-
)
151-
).to have_no_preview
152-
end
153142
end
154143
else
155144
context 'in the development environment' do

features/file_fixture.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ Feature: Using `file_fixture`
3737
When I run `rspec spec/lib/file_spec.rb`
3838
Then the examples should all pass
3939

40-
@rails_post_7
4140
Scenario: Creating a ActiveStorage::Blob from a file fixture
4241
Given a file named "spec/fixtures/files/sample.txt" with:
4342
"""

features/generator_specs/integration_specs.feature

Lines changed: 0 additions & 21 deletions
This file was deleted.

features/support/rails_versions.rb

Lines changed: 0 additions & 15 deletions
This file was deleted.

lib/generators/rspec/integration/integration_generator.rb

Lines changed: 0 additions & 29 deletions
This file was deleted.

lib/generators/rspec/scaffold/templates/controller_spec.rb

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,10 @@
9090
end
9191
9292
context "with invalid params" do
93-
<% if Rails.version.to_f < 7.0 %>
94-
it "returns a success response (i.e. to display the 'new' template)" do
95-
post :create, params: {<%= singular_table_name %>: invalid_attributes}, session: valid_session
96-
expect(response).to be_successful
97-
end
98-
<% else %>
9993
it "renders a response with 422 status (i.e. to display the 'new' template)" do
10094
post :create, params: {<%= singular_table_name %>: invalid_attributes}, session: valid_session
10195
expect(response).to have_http_status(:unprocessable_entity)
10296
end
103-
<% end %>
10497
end
10598
end
10699
@@ -125,19 +118,11 @@
125118
end
126119
127120
context "with invalid params" do
128-
<% if Rails.version.to_f < 7.0 %>
129-
it "returns a success response (i.e. to display the 'edit' template)" do
130-
<%= file_name %> = <%= class_name %>.create! valid_attributes
131-
put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: invalid_attributes}, session: valid_session
132-
expect(response).to be_successful
133-
end
134-
<% else %>
135121
it "renders a response with 422 status (i.e. to display the 'edit' template)" do
136122
<%= file_name %> = <%= class_name %>.create! valid_attributes
137123
put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: invalid_attributes}, session: valid_session
138124
expect(response).to have_http_status(:unprocessable_entity)
139125
end
140-
<% end %>
141126
end
142127
end
143128

0 commit comments

Comments
 (0)