Sha256: 4dac12554274d05cb67f43147ac52c5528d93a3751cc995a672510d4b0eee0c3

Contents?: true

Size: 1.48 KB

Versions: 21

Compression:

Stored size: 1.48 KB

Contents

require 'spec_helper'

describe 'Adding custom metadata field data', type: :feature do
  let(:exhibit) { FactoryGirl.create(:exhibit) }
  let(:admin) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
  let(:custom_field) { FactoryGirl.create(:custom_field, exhibit: exhibit) }
  let(:config) { exhibit.blacklight_configuration }
  before do
    login_as(admin)
    config.index_fields[custom_field.field] = { enabled: true, show: true, 'label' => 'Some Field' }
    config.save!
  end

  it 'works' do
    visit spotlight.exhibit_catalog_path(exhibit, 'dq287tq6352')

    expect(page).to have_link 'Edit'

    click_on 'Edit'

    fill_in 'Some Field', with: 'My new custom field value'

    click_on 'Save changes'

    expect(::SolrDocument.find('dq287tq6352').sidecar(exhibit).data).to include 'field_name_tesim' => 'My new custom field value'
    sleep(1) # The data isn't commited to solr immediately.

    visit spotlight.exhibit_catalog_path(exhibit, 'dq287tq6352')
    expect(page).to have_content 'Some Field'
    expect(page).to have_content 'My new custom field value'
  end

  it 'has a public toggle' do
    visit spotlight.exhibit_catalog_path(exhibit, 'dq287tq6352')

    expect(page).not_to have_selector '.blacklight-private'

    click_on 'Edit'

    uncheck 'Public'

    click_on 'Save changes'

    expect(page).to have_selector '.blacklight-private'

    click_on 'Edit'

    check 'Public'

    click_on 'Save changes'

    expect(page).not_to have_selector '.blacklight-private'
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
blacklight-spotlight-0.17.1 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.17.0 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.16.0 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.15.0 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.14.2 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.14.1 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.14.0 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.13.0 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.12.1 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.12.0 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.11.0 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.10.3 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.10.2 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.10.1 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.10.0 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.9.2 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.9.1 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.9.0 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.8.2 spec/features/add_custom_field_metadata_spec.rb
blacklight-spotlight-0.8.1 spec/features/add_custom_field_metadata_spec.rb