Remove expect_document_has_title method
I think tests are now clearer by using have_field. Note that I have remove the within ".document-fields" because there is only one document.
This commit is contained in:
@@ -92,7 +92,7 @@ describe "Nested documentable" do
|
||||
documentable_attach_new_file(file_fixture("empty.pdf"))
|
||||
|
||||
expect(page).to have_css ".file-name", text: "empty.pdf"
|
||||
expect_document_has_title(0, "empty.pdf")
|
||||
expect(page).to have_field("Title", with: "empty.pdf")
|
||||
end
|
||||
|
||||
scenario "Should not update nested document file title with
|
||||
@@ -109,7 +109,7 @@ describe "Nested documentable" do
|
||||
expect(page).to have_css ".loading-bar.complete"
|
||||
end
|
||||
|
||||
expect_document_has_title(0, "My Title")
|
||||
expect(page).to have_field("Title", with: "My Title")
|
||||
end
|
||||
|
||||
scenario "Should update loading bar style after valid file upload" do
|
||||
@@ -321,12 +321,4 @@ describe "Nested documentable" do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def expect_document_has_title(index, title)
|
||||
document = all(".document-fields")[index]
|
||||
|
||||
within document do
|
||||
expect(find("input[name$='[title]']").value).to eq title
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user