Simplify model validation specs for `CustomFilter` (#33248)

pull/33265/head
Matt Jankowski 3 months ago committed by GitHub
parent f721e76d13
commit ad68686bec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -7,19 +7,8 @@ RSpec.describe CustomFilter do
it { is_expected.to validate_presence_of(:title) }
it { is_expected.to validate_presence_of(:context) }
it 'requires non-empty of context' do
record = described_class.new(context: [])
record.valid?
expect(record).to model_have_error_on_field(:context)
end
it 'requires valid context value' do
record = described_class.new(context: ['invalid'])
record.valid?
expect(record).to model_have_error_on_field(:context)
end
it { is_expected.to_not allow_values([], %w(invalid)).for(:context) }
it { is_expected.to allow_values(%w(home)).for(:context) }
end
describe 'Normalizations' do

Loading…
Cancel
Save