Files
nairobi/spec/components/admin/budget_phases/toggle_enabled_component_spec.rb
2023-08-30 14:46:34 +02:00

29 lines
878 B
Ruby

require "rails_helper"
describe Admin::BudgetPhases::ToggleEnabledComponent, :admin do
let(:phase) { create(:budget).phases.informing }
let(:component) { Admin::BudgetPhases::ToggleEnabledComponent.new(phase) }
it "is pressed when the phase is enabled" do
phase.update!(enabled: true)
render_inline component
expect(page).to have_button count: 1
expect(page).to have_button exact_text: "Yes"
expect(page).to have_button "Enable Information phase"
expect(page).to have_css "button[aria-pressed='true']"
end
it "is not pressed when the phase is disabled" do
phase.update!(enabled: false)
render_inline component
expect(page).to have_button count: 1
expect(page).to have_button exact_text: "No"
expect(page).to have_button "Enable Information phase"
expect(page).to have_css "button[aria-pressed='false']"
end
end