Manage the render of the price field on valuation investments section

This commit is contained in:
decabeza
2022-02-03 10:49:41 +01:00
committed by taitus
parent 4c0499d53b
commit 8c3b222c98
3 changed files with 73 additions and 38 deletions

View File

@@ -381,6 +381,35 @@ describe "Valuation budget investments" do
end
end
scenario "Dossier hide price on hide money budgets" do
budget = create(:budget, :valuating, :hide_money)
investment = create(:budget_investment, budget: budget, administrator: admin, valuators: [valuator])
investment.update!(visible_to_valuators: true)
visit valuation_budget_budget_investments_path(budget)
within("#budget_investment_#{investment.id}") do
click_link "Edit dossier"
end
expect(page).not_to have_content "Price (€)"
expect(page).not_to have_content "Cost during the first year (€)"
expect(page).not_to have_content "Price explanation"
choose "budget_investment_feasibility_feasible"
fill_in "budget_investment_duration", with: "12 months"
click_button "Save changes"
expect(page).to have_content "Dossier updated"
visit valuation_budget_budget_investments_path(budget)
click_link investment.title
within("#duration") { expect(page).to have_content("12 months") }
within("#feasibility") { expect(page).to have_content("Feasible") }
expect(page).not_to have_selector "#price"
expect(page).not_to have_selector "#price_first_year"
end
scenario "Finish valuation" do
investment.update!(visible_to_valuators: true)