Simplify basic presence validations (#29664)
This commit is contained in:
parent
bc435c63bd
commit
5acec087ca
16 changed files with 28 additions and 159 deletions
|
@ -64,14 +64,7 @@ RSpec.describe Announcement do
|
|||
end
|
||||
|
||||
describe 'Validations' do
|
||||
describe 'text' do
|
||||
it 'validates presence of attribute' do
|
||||
record = Fabricate.build(:announcement, text: nil)
|
||||
|
||||
expect(record).to_not be_valid
|
||||
expect(record.errors[:text]).to be_present
|
||||
end
|
||||
end
|
||||
it { is_expected.to validate_presence_of(:text) }
|
||||
|
||||
describe 'ends_at' do
|
||||
it 'validates presence when starts_at is present' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue