Merge pull request #3131 from consul/documents-title
[Backport] Documents title
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
<div id="documents" class="documents">
|
<% if documents.any? %>
|
||||||
<h2><%= t("documents.title") %> <span>(<%= documents.count %>)</span></h2>
|
<div id="documents" class="documents">
|
||||||
|
<h2><%= t("documents.title") %> <span>(<%= documents.count %>)</span></h2>
|
||||||
|
|
||||||
<% if documents.any? %>
|
|
||||||
<ul class="no-bullet document-link">
|
<ul class="no-bullet document-link">
|
||||||
<%= render partial: "documents/document", collection: documents %>
|
<%= render partial: "documents/document", collection: documents %>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
</div>
|
||||||
</div>
|
<% end %>
|
||||||
|
|||||||
@@ -68,6 +68,33 @@ shared_examples "documentable" do |documentable_factory_name,
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "When allow attached documents setting is enabled" do
|
||||||
|
before do
|
||||||
|
Setting['feature.allow_attached_documents'] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
Setting['feature.allow_attached_documents'] = false
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Documents list should be available" do
|
||||||
|
login_as(user)
|
||||||
|
visit send(documentable_path, arguments)
|
||||||
|
|
||||||
|
expect(page).to have_css("#documents")
|
||||||
|
expect(page).to have_content("Documents (1)")
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "Documents list increase documents number" do
|
||||||
|
create(:document, documentable: documentable, user: documentable.author)
|
||||||
|
login_as(user)
|
||||||
|
visit send(documentable_path, arguments)
|
||||||
|
|
||||||
|
expect(page).to have_css("#documents")
|
||||||
|
expect(page).to have_content("Documents (2)")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "When allow attached documents setting is disabled" do
|
describe "When allow attached documents setting is disabled" do
|
||||||
before do
|
before do
|
||||||
Setting['feature.allow_attached_documents'] = false
|
Setting['feature.allow_attached_documents'] = false
|
||||||
@@ -101,7 +128,7 @@ shared_examples "documentable" do |documentable_factory_name,
|
|||||||
expect(page).to have_content "Document was deleted successfully."
|
expect(page).to have_content "Document was deleted successfully."
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Should update documents tab count after successful deletion" do
|
scenario "Should hide documents tab if there is no documents" do
|
||||||
login_as documentable.author
|
login_as documentable.author
|
||||||
|
|
||||||
visit send(documentable_path, arguments)
|
visit send(documentable_path, arguments)
|
||||||
@@ -110,7 +137,7 @@ shared_examples "documentable" do |documentable_factory_name,
|
|||||||
click_on "Destroy document"
|
click_on "Destroy document"
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(page).to have_content "Documents (0)"
|
expect(page).not_to have_content "Documents (0)"
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Should redirect to documentable path after successful deletion" do
|
scenario "Should redirect to documentable path after successful deletion" do
|
||||||
|
|||||||
Reference in New Issue
Block a user