spec/features/site_masthead_spec.rb in blacklight-spotlight-0.4.1 vs spec/features/site_masthead_spec.rb in blacklight-spotlight-0.5.0

- old
+ new

@@ -1,100 +1,100 @@ require 'spec_helper' -describe "Add and update the site masthead", :type => :feature do - let(:exhibit) { FactoryGirl.create(:exhibit) } +describe 'Add and update the site masthead', type: :feature do + let(:exhibit) { FactoryGirl.create(:default_exhibit) } let(:user) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) } before { login_as user } - it 'should update site masthead options' do + it 'updates site masthead options' do visit spotlight.exhibit_dashboard_path(exhibit) - within "#sidebar" do - click_link "Appearance" + within '#sidebar' do + click_link 'Appearance' end - click_link "Site masthead" + click_link 'Site masthead' - within "#site-masthead" do - check "Show background image in masthead" - choose "Upload an image" - attach_file('appearance_masthead_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png'))); + within '#site-masthead' do + check 'Show background image in masthead' + choose 'Upload an image' + attach_file('exhibit_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png'))) end - click_button "Save changes" + click_button 'Save changes' - expect(page).to have_content("The appearance was successfully updated.") + expect(page).to have_content('The exhibit was successfully updated.') - within "#sidebar" do - click_link "Appearance" + within '#sidebar' do + click_link 'Appearance' end - click_link "Site masthead" - - within "#site-masthead" do + click_link 'Site masthead' + + within '#site-masthead' do expect(field_labeled('Show background image in masthead')).to be_checked expect(field_labeled('Upload an image')).to be_checked end end - it 'should display a masthead image when one is uploaded and configured' do + it 'displays a masthead image when one is uploaded and configured' do visit spotlight.exhibit_dashboard_path(exhibit) expect(page).to_not have_css('#exhibit-masthead.with-image') - within "#sidebar" do - click_link "Appearance" + within '#sidebar' do + click_link 'Appearance' end - click_link "Site masthead" - - within "#site-masthead" do - check "Show background image in masthead" + click_link 'Site masthead' - attach_file('appearance_masthead_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png'))); + within '#site-masthead' do + check 'Show background image in masthead' + + attach_file('exhibit_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png'))) end - click_button "Save changes" + click_button 'Save changes' - expect(page).to have_content("The appearance was successfully updated.") + expect(page).to have_content('The exhibit was successfully updated.') expect(page).to have_css('#exhibit-masthead.with-image .background-container') end - it 'should not display an uploaded masthead if configured to not display' do + it 'does not display an uploaded masthead if configured to not display' do visit spotlight.exhibit_dashboard_path(exhibit) expect(page).to_not have_css('#exhibit-masthead.with-image') - within "#sidebar" do - click_link "Appearance" + within '#sidebar' do + click_link 'Appearance' end - click_link "Site masthead" - - within "#site-masthead" do - attach_file('appearance_masthead_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png'))); + click_link 'Site masthead' + + within '#site-masthead' do + attach_file('exhibit_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png'))) end - click_button "Save changes" + click_button 'Save changes' - expect(page).to have_content("The appearance was successfully updated.") + expect(page).to have_content('The exhibit was successfully updated.') expect(page).to_not have_css('#exhibit-masthead.with-image .background-container') end - it 'should display a masthead image when one is uploaded from an exhibit item', js: true do + it 'displays a masthead image when one is uploaded from an exhibit item', js: true do skip "Capyabara and jcrop don't play well together.." visit spotlight.exhibit_dashboard_path(exhibit) expect(page).to_not have_css('#exhibit-masthead.with-image') - within "#sidebar" do - click_link "Appearance" + within '#sidebar' do + click_link 'Appearance' end - click_link "Site masthead" - - within "#site-masthead" do - check "Show background image in masthead" + click_link 'Site masthead' - fill_in_typeahead_field 'document_title', with: "Armenia" + within '#site-masthead' do + check 'Show background image in masthead' + + fill_in_typeahead_field 'document_title', with: 'Armenia' end - click_button "Save changes" + click_button 'Save changes' - expect(page).to have_content("The appearance was successfully updated.") + expect(page).to have_content('The appearance was successfully updated.') expect(page).to have_css('#exhibit-masthead.with-image .background-container') end end