Sha256: 3111433bb8dbbfb5d002ca90956fe3b59c74144c368e87db87280370fbb77f44

Contents?: true

Size: 975 Bytes

Versions: 1

Compression:

Stored size: 975 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Blacklight::DefaultComponentConfiguration do
  before do
    allow(Deprecation).to receive(:warn)
  end
  
  subject do
    Class.new do
      include Blacklight::Configurable
      include Blacklight::DefaultComponentConfiguration

      def some_existing_action
        1
      end
    end
  end

  describe ".add_show_tools_partial" do
    it "defines an action method" do
      subject.blacklight_config.add_show_tools_partial :xyz
      expect(subject.new).to respond_to :xyz
    end

    it "does not replace an existing method" do
      subject.blacklight_config.add_show_tools_partial :some_existing_action
      expect(subject.new.some_existing_action).to eq 1
    end

    it "allows the configuration to opt out of creating a method" do
      subject.blacklight_config.add_show_tools_partial :some_missing_action, define_method: false
      expect(subject.new).not_to respond_to :some_missing_action
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-7.0.0.rc1 spec/controllers/blacklight/catalog/component_configuration_spec.rb