Sha256: 9b6a93ccd8562282c889cff51b48fc7762ebdf5c4a69e59a5eb59d8799cfa910

Contents?: true

Size: 855 Bytes

Versions: 5

Compression:

Stored size: 855 Bytes

Contents

# frozen_string_literal: true
# copied from Hyrax

module ControllerLevelHelpers
  # This provides some common mock methods for view tests.
  # These are normally provided by the controller.
  module ControllerViewHelpers
    def search_state
      @search_state ||= CatalogController.search_state_class.new(params, blacklight_config, controller)
    end

    # This allows you to set the configuration
    # @example: view.blacklight_config = Blacklight::Configuration.new
    attr_writer :blacklight_config

    def blacklight_config
      @blacklight_config ||= CatalogController.blacklight_config
    end

    def blacklight_configuration_context
      @blacklight_configuration_context ||= Blacklight::Configuration::Context.new(controller)
    end
  end

  def initialize_controller_helpers(helper)
    helper.extend ControllerViewHelpers
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
iiif_print-1.1.0 spec/support/controller_level_helpers.rb
iiif_print-1.0.0 spec/support/controller_level_helpers.rb
newspaper_works-1.0.1 spec/support/controller_level_helpers.rb
newspaper_works-1.0.0 spec/support/controller_level_helpers.rb
newspaper_works-0.1.0 spec/support/controller_level_helpers.rb