Skip to content

Commit ecf3c53

Browse files
committed
Remove support for EOLd rails version 4.2
1 parent 595d72b commit ecf3c53

12 files changed

+43
-65
lines changed

.travis.yml

-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ branches:
22
only:
33
- "master"
44
gemfile:
5-
- gemfiles/rails_4.2.gemfile
65
- gemfiles/rails_5.0.gemfile
76
- gemfiles/rails_5.1.gemfile
87
- gemfiles/rails_5.2.gemfile
@@ -22,7 +21,5 @@ sudo: false
2221
cache: bundler
2322
matrix:
2423
allow_failures:
25-
- gemfile: gemfiles/rails_4.2.gemfile
26-
rvm: 2.6.4
2724
- gemfile: gemfiles/rails_6.0.gemfile
2825
rvm: 2.4.7

Appraisals

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
rails_versions = %w(
2-
4.2
32
5.0
43
5.1
54
5.2

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [Unreleased]
4+
5+
### Removed
6+
7+
- Remove support for EOL'd Rails version 4.2
8+
39
## [3.1.2] - 2019-05-20
410

511
### Fixed

Gemfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ PLATFORMS
105105
ruby
106106

107107
DEPENDENCIES
108-
activesupport (>= 3.1.0)
108+
activesupport (>= 5.0)
109109
appraisal
110110
capybara
111111
high_voltage!

gemfiles/rails_4.2.gemfile

-8
This file was deleted.

high_voltage.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
2121
s.test_files = []
2222
s.require_paths = ["lib"]
2323

24-
s.add_development_dependency('activesupport', '>= 3.1.0')
24+
s.add_development_dependency('activesupport', '>= 5.0')
2525
s.add_development_dependency('appraisal')
2626
s.add_development_dependency('capybara')
2727
s.add_development_dependency('pry')

lib/high_voltage/engine.rb

-7
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,5 @@ class Engine < Rails::Engine
1111
app.paths.add(concerns_path)
1212
end
1313
end
14-
15-
initializer "Require for Rails 3" do |app|
16-
if defined?(Rails) && Rails::VERSION::MAJOR == 3
17-
require "concerns/high_voltage/static_page"
18-
require "high_voltage/pages_controller"
19-
end
20-
end
2114
end
2215
end

spec/controllers/alternative_finder_controller_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
render_views
55

66
it 'renders the file from the alternative directory' do
7-
get :show, :id => 'ebg13'
7+
get :show, params: { id: 'ebg13' }
88

99
expect(response).to be_successful
1010
expect(response).to render_template('rot13')

spec/controllers/pages_controller_spec.rb

+19-13
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
context "using default configuration" do
99
describe "on GET to /pages/exists" do
10-
before { get :show, id: "exists" }
10+
before { get :show, params: { id: "exists" } }
1111

1212
it "responds with success and render template" do
1313
expect(response).to be_successful
@@ -20,7 +20,7 @@
2020
end
2121

2222
describe "on GET to /pages/dir/nested" do
23-
before { get :show, id: "dir/nested" }
23+
before { get :show, params: { id: "dir/nested" } }
2424

2525
it "responds with success and render template" do
2626
expect(response).to be_successful
@@ -29,19 +29,25 @@
2929
end
3030

3131
it "raises a routing error for an invalid page" do
32-
expect { get :show, id: "invalid" }.
32+
expect { get :show, params: { id: "invalid" } }.
3333
to raise_error(ActionController::RoutingError)
3434
end
3535

3636
it "raises a routing error for a page in another directory" do
37-
expect { get :show, id: "../other/wrong" }.
37+
expect { get :show, params: { id: "../other/wrong" } }.
3838
to raise_error(ActionController::RoutingError)
3939
end
4040

4141
it "raises a missing template error for valid page with invalid partial" do
42-
expect { get :show, id: "exists_but_references_nonexistent_partial" }.
42+
expect { nonexistent_partial_request }.
4343
to raise_error(ActionView::MissingTemplate)
4444
end
45+
46+
def nonexistent_partial_request
47+
get :show, params: {
48+
id: "exists_but_references_nonexistent_partial",
49+
}
50+
end
4551
end
4652

4753
context "using custom layout" do
@@ -50,7 +56,7 @@
5056
end
5157

5258
describe "on GET to /pages/exists" do
53-
before { get :show, id: "exists" }
59+
before { get :show, params: { id: "exists" } }
5460

5561
it "uses the custom configured layout" do
5662
expect(response).not_to render_template("layouts/application")
@@ -66,7 +72,7 @@
6672
end
6773

6874
describe "on GET to /other_pages/also_exists" do
69-
before { get :show, id: "also_exists" }
75+
before { get :show, params: { id: "also_exists" } }
7076

7177
it "responds with success and render template" do
7278
expect(response).to be_successful
@@ -75,7 +81,7 @@
7581
end
7682

7783
describe "on GET to /other_pages/also_dir/nested" do
78-
before { get :show, id: "also_dir/also_nested" }
84+
before { get :show, params: { id: "also_dir/also_nested" } }
7985

8086
it "responds with success and render template" do
8187
expect(response).to be_successful
@@ -84,29 +90,29 @@
8490
end
8591

8692
it "raises a routing error for an invalid page" do
87-
expect { get :show, id: "also_invalid" }.
93+
expect { get :show, params: { id: "also_invalid" } }.
8894
to raise_error(ActionController::RoutingError)
8995

90-
expect { get :show, id: "√®ø" }.
96+
expect { get :show, params: { id: "√®ø" } }.
9197
to raise_error(ActionController::RoutingError)
9298
end
9399

94100
context "page in another directory" do
95101
it "raises a routing error" do
96-
expect { get :show, id: "../other_wrong" }.
102+
expect { get :show, params: { id: "../other_wrong" } }.
97103
to raise_error(ActionController::RoutingError)
98104
end
99105

100106
it "raises a routing error when using a Unicode exploit" do
101-
expect { get :show, id: "/\\../other/wrong" }.
107+
expect { get :show, params: { id: "/\\../other/wrong" } }.
102108
to raise_error(ActionController::RoutingError)
103109
end
104110
end
105111

106112
it "raises a missing template error for valid page with invalid partial" do
107113
id = "also_exists_but_references_nonexistent_partial"
108114

109-
expect { get :show, id: id }.
115+
expect { get :show, params: { id: id } }.
110116
to raise_error(ActionView::MissingTemplate)
111117
end
112118
end

spec/controllers/subclassed_pages_controller_spec.rb

+10-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
render_views
55

66
describe "on GET to /subclassed_pages/also_exists" do
7-
before { get :show, id: "also_exists" }
7+
before { get :show, params: { id: "also_exists" } }
88

99
it "responds with success and render template" do
1010
expect(response).to be_successful
@@ -18,17 +18,23 @@
1818
end
1919

2020
it 'raises a routing error for an invalid page' do
21-
expect { get :show, id: "invalid" }.
21+
expect { get :show, params: { id: "invalid" } }.
2222
to raise_error(ActionController::RoutingError)
2323
end
2424

2525
it 'raises a routing error for a page in another directory' do
26-
expect { get :show, id: "../other/wrong" }.
26+
expect { get :show, params: { id: "../other/wrong" } }.
2727
to raise_error(ActionController::RoutingError)
2828
end
2929

3030
it 'raises a missing template error for valid page with invalid partial' do
31-
expect { get :show, id: "also_exists_but_references_nonexistent_partial" }.
31+
expect { nonexistent_partial_request }.
3232
to raise_error(ActionView::MissingTemplate)
3333
end
34+
35+
def nonexistent_partial_request
36+
get :show, params: {
37+
id: "also_exists_but_references_nonexistent_partial",
38+
}
39+
end
3440
end

spec/spec_helper.rb

+5-7
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@
2828
config.mock_with :rspec
2929
config.order = "random"
3030

31-
if Rails::VERSION::MAJOR >= 5
32-
require "rails-controller-testing"
31+
require "rails-controller-testing"
3332

34-
config.include(
35-
Rails::Controller::Testing::TemplateAssertions,
36-
type: :controller,
37-
)
38-
end
33+
config.include(
34+
Rails::Controller::Testing::TemplateAssertions,
35+
type: :controller,
36+
)
3937
end

spec/support/http_method_shim.rb

-19
This file was deleted.

0 commit comments

Comments
 (0)