Fixes budget_helper issues
This commit is contained in:
@@ -11,13 +11,11 @@ module BudgetHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def namespaced_budget_investment_path(investment, options={})
|
def namespaced_budget_investment_path(investment, options={})
|
||||||
@namespaced_budget_investment_path ||= namespace
|
case namespace
|
||||||
options[:budget_id] ||= investment.budget.id
|
when "management::budgets"
|
||||||
case @namespace_budget_investment_path
|
|
||||||
when "management"
|
|
||||||
management_budgets_investment_path(investment, options)
|
management_budgets_investment_path(investment, options)
|
||||||
else
|
else
|
||||||
budget_investment_path(investment, options)
|
budget_investment_path(investment, options.merge(budget_id: investment.budget_id))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ feature 'Budget Investments' do
|
|||||||
expect(page).to have_content user.name
|
expect(page).to have_content user.name
|
||||||
expect(page).to have_content I18n.l(Budget::Investment.last.created_at.to_date)
|
expect(page).to have_content I18n.l(Budget::Investment.last.created_at.to_date)
|
||||||
|
|
||||||
expect(current_path).to eq(management_budget_investment_path(Budget::Investment.last))
|
expect(current_path).to eq(management_budgets_investment_path(Budget::Investment.last))
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Should not allow unverified users to create budget investments" do
|
scenario "Should not allow unverified users to create budget investments" do
|
||||||
@@ -65,19 +65,19 @@ feature 'Budget Investments' do
|
|||||||
user = create(:user, :level_two)
|
user = create(:user, :level_two)
|
||||||
login_managed_user(user)
|
login_managed_user(user)
|
||||||
|
|
||||||
click_link "Support budget investments"
|
click_link "Support Budget Investments"
|
||||||
|
|
||||||
fill_in "search", with: "what you got"
|
fill_in "search", with: "what you got"
|
||||||
click_button "Search"
|
click_button "Search"
|
||||||
|
|
||||||
expect(current_path).to eq(management_budget_investments_path)
|
expect(current_path).to eq(management_budgets_investments_path)
|
||||||
|
|
||||||
within("#investment-projects") do
|
within("#budget-investments") do
|
||||||
expect(page).to have_css('.investment-project', count: 1)
|
expect(page).to have_css('.budget-investment', count: 1)
|
||||||
expect(page).to have_content(budget_investment1.title)
|
expect(page).to have_content(budget_investment1.title)
|
||||||
expect(page).to_not have_content(budget_investment2.title)
|
expect(page).to_not have_content(budget_investment2.title)
|
||||||
expect(page).to have_css("a[href='#{management_budget_investment_path(budget_investment1)}']", text: budget_investment1.title)
|
expect(page).to have_css("a[href='#{management_budgets_investment_path(budget_investment1)}']", text: budget_investment1.title)
|
||||||
expect(page).to have_css("a[href='#{management_budget_investment_path(budget_investment1)}']", text: budget_investment1.description)
|
expect(page).to have_css("a[href='#{management_budgets_investment_path(budget_investment1)}']", text: budget_investment1.description)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -93,14 +93,14 @@ feature 'Budget Investments' do
|
|||||||
fill_in "search", with: "Area 52"
|
fill_in "search", with: "Area 52"
|
||||||
click_button "Search"
|
click_button "Search"
|
||||||
|
|
||||||
expect(current_path).to eq(management_budget_investments_path)
|
expect(current_path).to eq(management_budgets_investments_path)
|
||||||
|
|
||||||
within("#investment-projects") do
|
within("#budget-investments") do
|
||||||
expect(page).to have_css('.investment-project', count: 1)
|
expect(page).to have_css('.budget-investment', count: 1)
|
||||||
expect(page).to_not have_content(budget_investment1.title)
|
expect(page).to_not have_content(budget_investment1.title)
|
||||||
expect(page).to have_content(budget_investment2.title)
|
expect(page).to have_content(budget_investment2.title)
|
||||||
expect(page).to have_css("a[href='#{management_budget_investment_path(budget_investment2)}']", text: budget_investment2.title)
|
expect(page).to have_css("a[href='#{management_budgets_investment_path(budget_investment2)}']", text: budget_investment2.title)
|
||||||
expect(page).to have_css("a[href='#{management_budget_investment_path(budget_investment2)}']", text: budget_investment2.description)
|
expect(page).to have_css("a[href='#{management_budgets_investment_path(budget_investment2)}']", text: budget_investment2.description)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -114,7 +114,7 @@ feature 'Budget Investments' do
|
|||||||
|
|
||||||
click_link "Support budget investments"
|
click_link "Support budget investments"
|
||||||
|
|
||||||
expect(current_path).to eq(management_budget_investments_path)
|
expect(current_path).to eq(management_budgets_investments_path)
|
||||||
|
|
||||||
within(".account-info") do
|
within(".account-info") do
|
||||||
expect(page).to have_content "Identified as"
|
expect(page).to have_content "Identified as"
|
||||||
@@ -123,12 +123,12 @@ feature 'Budget Investments' do
|
|||||||
expect(page).to have_content "#{user.document_number}"
|
expect(page).to have_content "#{user.document_number}"
|
||||||
end
|
end
|
||||||
|
|
||||||
within("#investment-projects") do
|
within("#budget-investments") do
|
||||||
expect(page).to have_css('.investment-project', count: 2)
|
expect(page).to have_css('.budget-investment', count: 2)
|
||||||
expect(page).to have_css("a[href='#{management_budget_investment_path(budget_investment1)}']", text: budget_investment1.title)
|
expect(page).to have_css("a[href='#{management_budgets_investment_path(budget_investment1)}']", text: budget_investment1.title)
|
||||||
expect(page).to have_css("a[href='#{management_budget_investment_path(budget_investment1)}']", text: budget_investment1.description)
|
expect(page).to have_css("a[href='#{management_budgets_investment_path(budget_investment1)}']", text: budget_investment1.description)
|
||||||
expect(page).to have_css("a[href='#{management_budget_investment_path(budget_investment2)}']", text: budget_investment2.title)
|
expect(page).to have_css("a[href='#{management_budgets_investment_path(budget_investment2)}']", text: budget_investment2.title)
|
||||||
expect(page).to have_css("a[href='#{management_budget_investment_path(budget_investment2)}']", text: budget_investment2.description)
|
expect(page).to have_css("a[href='#{management_budgets_investment_path(budget_investment2)}']", text: budget_investment2.description)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -142,13 +142,13 @@ feature 'Budget Investments' do
|
|||||||
|
|
||||||
click_link "Support budget investments"
|
click_link "Support budget investments"
|
||||||
|
|
||||||
within("#investment-projects") do
|
within("#budget-investments") do
|
||||||
find('.in-favor a').click
|
find('.in-favor a').click
|
||||||
|
|
||||||
expect(page).to have_content "1 support"
|
expect(page).to have_content "1 support"
|
||||||
expect(page).to have_content "You have already supported this. Share it!"
|
expect(page).to have_content "You have already supported this. Share it!"
|
||||||
end
|
end
|
||||||
expect(current_path).to eq(management_budget_investments_path)
|
expect(current_path).to eq(management_budgets_investments_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Voting budget investments on behalf of someone in show view', :js do
|
scenario 'Voting budget investments on behalf of someone in show view', :js do
|
||||||
@@ -159,14 +159,14 @@ feature 'Budget Investments' do
|
|||||||
|
|
||||||
click_link "Support budget investments"
|
click_link "Support budget investments"
|
||||||
|
|
||||||
within("#investment-projects") do
|
within("#budget-investments") do
|
||||||
click_link budget_investment.title
|
click_link budget_investment.title
|
||||||
end
|
end
|
||||||
|
|
||||||
find('.in-favor a').click
|
find('.in-favor a').click
|
||||||
expect(page).to have_content "1 support"
|
expect(page).to have_content "1 support"
|
||||||
expect(page).to have_content "You have already supported this. Share it!"
|
expect(page).to have_content "You have already supported this. Share it!"
|
||||||
expect(current_path).to eq(management_budget_investment_path(budget_investment))
|
expect(current_path).to eq(management_budgets_investment_path(budget_investment))
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Should not allow unverified users to vote proposals" do
|
scenario "Should not allow unverified users to vote proposals" do
|
||||||
@@ -188,7 +188,7 @@ feature 'Budget Investments' do
|
|||||||
|
|
||||||
click_link "Print budget investments"
|
click_link "Print budget investments"
|
||||||
|
|
||||||
expect(page).to have_css('.investment-project', count: 15)
|
expect(page).to have_css('.budget-investment', count: 15)
|
||||||
expect(page).to have_css("a[href='javascript:window.print();']", text: 'Print')
|
expect(page).to have_css("a[href='javascript:window.print();']", text: 'Print')
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@ feature 'Budget Investments' do
|
|||||||
|
|
||||||
expect(page).to have_content "Budget investments with scope: All city"
|
expect(page).to have_content "Budget investments with scope: All city"
|
||||||
|
|
||||||
within '#investment-projects' do
|
within '#budget-investments' do
|
||||||
expect(page).to have_content('Add new districts to the city')
|
expect(page).to have_content('Add new districts to the city')
|
||||||
expect(page).to_not have_content('Change district 9')
|
expect(page).to_not have_content('Change district 9')
|
||||||
expect(page).to_not have_content('Destroy district 9')
|
expect(page).to_not have_content('Destroy district 9')
|
||||||
@@ -218,7 +218,7 @@ feature 'Budget Investments' do
|
|||||||
expect(page).to have_content "Investment projects with scope: District Nine"
|
expect(page).to have_content "Investment projects with scope: District Nine"
|
||||||
expect(current_url).to include("geozone=#{district_9.id}")
|
expect(current_url).to include("geozone=#{district_9.id}")
|
||||||
|
|
||||||
within '#investment-projects' do
|
within '#budget-investments' do
|
||||||
expect(page).to_not have_content('Add new districts to the city')
|
expect(page).to_not have_content('Add new districts to the city')
|
||||||
expect('Destroy district 9').to appear_before('Change district 9')
|
expect('Destroy district 9').to appear_before('Change district 9')
|
||||||
expect('Change district 9').to appear_before('Nuke district 9')
|
expect('Change district 9').to appear_before('Nuke district 9')
|
||||||
|
|||||||
Reference in New Issue
Block a user