Sha256: fbce6768b80b26ee00c32cba119408301a9a94cf5509f8b3a81fbe0180eeaf91

Contents?: true

Size: 1.44 KB

Versions: 33

Compression:

Stored size: 1.44 KB

Contents

require 'tempfile'

describe 'Allow exhibit admins to import and export content from an exhibit', type: :feature, js: true do
  let(:exhibit) { FactoryGirl.create(:exhibit) }
  let(:user) { FactoryGirl.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

33 entries across 33 versions & 1 rubygems

Version Path
blacklight-spotlight-1.0.0 spec/features/import_exhibit_spec.rb
blacklight-spotlight-1.0.0.alpha2 spec/features/import_exhibit_spec.rb
blacklight-spotlight-1.0.0.alpha1 spec/features/import_exhibit_spec.rb
blacklight-spotlight-0.34.1 spec/features/import_exhibit_spec.rb
blacklight-spotlight-0.34.0 spec/features/import_exhibit_spec.rb
blacklight-spotlight-0.33.3 spec/features/import_exhibit_spec.rb
blacklight-spotlight-0.33.2 spec/features/import_exhibit_spec.rb
blacklight-spotlight-0.33.1 spec/features/import_exhibit_spec.rb
blacklight-spotlight-0.33.0 spec/features/import_exhibit_spec.rb
blacklight-spotlight-0.32.0 spec/features/import_exhibit_spec.rb
blacklight-spotlight-0.31.0 spec/features/import_exhibit_spec.rb
blacklight-spotlight-0.30.0 spec/features/import_exhibit_spec.rb
blacklight-spotlight-0.29.1 spec/features/import_exhibit_spec.rb
blacklight-spotlight-0.29.0 spec/features/import_exhibit_spec.rb
blacklight-spotlight-0.28.3 spec/features/import_exhibit_spec.rb
blacklight-spotlight-0.28.2 spec/features/import_exhibit_spec.rb
blacklight-spotlight-0.28.1 spec/features/import_exhibit_spec.rb
blacklight-spotlight-0.28.0 spec/features/import_exhibit_spec.rb
blacklight-spotlight-0.27.0 spec/features/import_exhibit_spec.rb
blacklight-spotlight-0.26.1 spec/features/import_exhibit_spec.rb