From c8256cfbd95563a37fa4c1d4ea021f0adc1cfb71 Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Thu, 13 Dec 2018 10:18:05 -0800 Subject: [PATCH] Support Rails 5 --- .travis.yml | 4 +- .../concerns/blacklight/bookmarks.rb | 6 ++- .../concerns/blacklight/controller.rb | 25 +++++++----- .../concerns/blacklight/search_context.rb | 20 ++++++---- app/controllers/saved_searches_controller.rb | 21 ++++++---- app/helpers/blacklight/url_helper_behavior.rb | 37 +++++++++--------- .../concerns/blacklight/document/export.rb | 38 +++++++++---------- blacklight.gemspec | 2 +- db/migrate/20140202020201_create_searches.rb | 8 +++- db/migrate/20140202020202_create_bookmarks.rb | 11 +++++- ...00000_add_polymorphic_type_to_bookmarks.rb | 11 +++++- lib/blacklight.rb | 14 +++---- lib/blacklight/solr/request.rb | 2 +- lib/blacklight/solr/response.rb | 4 +- lib/blacklight/utils.rb | 10 ++++- .../blacklight/test_support_generator.rb | 10 ++--- .../models/blacklight/solr/repository_spec.rb | 10 ++--- spec/spec_helper.rb | 9 ++--- 18 files changed, 141 insertions(+), 101 deletions(-) diff --git a/.travis.yml b/.travis.yml index 97c933c02e..426cb72a77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,12 @@ notifications: email: false rvm: - - 2.3.1 + - 2.3.8 matrix: include: + - rvm: 2.5.3 + env: "RAILS_VERSION=5.2.2" - rvm: 2.2.5 env: "RAILS_VERSION=4.1.13" - rvm: 2.1.5 diff --git a/app/controllers/concerns/blacklight/bookmarks.rb b/app/controllers/concerns/blacklight/bookmarks.rb index 34797ea87b..5d3b039faf 100644 --- a/app/controllers/concerns/blacklight/bookmarks.rb +++ b/app/controllers/concerns/blacklight/bookmarks.rb @@ -13,7 +13,11 @@ module Blacklight::Bookmarks copy_blacklight_config_from(CatalogController) - before_filter :verify_user + if Rails.version < '5' + before_filter :verify_user + else + before_action :verify_user + end blacklight_config.add_results_collection_tool(:clear_bookmarks_widget) diff --git a/app/controllers/concerns/blacklight/controller.rb b/app/controllers/concerns/blacklight/controller.rb index cd4beddd07..7c203c88a2 100644 --- a/app/controllers/concerns/blacklight/controller.rb +++ b/app/controllers/concerns/blacklight/controller.rb @@ -2,13 +2,13 @@ # # Filters added to this controller apply to all controllers in the hosting application # as this module is mixed-in to the application controller in the hosting app on installation. -module Blacklight::Controller +module Blacklight::Controller extend ActiveSupport::Concern extend Deprecation self.deprecation_horizon = 'blacklight 6.0' - + included do include Blacklight::SearchFields helper Blacklight::SearchFields @@ -16,15 +16,20 @@ module Blacklight::Controller include ActiveSupport::Callbacks # now in application.rb file under config.filter_parameters - # filter_parameter_logging :password, :password_confirmation + # filter_parameter_logging :password, :password_confirmation helper_method :current_user_session, :current_user, :current_or_guest_user - after_filter :discard_flash_if_xhr + + if Rails.version < '5' + after_filter :discard_flash_if_xhr + else + after_action :discard_flash_if_xhr + end # handle basic authorization exception with #access_denied rescue_from Blacklight::Exceptions::AccessDenied, :with => :access_denied - + helper_method :request_is_for_user_resource? - + # extra head content helper_method :has_user_authentication_provider? helper_method :blacklight_config @@ -73,7 +78,7 @@ def search_facet_url options = {} def searches_from_history session[:history].blank? ? Search.none : Search.where(:id => session[:history]).order("updated_at desc") end - + # # Controller and view helper for determining if the current url is a request for a user resource # @@ -112,7 +117,7 @@ def discard_flash_if_xhr # def has_user_authentication_provider? respond_to? :current_user - end + end def require_user_authentication_provider raise ActionController::RoutingError.new('Not Found') unless has_user_authentication_provider? @@ -140,7 +145,7 @@ def transfer_guest_user_actions_to_current_user end ## - # To handle failed authorization attempts, redirect the user to the + # To handle failed authorization attempts, redirect the user to the # login form and persist the current request uri as a parameter def access_denied # send the user home if the access was previously denied by the same @@ -152,5 +157,5 @@ def access_denied redirect_to new_user_session_url(:referer => request.fullpath) end - + end diff --git a/app/controllers/concerns/blacklight/search_context.rb b/app/controllers/concerns/blacklight/search_context.rb index 4f8efa789c..4b24591a20 100644 --- a/app/controllers/concerns/blacklight/search_context.rb +++ b/app/controllers/concerns/blacklight/search_context.rb @@ -3,7 +3,7 @@ module Blacklight::SearchContext # The following code is executed when someone includes blacklight::catalog::search_session in their # own controller. - included do + included do helper_method :current_search_session, :search_session end @@ -11,18 +11,22 @@ module Blacklight::SearchContext module ClassMethods # Save the submitted search parameters in the search session def record_search_parameters opts = { only: :index} - before_filter :current_search_session, opts + if Rails.version < '5' + before_filter :current_search_session, opts + else + before_action :current_search_session, opts + end end end - + protected # sets up the session[:search] hash if it doesn't already exist def search_session session[:search] ||= {} end - - # The current search session + + # The current search session def current_search_session @current_search_session ||= if start_new_search_session? @@ -31,7 +35,7 @@ def current_search_session find_or_initialize_search_session_from_params JSON.load(params[:search_context]) elsif params[:search_id].present? begin - # TODO : check the search id signature. + # TODO : check the search id signature. searches_from_history.find(params[:search_id]) rescue ActiveRecord::RecordNotFound nil @@ -79,11 +83,11 @@ def add_to_search_history search if session[:history].length > blacklight_config.search_history_window session[:history] = session[:history].slice(0, blacklight_config.search_history_window ) - + end end - # A list of query parameters that should not be persisted for a search + # A list of query parameters that should not be persisted for a search def blacklisted_search_session_params [:commit, :counter, :total, :search_id, :page, :per_page] end diff --git a/app/controllers/saved_searches_controller.rb b/app/controllers/saved_searches_controller.rb index bfc452ff72..933dcbc6bf 100644 --- a/app/controllers/saved_searches_controller.rb +++ b/app/controllers/saved_searches_controller.rb @@ -3,14 +3,19 @@ class SavedSearchesController < ApplicationController include Blacklight::Configurable copy_blacklight_config_from(CatalogController) - before_filter :require_user_authentication_provider - before_filter :verify_user - + if Rails.version < '5' + before_filter :require_user_authentication_provider + before_filter :verify_user + else + before_action :require_user_authentication_provider + before_action :verify_user + end + def index @searches = current_user.searches end - - def save + + def save current_user.searches << searches_from_history.find(params[:id]) if current_user.save flash[:notice] = I18n.t('blacklight.saved_searches.add.success') @@ -33,14 +38,14 @@ def forget end redirect_to :back end - + # Only dereferences the user rather than removing the items in case they # are in the session[:history] - def clear + def clear if current_user.searches.update_all("user_id = NULL") flash[:notice] = I18n.t('blacklight.saved_searches.clear.success') else - flash[:error] = I18n.t('blacklight.saved_searches.clear.failure') + flash[:error] = I18n.t('blacklight.saved_searches.clear.failure') end redirect_to :action => "index" end diff --git a/app/helpers/blacklight/url_helper_behavior.rb b/app/helpers/blacklight/url_helper_behavior.rb index 8582c20f26..2480c3fc51 100644 --- a/app/helpers/blacklight/url_helper_behavior.rb +++ b/app/helpers/blacklight/url_helper_behavior.rb @@ -67,7 +67,7 @@ def link_to_next_document(next_document) ## # Current search context parameters - def search_session_params counter + def search_session_params counter { :'data-counter' => counter, :'data-search_id' => current_search_session.try(:id) } end deprecation_deprecate search_session_params: :session_tracking_params @@ -83,11 +83,11 @@ def session_tracking_params document, counter if document.nil? return {} end - + { :data => {:'context-href' => session_tracking_path(document, per_page: params.fetch(:per_page, search_session['per_page']), counter: counter, search_id: current_search_session.try(:id))}} end protected :session_tracking_params - + ## # Get the URL for tracking search sessions across pages using polymorphic routing def session_tracking_path document, params = {} @@ -124,7 +124,7 @@ def start_over_path query_params = params def link_back_to_catalog(opts={:label=>nil}) scope = opts.delete(:route_set) || self query_params = current_search_session.try(:query_params) || {} - + if search_session['counter'] per_page = (search_session['per_page'] || default_per_page).to_i counter = search_session['counter'].to_i @@ -156,11 +156,11 @@ def link_to_previous_search(params) # @overload params_for_search(source_params, params_to_merge) # Merge the source params with the params_to_merge hash - # @param [Hash] Hash + # @param [Hash] Hash # @param [Hash] Hash to merge into above # @overload params_for_search(params_to_merge) - # Merge the current search parameters with the - # parameters provided. + # Merge the current search parameters with the + # parameters provided. # @param [Hash] Hash to merge into the parameters # @overload params_for_search # Returns the current search parameters after being sanitized by #sanitize_search_params @@ -207,7 +207,10 @@ def sanitize_search_params source_params # Reset any search parameters that store search context # and need to be reset when e.g. constraints change def reset_search_params source_params - sanitize_search_params(source_params).except(:page, :counter).with_indifferent_access + maybe_hash = sanitize_search_params(source_params).except(:page, :counter) + # maybe_hash is a hash in Rails 4 but a ActionController::Parameters in Rails 5 + new_params = maybe_hash.respond_to?(:with_indifferent_access) ? maybe_hash : maybe_hash.to_h + maybe_hash.with_indifferent_access end # adds the value and/or field to params[:f] @@ -233,7 +236,7 @@ def add_facet_params(field, item, source_params = params) if facet_config.single and not p[:f][url_field].empty? p[:f][url_field] = [] end - + p[:f][url_field].push(value) if item and item.respond_to?(:fq) and item.fq @@ -249,14 +252,14 @@ def add_facet_params(field, item, source_params = params) # on a facet value. Add on the facet params to existing # search constraints. Remove any paginator-specific request # params, or other request params that should be removed - # for a 'fresh' display. + # for a 'fresh' display. # Change the action to 'index' to send them back to - # catalog/index with their new facet choice. + # catalog/index with their new facet choice. def add_facet_params_and_redirect(field, item) new_params = add_facet_params(field, item) # Delete any request params from facet-specific action, needed - # to redir to index action properly. + # to redir to index action properly. request_keys = blacklight_config.facet_paginator_class.request_keys new_params.except! *request_keys.values @@ -289,15 +292,15 @@ def remove_facet_params(field, item, source_params=params) p.delete(:f) if p[:f].empty? p end - - # A URL to refworks export, with an embedded callback URL to this app. - # the callback URL is to bookmarks#export, which delivers a list of + + # A URL to refworks export, with an embedded callback URL to this app. + # the callback URL is to bookmarks#export, which delivers a list of # user's bookmarks in 'refworks marc txt' format -- we tell refworks - # to expect that format. + # to expect that format. def bookmarks_export_url(format, params = {}) bookmarks_url(params.merge(format: format, encrypted_user_id: encrypt_user_id(current_or_guest_user.id) )) end - + # This method should move to BlacklightMarc in Blacklight 6.x def refworks_export_url params = {} if params.is_a? ::SolrDocument or (params.nil? and instance_variable_defined? :@document) diff --git a/app/models/concerns/blacklight/document/export.rb b/app/models/concerns/blacklight/document/export.rb index 36199d5eb3..26d83c5014 100644 --- a/app/models/concerns/blacklight/document/export.rb +++ b/app/models/concerns/blacklight/document/export.rb @@ -1,7 +1,7 @@ # == Transformation conventions # The main use case for extensions is for transforming a Document to another # format. Either to another type of Ruby object, or to an exportable string in -# a certain format. +# a certain format. # # The convention for methods contained in extensions that transform to a ruby # object is "to_*". For instance, "to_marc" would return a Ruby Marc object. @@ -19,7 +19,7 @@ # If an extension advertises what export formats it can provide, than those # formats will automatically be delivered by the Blacklight catalog/show # controller, and potentially automatically advertised in various places -# that advertise available formats. (HTML link rel=alternate; Atom +# that advertise available formats. (HTML link rel=alternate; Atom # link rel=alterate; etc). # # Export formats are 'registered' by calling the #will_export_as method @@ -39,39 +39,35 @@ # module Blacklight::Document::Export - ## + ## # Register exportable formats supported by the individual document. # Usually called by an extension in it's self.extended method, to - # register the formats that extension can export. - # + # register the formats that extension can export. + # # some_document.will_export_as(:some_format, "application/type") means # that the document (usually via an extension) has a method # "export_as_some_format" which returns a String of content that - # is described by the mime content_type given. - # + # is described by the mime content_type given. + # # The format name should ideally _already_ be registered with # Rails Mime::Type, in your application initializer, representing # the content type given. However, this method will attempt to # register it using Mime::Type.register_alias if it's not previously - # registered. This is a bit sketchy though. + # registered. This is a bit sketchy though. def will_export_as(short_name, content_type = nil) #Lookup in Rails Mime::Type, register if needed, otherwise take - # content-type from registration if needed. This uses - # some 'api' to Mime::Type that may or may not be entirely - # public, the fact that a Mime::CONST is registered for every - # type. But that's the only way to do the kind of check we need, sorry. - if defined?(Mime) && Mime.const_defined?(short_name.to_s.upcase) - mime_type = "Mime::#{short_name.to_s.upcase}".constantize - content_type ||= mime_type.to_s + # content-type from registration if needed. + if defined?(Mime) && Mime[short_name.to_sym] + content_type ||= Mime[short_name.to_sym] else # not registered, we need to register. Use register_alias to be least - # likely to interfere with host app. + # likely to interfere with host app. Mime::Type.register_alias(content_type, short_name) end export_formats[short_name] = { content_type: content_type } end - + # Collects formats that this doc can export as. # Returns a hash, keys are format short-names that can # be exported. Hash includes: @@ -79,20 +75,20 @@ def will_export_as(short_name, content_type = nil) # maybe more later # To see if a given export format is supported by this document, # simply call document.export_formats.keys.include?(:my_format) - # Then call #export_as! to do the export. + # Then call #export_as! to do the export. def export_formats @export_formats ||= {} end - + # Call with a format shortname, export_as(:marc), simply returns # #export_as_marc . Later we may expand the design to allow you # to register an arbitrary method name instead of insisting # on the convention, so clients should call this method so - # they'll still keep working if we do that. + # they'll still keep working if we do that. def export_as(short_name) send("export_as_#{short_name}") end - + def exports_as? short_name respond_to? "export_as_#{short_name}" end diff --git a/blacklight.gemspec b/blacklight.gemspec index f961ce735f..90f7374db9 100644 --- a/blacklight.gemspec +++ b/blacklight.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |s| s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] - s.add_dependency "rails", ">= 3.2.6", "< 5" + s.add_dependency "rails", ">= 3.2.6", "< 6" 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 s.add_dependency "rsolr", "~> 1.0", ">= 1.0.11" # Library for interacting with rSolr. diff --git a/db/migrate/20140202020201_create_searches.rb b/db/migrate/20140202020201_create_searches.rb index 53237036c5..afe6a15812 100644 --- a/db/migrate/20140202020201_create_searches.rb +++ b/db/migrate/20140202020201_create_searches.rb @@ -1,5 +1,11 @@ # -*- encoding : utf-8 -*- -class CreateSearches < ActiveRecord::Migration +from = if Rails.version > '5' + ActiveRecord::Migration[5.0] + else + ActiveRecord::Migration + end + +class CreateSearches < from def self.up create_table :searches do |t| t.text :query_params diff --git a/db/migrate/20140202020202_create_bookmarks.rb b/db/migrate/20140202020202_create_bookmarks.rb index 3cef8fad85..1581ae6c70 100644 --- a/db/migrate/20140202020202_create_bookmarks.rb +++ b/db/migrate/20140202020202_create_bookmarks.rb @@ -1,5 +1,12 @@ # -*- encoding : utf-8 -*- -class CreateBookmarks < ActiveRecord::Migration + +from = if Rails.version > '5' + ActiveRecord::Migration[5.0] + else + ActiveRecord::Migration + end + +class CreateBookmarks < from def self.up create_table :bookmarks do |t| t.integer :user_id, :null=>false @@ -13,5 +20,5 @@ def self.up def self.down drop_table :bookmarks end - + end diff --git a/db/migrate/20140320000000_add_polymorphic_type_to_bookmarks.rb b/db/migrate/20140320000000_add_polymorphic_type_to_bookmarks.rb index 00b482bd89..9688df392a 100644 --- a/db/migrate/20140320000000_add_polymorphic_type_to_bookmarks.rb +++ b/db/migrate/20140320000000_add_polymorphic_type_to_bookmarks.rb @@ -1,8 +1,15 @@ # -*- encoding : utf-8 -*- -class AddPolymorphicTypeToBookmarks < ActiveRecord::Migration + +from = if Rails.version > '5' + ActiveRecord::Migration[5.0] + else + ActiveRecord::Migration + end + +class AddPolymorphicTypeToBookmarks < from def change add_column(:bookmarks, :document_type, :string) - + add_index :bookmarks, :user_id end end diff --git a/lib/blacklight.rb b/lib/blacklight.rb index 9b3dff8618..4db05fd48d 100644 --- a/lib/blacklight.rb +++ b/lib/blacklight.rb @@ -28,7 +28,7 @@ class SolrRepository < Solr::Repository def initialize blacklight_config Deprecation.warn(self, 'Blacklight::SolrRepository is deprecated; use Blacklight::Solr::Repository instead') super - end + end end class SolrResponse < Solr::Response @@ -36,7 +36,7 @@ class SolrResponse < Solr::Response def initialize(data, request_params, options = {}) Deprecation.warn(self, 'Blacklight::SolrResponse is deprecated; use Blacklight::Solr::Response instead') super - end + end end # Secret key used to share session information with @@ -144,7 +144,7 @@ def self.solr_yml return @solr_yml if @solr_yml unless File.exists?(solr_file) - raise "You are missing a solr configuration file: #{solr_file}. Have you run \"rails generate blacklight:install\"?" + raise "You are missing a solr configuration file: #{solr_file}. Have you run \"rails generate blacklight:install\"?" end begin @@ -176,17 +176,17 @@ def self.logger= logger @logger = logger end - ############# + ############# # Methods for figuring out path to BL plugin, and then locate various files # either in the app itself or defaults in the plugin -- whether you are running # from the plugin itself or from an actual app using te plugin. # In a seperate module so it can be used by both Blacklight class, and - # by rake tasks without loading the whole Rails environment. + # by rake tasks without loading the whole Rails environment. ############# - + # returns the full path the the blacklight plugin installation def self.root @root ||= File.expand_path(File.dirname(File.dirname(__FILE__))) end - + end diff --git a/lib/blacklight/solr/request.rb b/lib/blacklight/solr/request.rb index af6fd5672c..90b0fb18af 100644 --- a/lib/blacklight/solr/request.rb +++ b/lib/blacklight/solr/request.rb @@ -1,6 +1,6 @@ class Blacklight::Solr::InvalidParameter < ArgumentError; end -class Blacklight::Solr::Request < HashWithIndifferentAccess +class Blacklight::Solr::Request < ActiveSupport::HashWithIndifferentAccess SINGULAR_KEYS = %w{facet fl q qt rows start spellcheck spellcheck.q sort per_page wt hl group defType} ARRAY_KEYS = %w{facet.field facet.query facet.pivot fq hl.fl} diff --git a/lib/blacklight/solr/response.rb b/lib/blacklight/solr/response.rb index f9c7965417..501cf8aa5a 100644 --- a/lib/blacklight/solr/response.rb +++ b/lib/blacklight/solr/response.rb @@ -1,4 +1,4 @@ -class Blacklight::Solr::Response < HashWithIndifferentAccess +class Blacklight::Solr::Response < ActiveSupport::HashWithIndifferentAccess extend Deprecation require 'blacklight/solr/response/pagination_methods' @@ -89,7 +89,7 @@ def force_to_utf8(value) when Array value.each { |v| force_to_utf8(v) } when String - value.force_encoding("utf-8") if value.respond_to?(:force_encoding) + value.force_encoding("utf-8") if value.respond_to?(:force_encoding) end value end diff --git a/lib/blacklight/utils.rb b/lib/blacklight/utils.rb index a3014dd569..80255e503c 100644 --- a/lib/blacklight/utils.rb +++ b/lib/blacklight/utils.rb @@ -1,4 +1,10 @@ require 'ostruct' + +# Backport for Rails 4: +if Rails.version < '5' + ActiveSupport::HashWithIndifferentAccess = HashWithIndifferentAccess +end + module Blacklight module Utils @@ -48,7 +54,7 @@ def respond_to? method, *args def to_h @table end - + def select *args, &block self.class.new to_h.select(*args, &block) end @@ -85,7 +91,7 @@ def deep_dup ## - # An OpenStruct refinement that converts any hash-keys into + # An OpenStruct refinement that converts any hash-keys into # additional instances of NestedOpenStructWithHashAccess class NestedOpenStructWithHashAccess < OpenStructWithHashAccess attr_reader :nested_class diff --git a/lib/generators/blacklight/test_support_generator.rb b/lib/generators/blacklight/test_support_generator.rb index 45192434a6..dc69316cb9 100644 --- a/lib/generators/blacklight/test_support_generator.rb +++ b/lib/generators/blacklight/test_support_generator.rb @@ -3,14 +3,14 @@ # Need the requires here so we can call the generator from environment.rb -# as suggested above. +# as suggested above. require 'rails/generators' require 'rails/generators/base' module Blacklight class TestSupport < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) - desc """ -Generate blacklight testing configurations for blacklight's own tests, or for blacklight plugins to use for testing + desc """ +Generate blacklight testing configurations for blacklight's own tests, or for blacklight plugins to use for testing """ def alternate_controller copy_file "alternate_controller.rb", "app/controllers/alternate_controller.rb" @@ -19,9 +19,7 @@ def alternate_controller member do get :facet end - end") - - + end\n") # the trailing CR is important (in Rails 5) so that any other additional routes get added on the next line. end def configure_action_mailer diff --git a/spec/models/blacklight/solr/repository_spec.rb b/spec/models/blacklight/solr/repository_spec.rb index dd91cf8c09..6c87d506fa 100644 --- a/spec/models/blacklight/solr/repository_spec.rb +++ b/spec/models/blacklight/solr/repository_spec.rb @@ -42,7 +42,7 @@ allow(subject.connection).to receive(:send_and_receive).with('select', hash_including(params: { id: '123', qt: 'abc'})).and_return(mock_response) expect(subject.find("123", {qt: 'abc'})).to be_a_kind_of Blacklight::Solr::Response end - + it "should use the :qt parameter from the default_document_solr_params" do blacklight_config.default_document_solr_params[:qt] = 'abc' blacklight_config.document_solr_request_handler = 'xyz' @@ -51,11 +51,11 @@ end it "should preserve the class of the incoming params" do - doc_params = HashWithIndifferentAccess.new + doc_params = ActiveSupport::HashWithIndifferentAccess.new allow(subject.connection).to receive(:send_and_receive).with('select', anything).and_return(mock_response) response = subject.find("123", doc_params) expect(response).to be_a_kind_of Blacklight::Solr::Response - expect(response.params).to be_a_kind_of HashWithIndifferentAccess + expect(response.params).to be_a_kind_of ActiveSupport::HashWithIndifferentAccess end end @@ -82,12 +82,12 @@ allow(subject.connection).to receive(:send_and_receive).with('select', hash_including(params: { qt: 'abc'})).and_return(mock_response) expect(subject.search({qt: 'abc'})).to be_a_kind_of Blacklight::Solr::Response end - + it "should preserve the class of the incoming params" do search_params = HashWithIndifferentAccess.new search_params[:q] = "query" allow(subject.connection).to receive(:send_and_receive).with('select', anything).and_return(mock_response) - + response = subject.search(search_params) expect(response).to be_a_kind_of Blacklight::Solr::Response expect(response.params).to be_a_kind_of HashWithIndifferentAccess diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6bf20373f7..4731bc5e80 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,7 @@ # -*- encoding : utf-8 -*- # This file is copied to spec/ when you run 'rails generate rspec:install' # Has been customized by Blacklight to work when application is in one place, -# and actual spec/ stuff is in another (the blacklight gem checkout). +# and actual spec/ stuff is in another (the blacklight gem checkout). ENV["RAILS_ENV"] ||= 'test' @@ -16,9 +16,6 @@ end require 'rsolr' -require 'blacklight' -require 'blacklight/marc' - require 'engine_cart' EngineCart.load_application! @@ -41,8 +38,8 @@ # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. -# Blacklight, again, make sure we're looking in the right place for em. -# Relative to HERE, NOT to Rails.root, which is off somewhere else. +# Blacklight, again, make sure we're looking in the right place for em. +# Relative to HERE, NOT to Rails.root, which is off somewhere else. Dir[Pathname.new(File.expand_path("../support/**/*.rb", __FILE__))].each {|f| require f} RSpec.configure do |config|