Don't show investment filters before valuation
Before the "valuating" phase, all investments have undecided feasibility and none have been selected, so the filters would return no results (except the "not_unfeasible" one, which would return everything).
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe Budgets::Investments::FiltersComponent do
|
||||
let(:budget) { create(:budget) }
|
||||
|
||||
around do |example|
|
||||
with_request_url(Rails.application.routes.url_helpers.budget_investments_path(budget)) do
|
||||
example.run
|
||||
end
|
||||
end
|
||||
|
||||
it "is not displayed before valuation" do
|
||||
%w[informing accepting reviewing selecting].each do |phase|
|
||||
budget.update!(phase: phase)
|
||||
allow(controller).to receive(:valid_filters).and_return(budget.investments_filters)
|
||||
|
||||
render_inline Budgets::Investments::FiltersComponent.new
|
||||
|
||||
expect(page.native.inner_html).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
it "is displayed during and after valuation" do
|
||||
Budget::Phase::kind_or_later("valuating").each do |phase|
|
||||
budget.update!(phase: phase)
|
||||
allow(controller).to receive(:valid_filters).and_return(budget.investments_filters)
|
||||
|
||||
render_inline Budgets::Investments::FiltersComponent.new
|
||||
|
||||
expect(page).to have_content "Filtering projects by"
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user