Sha256: 59b9fe6282eef6998b7806df1462a4bacc0b009b7fda717ef8d47bc2d7861771

Contents?: true

Size: 1.47 KB

Versions: 18

Compression:

Stored size: 1.47 KB

Contents

# frozen_string_literal: true

require 'tempfile'

describe 'Allow exhibit admins to import and export content from an exhibit', type: :feature, js: true do
  let(:exhibit) { FactoryBot.create(:exhibit) }
  let(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
  before { login_as user }

  pending 'should allow admins to export content from an exhibit' do
    pending(%(There's not really any good way to test the contents of a
downloaded file with Poltergeist (which is now necessary since we've moved
the export option behind a bootstrap tab)))
    visit spotlight.exhibit_dashboard_path(exhibit)

    click_link 'General'
    within('.nav-tabs') do
      click_link 'Export data'
    end
    within('#export') do
      click_link 'Export data'
    end

    data = JSON.parse(page.body)

    expect(data).to include 'title', 'searches', 'home_page'
  end

  it 'allows admins to import content into an exhibit' do
    visit spotlight.exhibit_dashboard_path(exhibit)

    click_link 'General'

    within('.nav-tabs') do
      click_link 'Import data'
    end

    file = Tempfile.new('foo')
    file.write({ 'title' => 'A better title' }.to_json)
    file.rewind
    begin
      attach_file('file', File.expand_path(file.path))
      within('#import') do
        click_button 'Import data'
      end
    ensure
      file.close
      file.unlink
    end
    expect(page).to have_content 'The exhibit was successfully updated.'
    expect(page).to have_content 'A better title'
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

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