Move tests related with attached documents from documentable shared specs to nested documentable file
Note that we moved some system tests to component tests, since they don't involve user interaction and can be fully covered at the component level.
This commit is contained in:
@@ -287,4 +287,35 @@ describe "Nested documentable" do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "Show path" do
|
||||
let(:factory) { (factories - [:dashboard_action]).sample }
|
||||
let(:path) { polymorphic_path(documentable) }
|
||||
|
||||
scenario "Documents list should not be available when allow attached documents setting is disabled" do
|
||||
Setting["feature.allow_attached_documents"] = false
|
||||
create(:document, documentable: documentable)
|
||||
visit path
|
||||
|
||||
expect(page).not_to have_css("#documents")
|
||||
end
|
||||
|
||||
context "Destroy" do
|
||||
scenario "Should show success notice after successful document upload" do
|
||||
create(:document, documentable: documentable)
|
||||
documentable.update!(author: user)
|
||||
login_as(user)
|
||||
visit path
|
||||
|
||||
accept_confirm { click_button "Delete document" }
|
||||
|
||||
expect(page).to have_content "Document was deleted successfully."
|
||||
expect(page).not_to have_content "Documents (0)"
|
||||
|
||||
within "##{ActionView::RecordIdentifier.dom_id(documentable)}" do
|
||||
expect(page).to have_css "h1", text: documentable.title
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user