Refactor documents and document view partials

This commit is contained in:
Bertocq
2018-01-02 13:24:38 +01:00
parent 46dc559301
commit d7d1a85fbb
3 changed files with 32 additions and 69 deletions

View File

@@ -18,25 +18,6 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path,
let!(:document) { create(:document, documentable: documentable, user: documentable.author)}
scenario "Should not display maximum number of documents alert when reached for users without document creation permission" do
create_list(:document, 2, documentable: documentable)
visit send(documentable_path, arguments)
within "#tab-documents" do
expect(page).not_to have_content "You have reached the maximum number of documents allowed! You have to delete one before you can upload another."
end
end
scenario "Should display maximum number of documents alert when reached and when current user has document creation permission" do
login_as documentable.author
create_list(:document, 2, documentable: documentable)
visit send(documentable_path, arguments)
within "#tab-documents" do
expect(page).to have_content "You have reached the maximum number of documents allowed! You have to delete one before you can upload another."
end
end
scenario "Download action should be able to anyone" do
visit send(documentable_path, arguments)
@@ -149,4 +130,4 @@ def attach_document(path, success = true)
else
expect(page).to have_css ".loading-bar.errors"
end
end
end