spec/features/collection_spec.rb in curation_concerns-0.5.0 vs spec/features/collection_spec.rb in curation_concerns-0.6.0

- old
+ new

@@ -54,20 +54,25 @@ click_button('Create Collection') expect(page).to have_content 'Items in this Collection' expect(page).to have_content title expect(page).to have_content description end + it "fails if there's missing required fields" do + click_link 'Add a Collection' + click_button 'Create Collection' + expect(page).to have_content 'Please review the errors below' + end end describe 'delete collection' do before do @collection = Collection.new title: 'collection title' @collection.description = 'collection description' @collection.apply_depositor_metadata(user_key) @collection.save sign_in user - visit main_app.catalog_index_path('f[generic_type_sim][]' => 'Collection', works: 'mine') + visit main_app.search_catalog_path('f[generic_type_sim][]' => 'Collection', works: 'mine') end it 'deletes a collection' do expect(page).to have_content(@collection.title) within("#document_#{@collection.id}") do @@ -156,9 +161,20 @@ expect(page).to_not have_content(@collection.title) expect(page).to_not have_content(@collection.description) expect(page).to have_content(new_title) expect(page).to have_content(new_description) expect(page).to have_content(creators.first) + end + + context "when there are errors" do + it "displays them" do + within("#document_#{@collection.id}") do + click_link('Edit Collection') + end + fill_in 'Title', with: '' + click_button 'Update Collection' + expect(page).to have_content 'review the errors' + end end it 'removes a work from a collection from edit page' do expect(page).to have_content(@collection.title) within("#document_#{@collection.id}") do