Extract management budget investment from shared nested imageable specs to system specs

This commit is contained in:
taitus
2024-11-20 11:08:46 +01:00
parent 9d7fa9d0f8
commit cdfaec5217
2 changed files with 15 additions and 12 deletions

View File

@@ -17,15 +17,6 @@ describe "Budget Investments" do
"Budget Investment created successfully.", "Budget Investment created successfully.",
management: true management: true
it_behaves_like "nested imageable",
"budget_investment",
"new_management_budget_investment_path",
{ budget_id: "budget_id" },
"imageable_fill_new_valid_budget_investment",
"Create Investment",
"Budget Investment created successfully.",
management: true
it_behaves_like "mappable", it_behaves_like "mappable",
"budget_investment", "budget_investment",
"investment", "investment",

View File

@@ -14,7 +14,11 @@ describe "Nested imageable" do
let(:path) do let(:path) do
case factory case factory
when :budget then new_admin_budgets_wizard_budget_path when :budget then new_admin_budgets_wizard_budget_path
when :budget_investment then new_budget_investment_path(budget_id: imageable.budget_id) when :budget_investment
[
new_budget_investment_path(budget_id: imageable.budget_id),
new_management_budget_investment_path(budget_id: imageable.budget_id)
].sample
when :future_poll_question_option then new_admin_option_image_path(option_id: imageable.id) when :future_poll_question_option then new_admin_option_image_path(option_id: imageable.id)
when :proposal then new_proposal_path when :proposal then new_proposal_path
end end
@@ -37,8 +41,8 @@ describe "Nested imageable" do
end end
before do before do
create(:administrator, user: user) if [:budget, :future_poll_question_option].include?(factory) create(:administrator, user: user) if admin_section? || management_section?
login_as(user) do_login_for(user, management: management_section?)
visit path visit path
end end
@@ -237,4 +241,12 @@ describe "Nested imageable" do
fill_in_ckeditor "Description", with: "Budget investment description" fill_in_ckeditor "Description", with: "Budget investment description"
check :budget_investment_terms_of_service check :budget_investment_terms_of_service
end end
def admin_section?
path.starts_with?("/admin/")
end
def management_section?
path.starts_with?("/management/")
end
end end