Sha256: fd30abf4e9b83083067ccfeb9e8eeaaab1161f2e8c8635e035bb4aa8075e390b

Contents?: true

Size: 913 Bytes

Versions: 9

Compression:

Stored size: 913 Bytes

Contents

describe Spotlight::Contact, type: :model do
  let(:exhibit) { FactoryBot.create(:exhibit) }

  before do
    subject.exhibit = exhibit
  end

  context '#show_in_sidebar' do
    it 'is an attribute' do
      subject.show_in_sidebar = false
      subject.save
      expect(subject.show_in_sidebar).to be_falsey
    end
    it 'is published by default' do
      subject.save
      expect(subject.show_in_sidebar).to be_truthy
    end
  end

  context '#fields' do
    it 'show allow new fields to be configured' do
      expect(subject.class.fields).to_not have_key(:new_field)
      described_class.fields[:new_field] = {}
      expect(subject.class.fields).to have_key(:new_field)
    end
  end

  describe '#contact_info' do
    it 'persisted symbolized keys' do
      subject.contact_info = { 'some' => 'value' }
      subject.save
      expect(subject.contact_info).to include some: 'value'
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
blacklight-spotlight-2.4.1 spec/models/spotlight/contact_spec.rb
blacklight-spotlight-2.4.0 spec/models/spotlight/contact_spec.rb
blacklight-spotlight-2.3.3 spec/models/spotlight/contact_spec.rb
blacklight-spotlight-2.3.2 spec/models/spotlight/contact_spec.rb
blacklight-spotlight-2.3.1 spec/models/spotlight/contact_spec.rb
blacklight-spotlight-2.3.0 spec/models/spotlight/contact_spec.rb
blacklight-spotlight-2.2.1 spec/models/spotlight/contact_spec.rb
blacklight-spotlight-2.2.0 spec/models/spotlight/contact_spec.rb
blacklight-spotlight-2.1.0 spec/models/spotlight/contact_spec.rb