Files
grecia/spec/components/admin/budget_headings/form_component_spec.rb
Matheus Miranda de13e789dd Add polygon geographies to Budgets' map
Note that in the budgets wizard test we now create district with no
associated geozone, so the text "all city" will appear in the districts
table too, meaning we can't use `within "section", text: "All city" do`
anymore since it would result in an ambiguous match.

Co-Authored-By: Julian Herrero <microweb10@gmail.com>
Co-Authored-By: Javi Martín <javim@elretirao.net>
2023-05-31 16:56:15 +02:00

33 lines
965 B
Ruby

require "rails_helper"
describe Admin::BudgetHeadings::FormComponent do
describe "geozone field" do
let(:heading) { create(:budget_heading) }
let(:component) { Admin::BudgetHeadings::FormComponent.new(heading, path: "/", action: nil) }
before { Setting["feature.map"] = true }
it "is shown when the map feature is enabled" do
render_inline component
expect(page).to have_select "Scope of operation"
end
it "is not shown when the map feature is disabled" do
Setting["feature.map"] = false
render_inline component
expect(page).not_to have_select "Scope of operation"
end
it "includes all existing geozones plus an option for all city" do
create(:geozone, name: "Under the sea")
create(:geozone, name: "Above the skies")
render_inline component
expect(page).to have_select "Scope of operation", options: ["All city", "Under the sea", "Above the skies"]
end
end
end