diff --git a/.travis.yml b/.travis.yml index 4b9421f7ac..403777e333 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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.1.0.rc2" - rvm: jruby-9.1.7.0 env: "RAILS_VERSION=5.0.2 JRUBY_OPTS=\"-J-Xms512m -J-Xmx1024m\"" allow_failures: diff --git a/app/helpers/blacklight/render_partials_helper_behavior.rb b/app/helpers/blacklight/render_partials_helper_behavior.rb index be829c9c46..51d828e542 100644 --- a/app/helpers/blacklight/render_partials_helper_behavior.rb +++ b/app/helpers/blacklight/render_partials_helper_behavior.rb @@ -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 ## diff --git a/app/models/search.rb b/app/models/search.rb index 6c4469c5c7..9260cffa75 100644 --- a/app/models/search.rb +++ b/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 diff --git a/blacklight.gemspec b/blacklight.gemspec index 35b8b2f1a3..9f87211764 100644 --- a/blacklight.gemspec +++ b/blacklight.gemspec @@ -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 diff --git a/spec/helpers/blacklight/url_helper_behavior_spec.rb b/spec/helpers/blacklight/url_helper_behavior_spec.rb index 239c43af3b..4f4120103a 100644 --- a/spec/helpers/blacklight/url_helper_behavior_spec.rb +++ b/spec/helpers/blacklight/url_helper_behavior_spec.rb @@ -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 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ba2762be0f..1f238fa590 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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 diff --git a/spec/support/backport_test.rb b/spec/support/backport_test.rb deleted file mode 100644 index 842615ed36..0000000000 --- a/spec/support/backport_test.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Backport the Rails 5 controller test methods to Rails 4 -module BackportTest - [:delete, :get, :post, :put, :patch].each do |http_action| - define_method(http_action) do |*args| - (action, rest) = *args - rest ||= {} - if rest[:xhr] - @request.env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest' - @request.env['HTTP_ACCEPT'] ||= [Mime::JS, Mime::HTML, Mime::XML, 'text/xml', Mime::ALL].join(', ') - end - super(action, rest[:params]) - end - end -end diff --git a/spec/test_app_templates/Gemfile.extra b/spec/test_app_templates/Gemfile.extra index 135cae4f1b..cd3004db52 100644 --- a/spec/test_app_templates/Gemfile.extra +++ b/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'