This commit is contained in:
Bilal
2020-08-04 15:24:45 +02:00
parent 0294a480ee
commit 580312bc52

View File

@@ -280,62 +280,63 @@ feature "User managing acquired_media releases" do
end end
scenario "creating, updating, destroying a release", js: true do scenario "creating, updating, destroying a release", js: true do
release_data = { resize_window_to(1_000, 1_000) do
name: "Test Acquired Media Release", release_data = {
applicable_media: ApplicableMedium.last.label, name: "Test Acquired Media Release",
territory: Territory.last.label, applicable_media: ApplicableMedium.last.label,
term: Term.last.label, territory: Territory.last.label,
restriction: Restriction.first.label, term: Term.last.label,
restriction_text: "Not available in China", restriction: Restriction.first.label,
} restriction_text: "Not available in China",
}
sign_in current_user sign_in current_user
visit new_project_acquired_media_release_path(project) visit new_project_acquired_media_release_path(project)
by "attaching only a contract" do by "attaching only a contract" do
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
click_button create_release_button click_button create_release_button
expect(page).to have_invalid_field(acquired_media_name_field) expect(page).to have_invalid_field(acquired_media_name_field)
end
by "attaching files" do
drop_file Rails.root.join(file_fixture("video_file.mp4")), type: "file-info-dropzone"
click_button create_release_button
expect(page).to have_invalid_field(acquired_media_name_field)
end
by "filling out the remaining information" do
fill_in_release_fields release_data
click_button create_release_button
expect(page).to have_content(create_release_notice)
expect(page).to have_content("1")
click_on "Manage"
expect(page).to have_link("Download")
end
it_also "updates an existing release" do
click_link "Edit"
within ".dropzone" do
expect(page).to have_filename("video_file.mp4")
end end
expect(page).to have_filled_in_data(release_data) by "attaching files" do
drop_file Rails.root.join(file_fixture("video_file.mp4")), type: "file-info-dropzone"
click_button create_release_button
fill_in_release_fields name: "New name" expect(page).to have_invalid_field(acquired_media_name_field)
drop_file Rails.root.join(file_fixture("person_photo.png")), type: "file-info-dropzone" end
click_button update_release_button
expect(page).to have_content(update_release_notice) by "filling out the remaining information" do
expect(page).to have_content("New name") fill_in_release_fields release_data
expect(page).to have_content("2") click_button create_release_button
end
it_also "deletes an existing release" do expect(page).to have_content(create_release_notice)
expect(page).to have_content("1")
click_on "Manage"
expect(page).to have_link("Download")
end
it_also "updates an existing release" do
click_link "Edit"
within ".dropzone" do
expect(page).to have_filename("video_file.mp4")
end
expect(page).to have_filled_in_data(release_data)
fill_in_release_fields name: "New name"
drop_file Rails.root.join(file_fixture("person_photo.png")), type: "file-info-dropzone"
click_button update_release_button
expect(page).to have_content(update_release_notice)
expect(page).to have_content("New name")
expect(page).to have_content("2")
end
it_also "deletes an existing release" do
click_button "Manage" click_button "Manage"
accept_alert do accept_alert do
click_link "Delete" click_link "Delete"
@@ -343,6 +344,7 @@ feature "User managing acquired_media releases" do
expect(page).not_to have_content("New name") expect(page).not_to have_content("New name")
end end
end
end end
scenario "viewing the contract PDF for an adult" do scenario "viewing the contract PDF for an adult" do