Skip to content

Commit

Permalink
Drop Rails 4.2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Apr 28, 2017
1 parent 1abc816 commit e3c1c13
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 50 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -5,12 +5,12 @@ notifications:
email: false

rvm:
- 2.4.0
- 2.4.1

matrix:
include:
- rvm: 2.3.3
env: "RAILS_VERSION=4.2.8"
env: "RAILS_VERSION=5.0.2"
- rvm: jruby-9.1.7.0
env: "RAILS_VERSION=5.0.2 JRUBY_OPTS=\"-J-Xms512m -J-Xmx1024m\""
allow_failures:
Expand Down
5 changes: 1 addition & 4 deletions app/controllers/concerns/blacklight/bookmarks.rb
Expand Up @@ -115,11 +115,8 @@ def destroy
end
elsif request.xhr?
head 500 # ajaxy request needs no redirect and should not have flash set
elsif respond_to? :redirect_back
redirect_back fallback_location: bookmarks_path, flash: { error: I18n.t('blacklight.bookmarks.remove.failure') }
else
# Deprecated in Rails 5.0
redirect_to :back, flash: { error: I18n.t('blacklight.bookmarks.remove.failure') }
redirect_back fallback_location: bookmarks_path, flash: { error: I18n.t('blacklight.bookmarks.remove.failure') }
end
end

Expand Down
19 changes: 5 additions & 14 deletions app/helpers/blacklight/render_partials_helper_behavior.rb
Expand Up @@ -109,20 +109,11 @@ def document_index_path_templates
# @example
# type_field_to_partial_name(['a book-article'])
# => 'a_book_article'
if Rails.version >= '5.0.0'
def type_field_to_partial_name(_document, display_type)
# using "_" as sep. to more closely follow the views file naming conventions
# parameterize uses "-" as the default sep. which throws errors
underscore = '_'.freeze
Array(display_type).join(' '.freeze).tr('-'.freeze, underscore).parameterize(separator: underscore)
end
else
def type_field_to_partial_name(_document, display_type)
# using "_" as sep. to more closely follow the views file naming conventions
# parameterize uses "-" as the default sep. which throws errors
underscore = '_'.freeze
Array(display_type).join(' '.freeze).tr('-'.freeze, underscore).parameterize(underscore)
end
def type_field_to_partial_name(_document, display_type)
# using "_" as sep. to more closely follow the views file naming conventions
# parameterize uses "-" as the default sep. which throws errors
underscore = '_'.freeze
Array(display_type).join(' '.freeze).tr('-'.freeze, underscore).parameterize(separator: underscore)
end

##
Expand Down
4 changes: 1 addition & 3 deletions app/models/search.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true
class Search < ActiveRecord::Base
belongs_to_arguments = { optional: true } if Rails.version >= '5.0.0'

belongs_to :user, belongs_to_arguments
belongs_to :user, optional: true

serialize :query_params

Expand Down
2 changes: 1 addition & 1 deletion blacklight.gemspec
Expand Up @@ -25,7 +25,7 @@ Gem::Specification.new do |s|

s.required_ruby_version = '~> 2.1'

s.add_dependency "rails", ">= 4.2", "< 6"
s.add_dependency "rails", "~> 5.0"
s.add_dependency "globalid"
s.add_dependency "nokogiri", "~>1.6" # XML Parser
s.add_dependency "kaminari", ">= 0.15" # the pagination (page 1,2,3, etc..) of our search results
Expand Down
6 changes: 1 addition & 5 deletions spec/helpers/blacklight/url_helper_behavior_spec.rb
Expand Up @@ -110,11 +110,7 @@

context "without current search context" do
before do
if Rails.version >= '5.0.0'
controller.request.assign_parameters(Rails.application.routes, 'catalog', 'show', { id: '123' }, '/catalog/123', [:controller, :action, :id])
else
controller.request.assign_parameters(Rails.application.routes, 'catalog', 'show', id: '123')
end
controller.request.assign_parameters(Rails.application.routes, 'catalog', 'show', { id: '123' }, '/catalog/123', [:controller, :action, :id])
allow(helper).to receive_messages(current_search_session: nil)
end

Expand Down
4 changes: 0 additions & 4 deletions spec/spec_helper.rb
Expand Up @@ -65,10 +65,6 @@
config.include(ControllerLevelHelpers, type: :view)
config.before(:each, type: :view) { initialize_controller_helpers(view) }

unless Rails.version > '5'
config.include BackportTest, type: :controller
end

config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
Expand Down
14 changes: 0 additions & 14 deletions spec/support/backport_test.rb

This file was deleted.

4 changes: 1 addition & 3 deletions spec/test_app_templates/Gemfile.extra
@@ -1,3 +1 @@
if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION'] =~ /^5\.0/ || ENV['RAILS_VERSION'] == 'edge'
gem 'rails-controller-testing'
end
gem 'rails-controller-testing'

0 comments on commit e3c1c13

Please sign in to comment.