Merge pull request #2657 from wairbut-m2c/backport/display-selected-budgets

Display only selected budget investmests in "Publishing prices" phase
This commit is contained in:
Raimond Garcia
2018-05-31 22:03:55 +02:00
committed by GitHub
4 changed files with 38 additions and 9 deletions

View File

@@ -117,7 +117,7 @@ class ApplicationController < ActionController::Base
end
def set_default_budget_filter
if @budget.try(:balloting?)
if @budget.try(:balloting?) || @budget.try(:publishing_prices?)
params[:filter] ||= "selected"
end
end

View File

@@ -216,6 +216,18 @@ feature 'Budgets' do
expect(page).not_to have_link "See unfeasible investments"
expect(page).not_to have_link "See investments not selected for balloting phase"
budget.update(phase: :publishing_prices)
visit budget_path(budget)
expect(page).not_to have_link "See unfeasible investments"
expect(page).not_to have_link "See investments not selected for balloting phase"
click_link group.name
expect(page).not_to have_link "See unfeasible investments"
expect(page).not_to have_link "See investments not selected for balloting phase"
budget.update(phase: :balloting)
visit budget_path(budget)

View File

@@ -1216,6 +1216,27 @@ feature 'Budget Investments' do
end
context "Publishing prices phase" do
background do
budget.update(phase: "publishing_prices")
end
scenario "Heading index - should show only selected investments" do
investment1 = create(:budget_investment, :selected, heading: heading, price: 10000)
investment2 = create(:budget_investment, :selected, heading: heading, price: 15000)
investment3 = create(:budget_investment, heading: heading, price: 30000)
visit budget_investments_path(budget, heading: heading)
within("#budget-investments") do
expect(page).to have_content investment1.title
expect(page).to have_content investment2.title
expect(page).not_to have_content investment3.title
end
end
end
context "Balloting Phase" do
background do

View File

@@ -250,10 +250,8 @@ feature 'Tags' do
Budget::Phase::PHASE_KINDS.each do |phase|
budget.update(phase: phase)
if budget.balloting?
[investment1, investment2, investment3].each do |investment|
investment.update(selected: true, feasibility: "feasible")
end
[investment1, investment2, investment3].each do |investment|
investment.update(selected: true, feasibility: "feasible")
end
login_as(admin) if budget.drafting?
@@ -297,10 +295,8 @@ feature 'Tags' do
Budget::Phase::PHASE_KINDS.each do |phase|
budget.update(phase: phase)
if budget.balloting?
[investment1, investment2, investment3].each do |investment|
investment.update(selected: true, feasibility: "feasible")
end
[investment1, investment2, investment3].each do |investment|
investment.update(selected: true, feasibility: "feasible")
end
login_as(admin) if budget.drafting?