Sha256: e524f5e2b3fd7c48d0b192031a338e94d920db6196c0819086c9e193445aa22d

Contents?: true

Size: 1.78 KB

Versions: 18

Compression:

Stored size: 1.78 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'
        click_button 'Add language'
      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'
        click_button 'Add language'
      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'
        click_button 'Add language'
      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

18 entries across 18 versions & 1 rubygems

Version Path
blacklight-spotlight-3.0.0.alpha.2 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-3.0.0.alpha.1 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-2.13.0 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-2.12.1 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-2.12.0 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-2.11.0 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-2.10.0 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-2.9.0 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-2.8.0 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-2.7.2 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-2.7.1 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-2.7.0 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-2.6.1.1 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-2.6.1 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-2.6.0 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-2.5.2 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-2.5.1 spec/features/exhibits/language_create_edit_spec.rb
blacklight-spotlight-2.5.0 spec/features/exhibits/language_create_edit_spec.rb