Merge pull request #2753 from consul/unfeasibility-explanation

Fix display of unfeasibility explanation
This commit is contained in:
Alberto
2018-07-26 13:21:21 +02:00
committed by GitHub
2 changed files with 42 additions and 0 deletions

View File

@@ -1081,6 +1081,24 @@ feature 'Budget Investments' do
expect(page).not_to have_content("Local government is not competent in this matter")
end
scenario "Show (unfeasible budget investment with valuation not finished)" do
user = create(:user)
login_as(user)
investment = create(:budget_investment,
:unfeasible,
valuation_finished: false,
budget: budget,
group: group,
heading: heading,
unfeasibility_explanation: 'Local government is not competent in this matter')
visit budget_investment_path(budget_id: budget.id, id: investment.id)
expect(page).not_to have_content("Unfeasibility explanation")
expect(page).not_to have_content("Local government is not competent in this matter")
end
scenario "Show milestones", :js do
user = create(:user)
investment = create(:budget_investment)

View File

@@ -308,6 +308,30 @@ describe Budget::Investment do
end
end
describe "#by_budget" do
it "returns investments scoped by budget" do
budget1 = create(:budget)
budget2 = create(:budget)
group1 = create(:budget_group, budget: budget1)
group2 = create(:budget_group, budget: budget2)
heading1 = create(:budget_heading, group: group1)
heading2 = create(:budget_heading, group: group2)
investment1 = create(:budget_investment, heading: heading1)
investment2 = create(:budget_investment, heading: heading1)
investment3 = create(:budget_investment, heading: heading2)
investments_by_budget = Budget::Investment.by_budget(budget1)
expect(investments_by_budget).to include investment1
expect(investments_by_budget).to include investment2
expect(investments_by_budget).to_not include investment3
end
end
describe "#by_admin" do
it "returns investments assigned to specific administrator" do
investment1 = create(:budget_investment, administrator_id: 33)