Files
grecia/spec/components/shared/date_of_birth_field_component_spec.rb
Javi Martín d18c627392 Add and apply Layout/EmptyLinesAfterModuleInclusion rule
This rule was added in rubocop 1.79. We were inconsistent about it, so
we're adding it to get more consistency.
2025-11-05 14:27:12 +01:00

28 lines
742 B
Ruby

require "rails_helper"
describe Shared::DateOfBirthFieldComponent do
before do
dummy_model = Class.new do
include ActiveModel::Model
attr_accessor :date_of_birth
end
stub_const("DummyModel", dummy_model)
end
let(:form) { ConsulFormBuilder.new(:dummy, DummyModel.new, ApplicationController.new.view_context, {}) }
let(:component) { Shared::DateOfBirthFieldComponent.new(form) }
it "uses the minimum required age as the latest date by default" do
Setting["min_age_to_participate"] = 13
travel_to "2015-07-15" do
render_inline component
expect(page).to have_field "Date of birth"
expect(page).to have_css "input[type=date][min='1900-01-01'][max='2002-07-15']"
end
end
end