Sha256: adc4f17c4d239f1d3e62c7c74d74cbd15cfa8781d833b3960366e05f183fdace

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

describe 'Create a new exhibit', type: :feature do
  let(:user) { FactoryGirl.create(:site_admin) }
  before do
    allow_any_instance_of(Spotlight::Search).to receive(:set_default_featured_image)
    login_as user
  end

  it 'has a link in the user dropdown' do
    visit '/'
    within '.dropdown-menu' do
      click_link 'Create Exhibit'
    end
    expect(page).to have_selector 'h1', text: 'Administration'
    expect(page).to have_selector 'h1 small', text: 'Create a new exhibit'
  end

  it 'allows admins to create a new exhibit' do
    visit '/'
    within '.dropdown-menu' do
      click_link 'Create Exhibit'
    end

    fill_in 'Title', with: 'My exhibit title'

    click_button 'Save'

    expect(page).to have_content 'The exhibit was created.'
    expect(Spotlight::Exhibit.last.slug).to eq 'my-exhibit-title'
  end

  it 'allows admins to create a new exhibit with a slug' do
    visit '/'
    within '.dropdown-menu' do
      click_link 'Create Exhibit'
    end

    fill_in 'Title', with: 'My exhibit title'
    fill_in 'URL slug', with: 'custom-slug'

    click_button 'Save'

    expect(page).to have_content 'The exhibit was created.'
    expect(Spotlight::Exhibit.last.slug).to eq 'custom-slug'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blacklight-spotlight-0.8.2 spec/features/create_exhibit_spec.rb
blacklight-spotlight-0.8.1 spec/features/create_exhibit_spec.rb