spec/features/create_work_spec.rb in hyrax-2.1.0 vs spec/features/create_work_spec.rb in hyrax-2.2.0
- old
+ new
@@ -28,11 +28,11 @@
it 'creates the work' do
click_link "Files" # switch tab
expect(page).to have_content "Add files"
expect(page).to have_content "Add folder"
- within('span#addfiles') do
+ within('button#addfiles') do
attach_file("files[]", "#{Hyrax::Engine.root}/spec/fixtures/image.jp2", visible: false)
attach_file("files[]", "#{Hyrax::Engine.root}/spec/fixtures/jp2_fits.xml", visible: false)
end
click_link "Descriptions" # switch tab
fill_in('Title', with: 'My Test Work')
@@ -69,11 +69,11 @@
end
it "allows on-behalf-of deposit" do
click_link "Files" # switch tab
expect(page).to have_content "Add files"
- within('span#addfiles') do
+ within('button#addfiles') do
attach_file("files[]", "#{Hyrax::Engine.root}/spec/fixtures/image.jp2", visible: false)
attach_file("files[]", "#{Hyrax::Engine.root}/spec/fixtures/jp2_fits.xml", visible: false)
end
click_link "Descriptions" # switch tab
fill_in('Title', with: 'My Test Work')
@@ -97,8 +97,28 @@
expect(page).to have_content "Your files are being processed by Hyrax in the background."
sign_in second_user
click_link 'Works'
expect(page).to have_content "My Test Work"
+ end
+ end
+
+ context "when a file uploaded and then deleted" do
+ before do
+ sign_in user
+ click_link 'Works'
+ click_link "Add new work"
+ choose "payload_concern", option: "GenericWork"
+ click_button 'Create work'
+ end
+
+ it 'updates the required file check status' do
+ click_link "Files" # switch to the Files tab
+ within('button#addfiles') do
+ attach_file("files[]", "#{Hyrax::Engine.root}/spec/fixtures/image.jp2", visible: false)
+ end
+ expect(page).to have_css('ul li#required-files.complete', text: 'Add files')
+ click_button 'Delete' # delete the file
+ expect(page).to have_css('ul li#required-files.incomplete', text: 'Add files')
end
end
end