Sha256: 34c497fb439372982363b257d4264fcd2481a884f622037a6c186828f3815ba1

Contents?: true

Size: 1.1 KB

Versions: 9

Compression:

Stored size: 1.1 KB

Contents

describe 'spotlight/exhibits/_form', type: :view do
  let(:exhibit) { FactoryBot.create(:exhibit) }
  before do
    assign(:exhibit, exhibit)
  end
  context 'when using default language' do
    before do
      allow(view).to receive_messages(
        default_language?: true
      )
    end

    it 'allows an editable title' do
      render
      expect(rendered).to have_selector 'input[name="exhibit[title]"]'
      expect(rendered).not_to have_selector 'input[name="exhibit[title]"][disabled="disabled"]'
      expect(rendered).not_to have_content 'This field is not editable in the current language. Switch to the default language to edit it.'
    end
  end
  context 'when using non-default language' do
    before do
      allow(view).to receive_messages(
        default_language?: false
      )
    end

    it 'disables editable title with help text' do
      render
      expect(rendered).to have_selector 'input[name="exhibit[title]"][disabled="disabled"]'
      expect(rendered).to have_content 'This field is not editable in the current language. Switch to the default language to edit it.'
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
blacklight-spotlight-2.0.2 spec/views/spotlight/exhibits/_form.html.erb_spec.rb
blacklight-spotlight-2.0.1 spec/views/spotlight/exhibits/_form.html.erb_spec.rb
blacklight-spotlight-2.0.0 spec/views/spotlight/exhibits/_form.html.erb_spec.rb
blacklight-spotlight-2.0.0.rc6 spec/views/spotlight/exhibits/_form.html.erb_spec.rb
blacklight-spotlight-2.0.0.rc5 spec/views/spotlight/exhibits/_form.html.erb_spec.rb
blacklight-spotlight-2.0.0.rc4 spec/views/spotlight/exhibits/_form.html.erb_spec.rb
blacklight-spotlight-2.0.0.rc3 spec/views/spotlight/exhibits/_form.html.erb_spec.rb
blacklight-spotlight-2.0.0.rc2 spec/views/spotlight/exhibits/_form.html.erb_spec.rb
blacklight-spotlight-2.0.0.rc1 spec/views/spotlight/exhibits/_form.html.erb_spec.rb