Refactor nested document tests to simplify contexts and remove duplication
This commit is contained in:
@@ -15,7 +15,6 @@ describe "Nested documentable" do
|
||||
let(:notice_text) { notice_text_for(factory, path) }
|
||||
|
||||
context "New and edit path" do
|
||||
describe "When allow attached documents setting is enabled" do
|
||||
before do
|
||||
Setting["uploads.documents.max_amount"] = 1
|
||||
create(:administrator, user: user) if admin_section?(path)
|
||||
@@ -199,6 +198,17 @@ describe "Nested documentable" do
|
||||
expect(reader.info).to eq({})
|
||||
end
|
||||
end
|
||||
|
||||
describe "When allow attached documents setting is disabled" do
|
||||
before { Setting["feature.allow_attached_documents"] = false }
|
||||
|
||||
scenario "Add new document button should not be available" do
|
||||
do_login_for(user, management: management_section?(path))
|
||||
visit path
|
||||
|
||||
expect(page).not_to have_content("Add new document")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "Only for edit path" do
|
||||
@@ -240,18 +250,6 @@ describe "Nested documentable" do
|
||||
end
|
||||
end
|
||||
|
||||
describe "When allow attached documents setting is disabled" do
|
||||
before { Setting["feature.allow_attached_documents"] = false }
|
||||
|
||||
scenario "Add new document button should not be available" do
|
||||
do_login_for(user, management: management_section?(path))
|
||||
visit path
|
||||
|
||||
expect(page).not_to have_content("Add new document")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "Show path" do
|
||||
let(:factory) { (factories - [:dashboard_action]).sample }
|
||||
let(:path) { polymorphic_path(documentable) }
|
||||
|
||||
Reference in New Issue
Block a user