Sha256: 41afd248041971307cb6153082c27a6247ffbbd285ffaa65222e7b4506ed1d71

Contents?: true

Size: 1.8 KB

Versions: 14

Compression:

Stored size: 1.8 KB

Contents

# frozen_string_literal: true

describe 'Language', type: :feature do
  let(:exhibit) { FactoryBot.create(:exhibit) }
  let(:admin) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }

  before do
    login_as admin
    visit spotlight.edit_exhibit_path(exhibit)
  end

  describe 'creation' do
    it 'successfully adds languages' do
      within '#language' do
        select 'Albanian'
        find('input[name="commit"]').click
      end
      expect(page).to have_css '.flash_messages', text: 'The language was created.'
      within '#language' do
        expect(page).to have_css 'table'
        expect(page).to have_css 'td', text: 'Albanian'
      end
    end
  end

  describe 'making public' do
    it 'successfully updates the language' do
      within '#language' do
        select 'Albanian'
        find('input[name="commit"]').click
      end
      expect(page).to have_css '.flash_messages', text: 'The language was created.'
      within '#language' do
        check 'Public'
        click_button 'Save changes'
      end
      expect(page).to have_css '.flash_messages', text: 'The exhibit was successfully updated.'
      expect(exhibit.languages.last).to be_public
    end
  end

  describe 'deleting' do
    it 'successfully updates the language' do
      within '#language' do
        select 'Albanian'
        find('input[name="commit"]').click
      end
      expect(page).to have_css '.flash_messages', text: 'The language was created.'
      within '#language' do
        click_link 'Remove'
      end
      expect(page).to have_css '.flash_messages', text: 'The language was deleted.'
      within '#language' do
        expect(page).to have_content 'No languages have been added for translation. To add a language, make a selection above.'
        expect(page).not_to have_css 'table'
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
blacklight-spotlight-3.4.0 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-3.3.0 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-3.2.0 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-3.1.0 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-3.0.3 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-3.0.2 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-3.0.1 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-3.0.0 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-3.0.0.rc6 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-3.0.0.rc5 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-3.0.0.rc4 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-3.0.0.rc3 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-3.0.0.rc2 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-3.0.0.rc1 spec/features/exhibits/language_create_edit_spec.rb