Skip to content

Commit

Permalink
Remove support for EOLd rails version 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski committed Oct 3, 2019
1 parent 595d72b commit ecf3c53
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 65 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Expand Up @@ -2,7 +2,6 @@ branches:
only:
- "master"
gemfile:
- gemfiles/rails_4.2.gemfile
- gemfiles/rails_5.0.gemfile
- gemfiles/rails_5.1.gemfile
- gemfiles/rails_5.2.gemfile
Expand All @@ -22,7 +21,5 @@ sudo: false
cache: bundler
matrix:
allow_failures:
- gemfile: gemfiles/rails_4.2.gemfile
rvm: 2.6.4
- gemfile: gemfiles/rails_6.0.gemfile
rvm: 2.4.7
1 change: 0 additions & 1 deletion Appraisals
@@ -1,5 +1,4 @@
rails_versions = %w(
4.2
5.0
5.1
5.2
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,11 @@
# Changelog

## [Unreleased]

### Removed

- Remove support for EOL'd Rails version 4.2

## [3.1.2] - 2019-05-20

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Expand Up @@ -105,7 +105,7 @@ PLATFORMS
ruby

DEPENDENCIES
activesupport (>= 3.1.0)
activesupport (>= 5.0)
appraisal
capybara
high_voltage!
Expand Down
8 changes: 0 additions & 8 deletions gemfiles/rails_4.2.gemfile

This file was deleted.

2 changes: 1 addition & 1 deletion high_voltage.gemspec
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.test_files = []
s.require_paths = ["lib"]

s.add_development_dependency('activesupport', '>= 3.1.0')
s.add_development_dependency('activesupport', '>= 5.0')
s.add_development_dependency('appraisal')
s.add_development_dependency('capybara')
s.add_development_dependency('pry')
Expand Down
7 changes: 0 additions & 7 deletions lib/high_voltage/engine.rb
Expand Up @@ -11,12 +11,5 @@ class Engine < Rails::Engine
app.paths.add(concerns_path)
end
end

initializer "Require for Rails 3" do |app|
if defined?(Rails) && Rails::VERSION::MAJOR == 3
require "concerns/high_voltage/static_page"
require "high_voltage/pages_controller"
end
end
end
end
2 changes: 1 addition & 1 deletion spec/controllers/alternative_finder_controller_spec.rb
Expand Up @@ -4,7 +4,7 @@
render_views

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

expect(response).to be_successful
expect(response).to render_template('rot13')
Expand Down
32 changes: 19 additions & 13 deletions spec/controllers/pages_controller_spec.rb
Expand Up @@ -7,7 +7,7 @@

context "using default configuration" do
describe "on GET to /pages/exists" do
before { get :show, id: "exists" }
before { get :show, params: { id: "exists" } }

it "responds with success and render template" do
expect(response).to be_successful
Expand All @@ -20,7 +20,7 @@
end

describe "on GET to /pages/dir/nested" do
before { get :show, id: "dir/nested" }
before { get :show, params: { id: "dir/nested" } }

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

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

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

it "raises a missing template error for valid page with invalid partial" do
expect { get :show, id: "exists_but_references_nonexistent_partial" }.
expect { nonexistent_partial_request }.
to raise_error(ActionView::MissingTemplate)
end

def nonexistent_partial_request
get :show, params: {
id: "exists_but_references_nonexistent_partial",
}
end
end

context "using custom layout" do
Expand All @@ -50,7 +56,7 @@
end

describe "on GET to /pages/exists" do
before { get :show, id: "exists" }
before { get :show, params: { id: "exists" } }

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

describe "on GET to /other_pages/also_exists" do
before { get :show, id: "also_exists" }
before { get :show, params: { id: "also_exists" } }

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

describe "on GET to /other_pages/also_dir/nested" do
before { get :show, id: "also_dir/also_nested" }
before { get :show, params: { id: "also_dir/also_nested" } }

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

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

expect { get :show, id: "√®ø" }.
expect { get :show, params: { id: "√®ø" } }.
to raise_error(ActionController::RoutingError)
end

context "page in another directory" do
it "raises a routing error" do
expect { get :show, id: "../other_wrong" }.
expect { get :show, params: { id: "../other_wrong" } }.
to raise_error(ActionController::RoutingError)
end

it "raises a routing error when using a Unicode exploit" do
expect { get :show, id: "/\\../other/wrong" }.
expect { get :show, params: { id: "/\\../other/wrong" } }.
to raise_error(ActionController::RoutingError)
end
end

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

expect { get :show, id: id }.
expect { get :show, params: { id: id } }.
to raise_error(ActionView::MissingTemplate)
end
end
Expand Down
14 changes: 10 additions & 4 deletions spec/controllers/subclassed_pages_controller_spec.rb
Expand Up @@ -4,7 +4,7 @@
render_views

describe "on GET to /subclassed_pages/also_exists" do
before { get :show, id: "also_exists" }
before { get :show, params: { id: "also_exists" } }

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

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

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

it 'raises a missing template error for valid page with invalid partial' do
expect { get :show, id: "also_exists_but_references_nonexistent_partial" }.
expect { nonexistent_partial_request }.
to raise_error(ActionView::MissingTemplate)
end

def nonexistent_partial_request
get :show, params: {
id: "also_exists_but_references_nonexistent_partial",
}
end
end
12 changes: 5 additions & 7 deletions spec/spec_helper.rb
Expand Up @@ -28,12 +28,10 @@
config.mock_with :rspec
config.order = "random"

if Rails::VERSION::MAJOR >= 5
require "rails-controller-testing"
require "rails-controller-testing"

config.include(
Rails::Controller::Testing::TemplateAssertions,
type: :controller,
)
end
config.include(
Rails::Controller::Testing::TemplateAssertions,
type: :controller,
)
end
19 changes: 0 additions & 19 deletions spec/support/http_method_shim.rb

This file was deleted.

0 comments on commit ecf3c53

Please sign in to comment.