Unify tests when removing documents
This commit is contained in:
@@ -99,20 +99,33 @@ describe "Nested documentable" do
|
|||||||
expect(page).to have_field("Title", with: "empty.pdf")
|
expect(page).to have_field("Title", with: "empty.pdf")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Should not update nested document file title with
|
scenario "Should not change existing titles except when removing the document" do
|
||||||
file name after choosing a file when title already defined" do
|
|
||||||
do_login_for(user, management: management_section?(path))
|
do_login_for(user, management: management_section?(path))
|
||||||
visit path
|
visit path
|
||||||
|
|
||||||
click_link "Add new document"
|
click_link "Add new document"
|
||||||
|
|
||||||
|
expect(page).not_to have_link "Add new document"
|
||||||
|
|
||||||
within "#nested-documents" do
|
within "#nested-documents" do
|
||||||
fill_in "Title", with: "My Title"
|
fill_in "Title", with: "My Title"
|
||||||
attach_file "Choose document", file_fixture("empty.pdf")
|
attach_file "Choose document", file_fixture("empty.pdf")
|
||||||
|
|
||||||
expect(page).to have_css ".loading-bar.complete"
|
expect(page).to have_css ".loading-bar.complete"
|
||||||
|
expect(page).to have_field "Title", with: "My Title"
|
||||||
|
|
||||||
|
click_link "Remove document"
|
||||||
|
|
||||||
|
expect(page).not_to have_css ".document-fields"
|
||||||
|
expect(page).not_to have_field "Title"
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(page).to have_field("Title", with: "My Title")
|
click_link "Add new document"
|
||||||
|
|
||||||
|
within "#nested-documents" do
|
||||||
|
expect(page).to have_field "Title", with: ""
|
||||||
|
expect(page).not_to have_field "Title", with: "My Title"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Should update document cached_attachment field after valid file upload" do
|
scenario "Should update document cached_attachment field after valid file upload" do
|
||||||
@@ -152,25 +165,6 @@ describe "Nested documentable" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Should delete document after valid file upload and click on remove button" do
|
|
||||||
do_login_for(user, management: management_section?(path))
|
|
||||||
visit path
|
|
||||||
|
|
||||||
click_link "Add new document"
|
|
||||||
|
|
||||||
expect(page).not_to have_link "Add new document"
|
|
||||||
|
|
||||||
within "#nested-documents" do
|
|
||||||
attach_file "Choose document", file_fixture("empty.pdf")
|
|
||||||
within ".document-fields" do
|
|
||||||
expect(page).to have_css ".loading-bar.complete"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
click_link "Remove document"
|
|
||||||
|
|
||||||
expect(page).not_to have_css("#nested-documents .document-fields")
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Should show successful notice when resource filled correctly without any nested documents" do
|
scenario "Should show successful notice when resource filled correctly without any nested documents" do
|
||||||
do_login_for(user, management: management_section?(path))
|
do_login_for(user, management: management_section?(path))
|
||||||
visit path
|
visit path
|
||||||
|
|||||||
Reference in New Issue
Block a user