Show budgets map only if feature is enabled

This commit is contained in:
decabeza
2022-04-12 18:37:04 +02:00
committed by Javi Martín
parent 8befe55ba1
commit d517403234
2 changed files with 13 additions and 2 deletions

View File

@@ -7,7 +7,7 @@ class Budgets::MapComponent < ApplicationComponent
end
def render?
!budget.informing?
feature?(:map) && !budget.informing?
end
private

View File

@@ -4,7 +4,8 @@ describe Budgets::MapComponent do
let(:budget) { build(:budget) }
describe "#render?" do
it "is rendered after the informing phase" do
it "is rendered after the informing phase when the map feature is enabled" do
Setting["feature.map"] = true
budget.phase = "accepting"
render_inline Budgets::MapComponent.new(budget)
@@ -13,11 +14,21 @@ describe Budgets::MapComponent do
end
it "is not rendered during the informing phase" do
Setting["feature.map"] = true
budget.phase = "informing"
render_inline Budgets::MapComponent.new(budget)
expect(page).not_to be_rendered
end
it "is not rendered when the map feature is disabled" do
Setting["feature.map"] = false
budget.phase = "accepting"
render_inline Budgets::MapComponent.new(budget)
expect(page).not_to be_rendered
end
end
end