Sha256: f038b3b45fc6cb222d1e9fe464df53cb10b7eca85880566745fa287c789a2003

Contents?: true

Size: 961 Bytes

Versions: 37

Compression:

Stored size: 961 Bytes

Contents

module ControllerLevelHelpers
  extend ActiveSupport::Concern
  # def search_state
  #   @search_state ||= Blacklight::SearchState.new(params, blacklight_config)
  # end

  # def blacklight_configuration_context
  #   @blacklight_configuration_context ||= Blacklight::Configuration::Context.new(controller)
  # end
  #
  included do
    # fix for anonymous controllers (https://github.com/rspec/rspec-rails/issues/1321#issuecomment-239157093)
    before { allow(controller).to receive(:_routes).and_return(Rails.application.routes) }
  end

  def initialize_controller_helpers(helper)
    helper.extend ControllerLevelHelpers
    initialize_routing_helpers(helper)
  end

  def initialize_routing_helpers(helper)
    return unless Rails::VERSION::MAJOR >= 5

    helper.class.include ::Rails.application.routes.url_helpers
    helper.class.include ::Rails.application.routes.mounted_helpers if ::Rails.application.routes.respond_to?(:mounted_helpers)
  end
end

Version data entries

37 entries across 37 versions & 3 rubygems

Version Path
curation_concerns-1.7.8 spec/support/helpers/controller_level_helpers.rb
geo_works-0.2.0 spec/support/helpers/controller_level_helpers.rb
geo_works-0.1.4 spec/support/helpers/controller_level_helpers.rb
geo_works-0.1.3 spec/support/helpers/controller_level_helpers.rb
geo_works-0.1.2 spec/support/helpers/controller_level_helpers.rb
geo_works-0.1.1 spec/support/helpers/controller_level_helpers.rb
geo_works-0.1.0 spec/support/helpers/controller_level_helpers.rb
curation_concerns-1.7.7 spec/support/helpers/controller_level_helpers.rb
curation_concerns-2.0.0 spec/support/helpers/controller_level_helpers.rb
curation_concerns-2.0.0.rc2 spec/support/helpers/controller_level_helpers.rb
curation_concerns-1.7.6 spec/support/helpers/controller_level_helpers.rb
curation_concerns-1.7.5 spec/support/helpers/controller_level_helpers.rb
curation_concerns-1.7.4 spec/support/helpers/controller_level_helpers.rb
curation_concerns-1.7.3 spec/support/helpers/controller_level_helpers.rb
curation_concerns-1.7.2 spec/support/helpers/controller_level_helpers.rb
geo_concerns-0.3.4 spec/support/helpers/controller_level_helpers.rb
curation_concerns-2.0.0.rc1 spec/support/helpers/controller_level_helpers.rb
curation_concerns-1.7.1 spec/support/helpers/controller_level_helpers.rb
geo_concerns-0.3.3 spec/support/helpers/controller_level_helpers.rb
geo_concerns-0.3.2 spec/support/helpers/controller_level_helpers.rb