Display only current budget to Managers printing investments
In the specs, some investment were missing a heading_id, thus creating another unexpected budget By explicitly setting the heading_id we can control better which budgets are created in each test
This commit is contained in:
@@ -259,9 +259,10 @@ feature 'Budget Investments' do
|
||||
context "Printing" do
|
||||
|
||||
scenario 'Printing budget investments' do
|
||||
16.times { create(:budget_investment, budget: @budget) }
|
||||
16.times { create(:budget_investment, budget: @budget, heading: @heading) }
|
||||
|
||||
click_link "Print Budget Investments"
|
||||
|
||||
expect(page).to have_content(@budget.name)
|
||||
within "#budget_#{@budget.id}" do
|
||||
click_link "Print Budget Investments"
|
||||
@@ -273,15 +274,17 @@ feature 'Budget Investments' do
|
||||
|
||||
scenario "Filtering budget investments by heading to be printed", :js do
|
||||
district_9 = create(:budget_heading, group: @group, name: "District Nine")
|
||||
another_heading = create(:budget_heading, group: @group)
|
||||
low_investment = create(:budget_investment, budget: @budget, title: 'Nuke district 9', heading: district_9, cached_votes_up: 1)
|
||||
mid_investment = create(:budget_investment, budget: @budget, title: 'Change district 9', heading: district_9, cached_votes_up: 10)
|
||||
top_investment = create(:budget_investment, budget: @budget, title: 'Destroy district 9', heading: district_9, cached_votes_up: 100)
|
||||
unvoted_investment = create(:budget_investment, budget: @budget, title: 'Add new districts to the city')
|
||||
unvoted_investment = create(:budget_investment, budget: @budget, heading: another_heading, title: 'Add new districts to the city')
|
||||
|
||||
user = create(:user, :level_two)
|
||||
login_managed_user(user)
|
||||
|
||||
click_link "Print Budget Investments"
|
||||
|
||||
expect(page).to have_content(@budget.name)
|
||||
within "#budget_#{@budget.id}" do
|
||||
click_link "Print Budget Investments"
|
||||
|
||||
Reference in New Issue
Block a user