Add spec for poll model (#23399)
Co-authored-by: Nick Schonning <nschonni@gmail.com> Co-authored-by: Claire <claire.github-309c@sitedethib.com>pull/2444/head
parent
12bb7be8b5
commit
c4bddc9855
|
@ -29,4 +29,23 @@ describe Poll do
|
||||||
end
|
end
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in New Issue