Merge pull request #1523 from consul/budgets-polish

Budgets polish
This commit is contained in:
Raimond Garcia
2017-05-06 05:08:27 +02:00
committed by GitHub
17 changed files with 266 additions and 41 deletions

View File

@@ -469,10 +469,12 @@ feature 'Ballots' do
end
scenario 'Unselected investments' do
investment = create(:budget_investment, heading: new_york)
investment = create(:budget_investment, heading: new_york, title: "WTF asdfasfd")
login_as(user)
visit budget_investments_path(budget, heading_id: new_york.id, unfeasible: 1)
visit budget_path(budget)
click_link states.name
click_link new_york.name
expect(page).to_not have_css("#budget_investment_#{investment.id}")
end
@@ -481,7 +483,9 @@ feature 'Ballots' do
investment = create(:budget_investment, feasibility: "undecided", heading: new_york)
login_as(user)
visit budget_investments_path(budget, heading_id: new_york.id)
visit budget_path(budget)
click_link states.name
click_link new_york.name
within("#budget-investments") do
expect(page).to_not have_css("div.ballot")

View File

@@ -8,10 +8,14 @@ feature 'Budget Investments' do
let!(:heading) { create(:budget_heading, name: "More hospitals", group: group) }
scenario 'Index' do
investments = [create(:budget_investment, heading: heading), create(:budget_investment, heading: heading), create(:budget_investment, :feasible, heading: heading)]
investments = [create(:budget_investment, heading: heading),
create(:budget_investment, heading: heading),
create(:budget_investment, :feasible, heading: heading)]
unfeasible_investment = create(:budget_investment, :unfeasible, heading: heading)
visit budget_investments_path(budget, heading_id: heading.id)
visit budget_path(budget)
click_link "Health"
expect(page).to have_selector('#budget-investments .budget-investment', count: 3)
investments.each do |investment|
@@ -56,7 +60,7 @@ feature 'Budget Investments' do
investment3 = create(:budget_investment, heading: heading)
investment4 = create(:budget_investment, :feasible, heading: heading)
visit budget_investments_path(budget_id: budget.id, heading_id: heading.id, unfeasible: 1)
visit budget_investments_path(budget_id: budget.id, heading_id: heading.id, filter: "unfeasible")
within("#budget-investments") do
expect(page).to have_css('.budget-investment', count: 1)
@@ -77,7 +81,7 @@ feature 'Budget Investments' do
click_link "All City"
expected_path = budget_investments_path(budget, heading_id: heading.id, unfeasible: 1)
expected_path = budget_investments_path(budget, heading_id: heading.id, filter: "unfeasible")
expect(page).to have_current_path(expected_path)
end
@@ -93,7 +97,7 @@ feature 'Budget Investments' do
click_link 'Districts'
click_link 'Carabanchel'
expected_path = budget_investments_path(budget, heading_id: heading1.id, unfeasible: 1)
expected_path = budget_investments_path(budget, heading_id: heading1.id, filter: "unfeasible")
expect(page).to have_current_path(expected_path)
end
end
@@ -516,8 +520,6 @@ feature 'Budget Investments' do
expect(page).to have_content "€10,000"
end
scenario "Sidebar in show should display vote text" do
investment = create(:budget_investment, :selected, budget: budget)
visit budget_investment_path(budget, investment)
@@ -537,7 +539,6 @@ feature 'Budget Investments' do
carabanchel_heading = create(:budget_heading, group: group, name: "Carabanchel")
new_york_heading = create(:budget_heading, group: group, name: "New York")
sp1 = create(:budget_investment, :selected, price: 1, heading: global_heading)
sp2 = create(:budget_investment, :selected, price: 10, heading: global_heading)
sp3 = create(:budget_investment, :selected, price: 100, heading: global_heading)
@@ -602,5 +603,52 @@ feature 'Budget Investments' do
end
end
scenario 'Show unselected budget investments' do
investment1 = create(:budget_investment, :unselected, :feasible, heading: heading, valuation_finished: true)
investment2 = create(:budget_investment, :selected, :feasible, heading: heading, valuation_finished: true)
investment3 = create(:budget_investment, :selected, :feasible, heading: heading, valuation_finished: true)
investment4 = create(:budget_investment, :selected, :feasible, heading: heading, valuation_finished: true)
visit budget_investments_path(budget_id: budget.id, heading_id: heading.id, filter: "unselected")
within("#budget-investments") do
expect(page).to have_css('.budget-investment', count: 1)
expect(page).to have_content(investment1.title)
expect(page).to_not have_content(investment2.title)
expect(page).to_not have_content(investment3.title)
expect(page).to_not have_content(investment4.title)
end
end
scenario "Shows unselected link for group with one heading" do
group = create(:budget_group, name: 'All City', budget: budget)
heading = create(:budget_heading, name: "Madrid", group: group)
visit budget_path(budget)
click_link 'See investments not selected for balloting phase'
click_link "All City"
expected_path = budget_investments_path(budget, heading_id: heading.id, filter: "unselected")
expect(page).to have_current_path(expected_path)
end
scenario "Shows unselected link for group with many headings" do
group = create(:budget_group, name: 'Districts', budget: budget)
heading1 = create(:budget_heading, name: 'Carabanchel', group: group)
heading2 = create(:budget_heading, name: 'Barajas', group: group)
visit budget_path(budget)
click_link 'See investments not selected for balloting phase'
click_link 'Districts'
click_link 'Carabanchel'
expected_path = budget_investments_path(budget, heading_id: heading1.id, filter: "unselected")
expect(page).to have_current_path(expected_path)
end
end
end

View File

@@ -199,11 +199,12 @@ feature 'Tags' do
if budget.balloting?
[investment1, investment2, investment3].each do |investment|
investment.update(selected: true)
investment.update(selected: true, feasibility: "feasible")
end
end
visit budget_investments_path(budget, heading_id: heading.id)
visit budget_path(budget)
click_link group.name
within "#tag-cloud" do
click_link "Medio Ambiente"
@@ -246,11 +247,12 @@ feature 'Tags' do
if budget.balloting?
[investment1, investment2, investment3].each do |investment|
investment.update(selected: true)
investment.update(selected: true, feasibility: "feasible")
end
end
visit budget_investments_path(budget, heading_id: heading.id, search: 'Economía')
visit budget_path(budget)
click_link group.name
within "#categories" do
click_link "Medio Ambiente"