This commit is contained in:
KMY 2023-10-18 10:41:42 +09:00 committed by KMY(雪あすか)
parent 1d9c77063e
commit 84eae6fac9
32 changed files with 556 additions and 586 deletions

View file

@ -29,4 +29,23 @@ describe Poll do
end
end
end
describe 'validations' do
context 'when valid' do
let(:poll) { Fabricate.build(:poll) }
it 'is valid with valid attributes' do
expect(poll).to be_valid
end
end
context 'when not valid' do
let(:poll) { Fabricate.build(:poll, expires_at: nil) }
it 'is invalid without an expire date' do
poll.valid?
expect(poll).to model_have_error_on_field(:expires_at)
end
end
end
end