Sha256: 3075d6da05ed810212f66d5a5222a82630d083807e6b24d9f465add151b8c36c

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

module Spotlight
  describe "spotlight/blacklight_configurations/_metadata_field", type: :view do
    let(:exhibit) { FactoryGirl.create(:exhibit) } 
    let(:p) { "spotlight/blacklight_configurations/metadata_field.html.erb" }
    before do
      assign(:exhibit, exhibit)
      assign(:blacklight_configuration, exhibit.blacklight_configuration)
      allow(view).to receive_messages(
        current_exhibit: exhibit, 
        blacklight_config: exhibit.blacklight_configuration, 
        available_view_fields: {some_view_type: 1, another_view_type: 2}, 
        select_deselect_button: nil )
    end

    let(:facet_field) { Blacklight::Configuration::FacetField.new }
    let(:builder) { ActionView::Helpers::FormBuilder.new 'z', nil, view, {} }

    it "should use the index_field_label helper to render the label" do
      allow(view).to receive(:index_field_label).with(nil, "some_key").and_return "Some label"
      render partial: p, locals: { key: "some_key", config: facet_field, f: builder }
      expect(rendered).to have_selector '.field-label', text: "Some label"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-spotlight-0.4.1 spec/views/spotlight/blacklight_configuration/_metadata_field.html.erb_spec.rb