Load budgets using slugs
This commit is contained in:
@@ -6,6 +6,7 @@ class Admin::BudgetsController < Admin::BaseController
|
|||||||
|
|
||||||
has_filters %w{open finished}, only: :index
|
has_filters %w{open finished}, only: :index
|
||||||
|
|
||||||
|
before_action :load_budget
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@@ -66,4 +67,8 @@ class Admin::BudgetsController < Admin::BaseController
|
|||||||
params.require(:budget).permit(*valid_attributes, *report_attributes, translation_params(Budget))
|
params.require(:budget).permit(*valid_attributes, *report_attributes, translation_params(Budget))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def load_budget
|
||||||
|
@budget = Budget.find_by(slug: params[:id]) || Budget.find_by(id: params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ module Budgets
|
|||||||
end
|
end
|
||||||
|
|
||||||
def load_budget
|
def load_budget
|
||||||
@budget = Budget.find(params[:budget_id])
|
@budget = Budget.find_by(slug: params[:budget_id]) || Budget.find_by(id: params[:budget_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_ballot
|
def load_ballot
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
module Budgets
|
module Budgets
|
||||||
class BallotsController < ApplicationController
|
class BallotsController < ApplicationController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
|
before_action :load_budget
|
||||||
load_and_authorize_resource :budget
|
load_and_authorize_resource :budget
|
||||||
before_action :load_ballot
|
before_action :load_ballot
|
||||||
after_action :store_referer, only: [:show]
|
after_action :store_referer, only: [:show]
|
||||||
@@ -13,6 +14,10 @@ module Budgets
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def load_budget
|
||||||
|
@budget = Budget.find_by(slug: params[:budget_id]) || Budget.find_by(id: params[:budget_id])
|
||||||
|
end
|
||||||
|
|
||||||
def load_ballot
|
def load_ballot
|
||||||
query = Budget::Ballot.where(user: current_user, budget: @budget)
|
query = Budget::Ballot.where(user: current_user, budget: @budget)
|
||||||
@ballot = @budget.balloting? ? query.first_or_create : query.first_or_initialize
|
@ballot = @budget.balloting? ? query.first_or_create : query.first_or_initialize
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
module Budgets
|
module Budgets
|
||||||
class GroupsController < ApplicationController
|
class GroupsController < ApplicationController
|
||||||
|
before_action :load_budget
|
||||||
|
before_action :load_group
|
||||||
load_and_authorize_resource :budget
|
load_and_authorize_resource :budget
|
||||||
load_and_authorize_resource :group, class: "Budget::Group"
|
load_and_authorize_resource :group, class: "Budget::Group"
|
||||||
|
|
||||||
@@ -9,5 +11,14 @@ module Budgets
|
|||||||
def show
|
def show
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def load_budget
|
||||||
|
@budget = Budget.find_by(slug: params[:budget_id]) || Budget.find_by(id: params[:budget_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def load_group
|
||||||
|
@group = Budget::Group.find_by(slug: params[:id]) || Budget.find_by(id: params[:id])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -10,6 +10,7 @@ module Budgets
|
|||||||
PER_PAGE = 10
|
PER_PAGE = 10
|
||||||
|
|
||||||
before_action :authenticate_user!, except: [:index, :show, :json_data]
|
before_action :authenticate_user!, except: [:index, :show, :json_data]
|
||||||
|
before_action :load_budget, except: :json_data
|
||||||
|
|
||||||
load_and_authorize_resource :budget, except: :json_data
|
load_and_authorize_resource :budget, except: :json_data
|
||||||
load_and_authorize_resource :investment, through: :budget, class: "Budget::Investment",
|
load_and_authorize_resource :investment, through: :budget, class: "Budget::Investment",
|
||||||
@@ -136,7 +137,7 @@ module Budgets
|
|||||||
|
|
||||||
def load_heading
|
def load_heading
|
||||||
if params[:heading_id].present?
|
if params[:heading_id].present?
|
||||||
@heading = @budget.headings.find(params[:heading_id])
|
@heading = @budget.headings.find_by(slug: params[:heading_id]) || @budget.headings.find_by(id: params[:heading_id])
|
||||||
@assigned_heading = @ballot.try(:heading_for_group, @heading.try(:group))
|
@assigned_heading = @ballot.try(:heading_for_group, @heading.try(:group))
|
||||||
load_map
|
load_map
|
||||||
end
|
end
|
||||||
@@ -154,6 +155,10 @@ module Budgets
|
|||||||
TagCloud.new(Budget::Investment, params[:search])
|
TagCloud.new(Budget::Investment, params[:search])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def load_budget
|
||||||
|
@budget = Budget.find_by(slug: params[:budget_id]) || Budget.find_by(id: params[:budget_id])
|
||||||
|
end
|
||||||
|
|
||||||
def set_view
|
def set_view
|
||||||
@view = (params[:view] == "minimal") ? "minimal" : "default"
|
@view = (params[:view] == "minimal") ? "minimal" : "default"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ class BudgetsController < ApplicationController
|
|||||||
include BudgetsHelper
|
include BudgetsHelper
|
||||||
feature_flag :budgets
|
feature_flag :budgets
|
||||||
|
|
||||||
|
before_action :load_budget, only: :show
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
before_action :set_default_budget_filter, only: :show
|
before_action :set_default_budget_filter, only: :show
|
||||||
has_filters %w[not_unfeasible feasible unfeasible unselected selected winners], only: :show
|
has_filters %w[not_unfeasible feasible unfeasible unselected selected winners], only: :show
|
||||||
@@ -19,4 +20,10 @@ class BudgetsController < ApplicationController
|
|||||||
@banners = Banner.in_section("budgets").with_active
|
@banners = Banner.in_section("budgets").with_active
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def load_budget
|
||||||
|
@budget = Budget.find_by(slug: params[:id]) || Budget.find_by(id: params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
class Management::Budgets::InvestmentsController < Management::BaseController
|
class Management::Budgets::InvestmentsController < Management::BaseController
|
||||||
|
before_action :load_budget
|
||||||
|
|
||||||
load_resource :budget
|
load_resource :budget
|
||||||
load_resource :investment, through: :budget, class: "Budget::Investment"
|
load_resource :investment, through: :budget, class: "Budget::Investment"
|
||||||
@@ -60,6 +61,10 @@ class Management::Budgets::InvestmentsController < Management::BaseController
|
|||||||
check_verified_user t("management.budget_investments.alert.unverified_user")
|
check_verified_user t("management.budget_investments.alert.unverified_user")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def load_budget
|
||||||
|
@budget = Budget.find_by(slug: params[:budget_id]) || Budget.find_by(id: params[:budget_id])
|
||||||
|
end
|
||||||
|
|
||||||
def load_categories
|
def load_categories
|
||||||
@categories = ActsAsTaggableOn::Tag.category.order(:name)
|
@categories = ActsAsTaggableOn::Tag.category.order(:name)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def load_budget
|
def load_budget
|
||||||
@budget = Budget.find(params[:budget_id])
|
@budget = Budget.find_by(slug: params[:budget_id]) || Budget.find_by(id: params[:budget_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_investment
|
def load_investment
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ describe "Budget Investments" do
|
|||||||
investments.each do |investment|
|
investments.each do |investment|
|
||||||
within("#budget-investments") do
|
within("#budget-investments") do
|
||||||
expect(page).to have_content investment.title
|
expect(page).to have_content investment.title
|
||||||
expect(page).to have_css("a[href='#{budget_investment_path(budget_id: budget.id, id: investment.id)}']", text: investment.title)
|
expect(page).to have_css("a[href='#{budget_investment_path(budget, id: investment.id)}']", text: investment.title)
|
||||||
expect(page).not_to have_content(unfeasible_investment.title)
|
expect(page).not_to have_content(unfeasible_investment.title)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -476,7 +476,7 @@ describe "Budget Investments" do
|
|||||||
investment3 = create(:budget_investment, heading: heading)
|
investment3 = create(:budget_investment, heading: heading)
|
||||||
investment4 = create(:budget_investment, :feasible, heading: heading)
|
investment4 = create(:budget_investment, :feasible, heading: heading)
|
||||||
|
|
||||||
visit budget_investments_path(budget_id: budget.id, heading_id: heading.id, filter: "unfeasible")
|
visit budget_investments_path(budget, heading_id: heading.id, filter: "unfeasible")
|
||||||
|
|
||||||
within("#budget-investments") do
|
within("#budget-investments") do
|
||||||
expect(page).to have_css(".budget-investment", count: 1)
|
expect(page).to have_css(".budget-investment", count: 1)
|
||||||
@@ -810,7 +810,7 @@ describe "Budget Investments" do
|
|||||||
|
|
||||||
scenario "Create with invisible_captcha honeypot field" do
|
scenario "Create with invisible_captcha honeypot field" do
|
||||||
login_as(author)
|
login_as(author)
|
||||||
visit new_budget_investment_path(budget_id: budget.id)
|
visit new_budget_investment_path(budget)
|
||||||
|
|
||||||
select heading.name, from: "budget_investment_heading_id"
|
select heading.name, from: "budget_investment_heading_id"
|
||||||
fill_in "budget_investment_title", with: "I am a bot"
|
fill_in "budget_investment_title", with: "I am a bot"
|
||||||
@@ -822,14 +822,14 @@ describe "Budget Investments" do
|
|||||||
|
|
||||||
expect(page.status_code).to eq(200)
|
expect(page.status_code).to eq(200)
|
||||||
expect(page.html).to be_empty
|
expect(page.html).to be_empty
|
||||||
expect(page).to have_current_path(budget_investments_path(budget_id: budget.id))
|
expect(page).to have_current_path(budget_investments_path(budget))
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Create budget investment too fast" do
|
scenario "Create budget investment too fast" do
|
||||||
allow(InvisibleCaptcha).to receive(:timestamp_threshold).and_return(Float::INFINITY)
|
allow(InvisibleCaptcha).to receive(:timestamp_threshold).and_return(Float::INFINITY)
|
||||||
|
|
||||||
login_as(author)
|
login_as(author)
|
||||||
visit new_budget_investment_path(budget_id: budget.id)
|
visit new_budget_investment_path(budget)
|
||||||
|
|
||||||
select heading.name, from: "budget_investment_heading_id"
|
select heading.name, from: "budget_investment_heading_id"
|
||||||
fill_in "budget_investment_title", with: "I am a bot"
|
fill_in "budget_investment_title", with: "I am a bot"
|
||||||
@@ -839,13 +839,13 @@ describe "Budget Investments" do
|
|||||||
click_button "Create Investment"
|
click_button "Create Investment"
|
||||||
|
|
||||||
expect(page).to have_content "Sorry, that was too quick! Please resubmit"
|
expect(page).to have_content "Sorry, that was too quick! Please resubmit"
|
||||||
expect(page).to have_current_path(new_budget_investment_path(budget_id: budget.id))
|
expect(page).to have_current_path(new_budget_investment_path(budget))
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Create" do
|
scenario "Create" do
|
||||||
login_as(author)
|
login_as(author)
|
||||||
|
|
||||||
visit new_budget_investment_path(budget_id: budget.id)
|
visit new_budget_investment_path(budget)
|
||||||
|
|
||||||
select heading.name, from: "budget_investment_heading_id"
|
select heading.name, from: "budget_investment_heading_id"
|
||||||
fill_in "budget_investment_title", with: "Build a skyscraper"
|
fill_in "budget_investment_title", with: "Build a skyscraper"
|
||||||
@@ -872,7 +872,7 @@ describe "Budget Investments" do
|
|||||||
scenario "Errors on create" do
|
scenario "Errors on create" do
|
||||||
login_as(author)
|
login_as(author)
|
||||||
|
|
||||||
visit new_budget_investment_path(budget_id: budget.id)
|
visit new_budget_investment_path(budget)
|
||||||
click_button "Create Investment"
|
click_button "Create Investment"
|
||||||
expect(page).to have_content error_message
|
expect(page).to have_content error_message
|
||||||
end
|
end
|
||||||
@@ -948,7 +948,7 @@ describe "Budget Investments" do
|
|||||||
|
|
||||||
login_as(author)
|
login_as(author)
|
||||||
|
|
||||||
visit new_budget_investment_path(budget_id: budget.id)
|
visit new_budget_investment_path(budget)
|
||||||
|
|
||||||
select_options = find("#budget_investment_heading_id").all("option").collect(&:text)
|
select_options = find("#budget_investment_heading_id").all("option").collect(&:text)
|
||||||
expect(select_options.first).to eq("")
|
expect(select_options.first).to eq("")
|
||||||
@@ -964,7 +964,7 @@ describe "Budget Investments" do
|
|||||||
|
|
||||||
investment = create(:budget_investment, heading: heading)
|
investment = create(:budget_investment, heading: heading)
|
||||||
|
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget, id: investment.id)
|
||||||
|
|
||||||
expect(page).to have_content(investment.title)
|
expect(page).to have_content(investment.title)
|
||||||
expect(page).to have_content(investment.description)
|
expect(page).to have_content(investment.description)
|
||||||
@@ -984,7 +984,7 @@ describe "Budget Investments" do
|
|||||||
scenario "Price & explanation is shown when Budget is on published prices phase" do
|
scenario "Price & explanation is shown when Budget is on published prices phase" do
|
||||||
Budget::Phase::PUBLISHED_PRICES_PHASES.each do |phase|
|
Budget::Phase::PUBLISHED_PRICES_PHASES.each do |phase|
|
||||||
budget.update(phase: phase)
|
budget.update(phase: phase)
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget, id: investment.id)
|
||||||
|
|
||||||
expect(page).to have_content(investment.formatted_price)
|
expect(page).to have_content(investment.formatted_price)
|
||||||
expect(page).to have_content(investment.price_explanation)
|
expect(page).to have_content(investment.price_explanation)
|
||||||
@@ -1003,7 +1003,7 @@ describe "Budget Investments" do
|
|||||||
scenario "Price & explanation isn't shown when Budget is not on published prices phase" do
|
scenario "Price & explanation isn't shown when Budget is not on published prices phase" do
|
||||||
(Budget::Phase::PHASE_KINDS - Budget::Phase::PUBLISHED_PRICES_PHASES).each do |phase|
|
(Budget::Phase::PHASE_KINDS - Budget::Phase::PUBLISHED_PRICES_PHASES).each do |phase|
|
||||||
budget.update(phase: phase)
|
budget.update(phase: phase)
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget, id: investment.id)
|
||||||
|
|
||||||
expect(page).not_to have_content(investment.formatted_price)
|
expect(page).not_to have_content(investment.formatted_price)
|
||||||
expect(page).not_to have_content(investment.price_explanation)
|
expect(page).not_to have_content(investment.price_explanation)
|
||||||
@@ -1025,7 +1025,7 @@ describe "Budget Investments" do
|
|||||||
scenario "Price & explanation isn't shown for any Budget's phase" do
|
scenario "Price & explanation isn't shown for any Budget's phase" do
|
||||||
Budget::Phase::PHASE_KINDS.each do |phase|
|
Budget::Phase::PHASE_KINDS.each do |phase|
|
||||||
budget.update(phase: phase)
|
budget.update(phase: phase)
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget, id: investment.id)
|
||||||
|
|
||||||
expect(page).not_to have_content(investment.formatted_price)
|
expect(page).not_to have_content(investment.formatted_price)
|
||||||
expect(page).not_to have_content(investment.price_explanation)
|
expect(page).not_to have_content(investment.price_explanation)
|
||||||
@@ -1044,7 +1044,7 @@ describe "Budget Investments" do
|
|||||||
Setting["feature.community"] = true
|
Setting["feature.community"] = true
|
||||||
|
|
||||||
investment = create(:budget_investment, heading: heading)
|
investment = create(:budget_investment, heading: heading)
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget, id: investment.id)
|
||||||
expect(page).to have_content "Access the community"
|
expect(page).to have_content "Access the community"
|
||||||
|
|
||||||
Setting["feature.community"] = false
|
Setting["feature.community"] = false
|
||||||
@@ -1054,14 +1054,14 @@ describe "Budget Investments" do
|
|||||||
Setting["feature.community"] = false
|
Setting["feature.community"] = false
|
||||||
|
|
||||||
investment = create(:budget_investment, heading: heading)
|
investment = create(:budget_investment, heading: heading)
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget, id: investment.id)
|
||||||
expect(page).not_to have_content "Access the community"
|
expect(page).not_to have_content "Access the community"
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Don't display flaggable buttons" do
|
scenario "Don't display flaggable buttons" do
|
||||||
investment = create(:budget_investment, heading: heading)
|
investment = create(:budget_investment, heading: heading)
|
||||||
|
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget, id: investment.id)
|
||||||
|
|
||||||
expect(page).not_to have_selector ".js-follow"
|
expect(page).not_to have_selector ".js-follow"
|
||||||
end
|
end
|
||||||
@@ -1092,7 +1092,7 @@ describe "Budget Investments" do
|
|||||||
|
|
||||||
scenario "Budget in selecting phase" do
|
scenario "Budget in selecting phase" do
|
||||||
budget.update(phase: "selecting")
|
budget.update(phase: "selecting")
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget, id: investment.id)
|
||||||
|
|
||||||
expect(page).not_to have_content("Unfeasibility explanation")
|
expect(page).not_to have_content("Unfeasibility explanation")
|
||||||
expect(page).not_to have_content("Price explanation")
|
expect(page).not_to have_content("Price explanation")
|
||||||
@@ -1120,14 +1120,14 @@ describe "Budget Investments" do
|
|||||||
heading: heading,
|
heading: heading,
|
||||||
unfeasibility_explanation: "The unfeasible explanation")
|
unfeasibility_explanation: "The unfeasible explanation")
|
||||||
|
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget, id: investment.id)
|
||||||
|
|
||||||
expect(page).not_to have_content("Unfeasibility explanation")
|
expect(page).not_to have_content("Unfeasibility explanation")
|
||||||
expect(page).not_to have_content("Local government is not competent in this")
|
expect(page).not_to have_content("Local government is not competent in this")
|
||||||
expect(page).not_to have_content("This investment project has been marked as not feasible "\
|
expect(page).not_to have_content("This investment project has been marked as not feasible "\
|
||||||
"and will not go to balloting phase")
|
"and will not go to balloting phase")
|
||||||
|
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment_2.id)
|
visit budget_investment_path(budget, id: investment_2.id)
|
||||||
|
|
||||||
expect(page).to have_content("Unfeasibility explanation")
|
expect(page).to have_content("Unfeasibility explanation")
|
||||||
expect(page).to have_content("The unfeasible explanation")
|
expect(page).to have_content("The unfeasible explanation")
|
||||||
@@ -1147,7 +1147,7 @@ describe "Budget Investments" do
|
|||||||
group: group,
|
group: group,
|
||||||
heading: heading)
|
heading: heading)
|
||||||
|
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget, id: investment.id)
|
||||||
|
|
||||||
expect(page).to have_content("This investment project has been selected for balloting phase")
|
expect(page).to have_content("This investment project has been selected for balloting phase")
|
||||||
end
|
end
|
||||||
@@ -1166,13 +1166,13 @@ describe "Budget Investments" do
|
|||||||
group: group,
|
group: group,
|
||||||
heading: heading)
|
heading: heading)
|
||||||
|
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget, id: investment.id)
|
||||||
|
|
||||||
expect(page).not_to have_content("Winning investment project")
|
expect(page).not_to have_content("Winning investment project")
|
||||||
|
|
||||||
budget.update(phase: "finished")
|
budget.update(phase: "finished")
|
||||||
|
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget, id: investment.id)
|
||||||
|
|
||||||
expect(page).to have_content("Winning investment project")
|
expect(page).to have_content("Winning investment project")
|
||||||
end
|
end
|
||||||
@@ -1189,7 +1189,7 @@ describe "Budget Investments" do
|
|||||||
group: group,
|
group: group,
|
||||||
heading: heading)
|
heading: heading)
|
||||||
|
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget, id: investment.id)
|
||||||
|
|
||||||
expect(page).to have_content("This investment project has not been selected for balloting phase")
|
expect(page).to have_content("This investment project has not been selected for balloting phase")
|
||||||
end
|
end
|
||||||
@@ -1205,7 +1205,7 @@ describe "Budget Investments" do
|
|||||||
group: group,
|
group: group,
|
||||||
heading: heading)
|
heading: heading)
|
||||||
|
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget, id: investment.id)
|
||||||
|
|
||||||
within("aside") do
|
within("aside") do
|
||||||
expect(page).to have_content("Investment project")
|
expect(page).to have_content("Investment project")
|
||||||
@@ -1225,7 +1225,7 @@ describe "Budget Investments" do
|
|||||||
heading: heading,
|
heading: heading,
|
||||||
unfeasibility_explanation: "Local government is not competent in this matter")
|
unfeasibility_explanation: "Local government is not competent in this matter")
|
||||||
|
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget, id: investment.id)
|
||||||
|
|
||||||
expect(page).not_to have_content("Unfeasibility explanation")
|
expect(page).not_to have_content("Unfeasibility explanation")
|
||||||
expect(page).not_to have_content("Local government is not competent in this matter")
|
expect(page).not_to have_content("Local government is not competent in this matter")
|
||||||
@@ -1243,7 +1243,7 @@ describe "Budget Investments" do
|
|||||||
heading: heading,
|
heading: heading,
|
||||||
unfeasibility_explanation: "Local government is not competent in this matter")
|
unfeasibility_explanation: "Local government is not competent in this matter")
|
||||||
|
|
||||||
visit budget_investment_path(budget_id: budget.id, id: investment.id)
|
visit budget_investment_path(budget, id: investment.id)
|
||||||
|
|
||||||
expect(page).not_to have_content("Unfeasibility explanation")
|
expect(page).not_to have_content("Unfeasibility explanation")
|
||||||
expect(page).not_to have_content("Local government is not competent in this matter")
|
expect(page).not_to have_content("Local government is not competent in this matter")
|
||||||
@@ -1647,7 +1647,7 @@ describe "Budget Investments" do
|
|||||||
investment3 = 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)
|
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")
|
visit budget_investments_path(budget, heading_id: heading.id, filter: "unselected")
|
||||||
|
|
||||||
within("#budget-investments") do
|
within("#budget-investments") do
|
||||||
expect(page).to have_css(".budget-investment", count: 1)
|
expect(page).to have_css(".budget-investment", count: 1)
|
||||||
@@ -1691,7 +1691,7 @@ describe "Budget Investments" do
|
|||||||
scenario "Do not display vote button for unselected investments in index" do
|
scenario "Do not display vote button for unselected investments in index" do
|
||||||
investment = create(:budget_investment, :unselected, heading: heading)
|
investment = create(:budget_investment, :unselected, heading: heading)
|
||||||
|
|
||||||
visit budget_investments_path(budget_id: budget.id, heading_id: heading.id, filter: "unselected")
|
visit budget_investments_path(budget, heading_id: heading.id, filter: "unselected")
|
||||||
|
|
||||||
expect(page).to have_content investment.title
|
expect(page).to have_content investment.title
|
||||||
expect(page).not_to have_link("Vote")
|
expect(page).not_to have_link("Vote")
|
||||||
|
|||||||
Reference in New Issue
Block a user