mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 18:45:41 +01:00
Simplify model validation specs for CustomFilter
(#33248)
This commit is contained in:
parent
f721e76d13
commit
ad68686bec
1 changed files with 2 additions and 13 deletions
|
@ -7,19 +7,8 @@ RSpec.describe CustomFilter do
|
||||||
it { is_expected.to validate_presence_of(:title) }
|
it { is_expected.to validate_presence_of(:title) }
|
||||||
it { is_expected.to validate_presence_of(:context) }
|
it { is_expected.to validate_presence_of(:context) }
|
||||||
|
|
||||||
it 'requires non-empty of context' do
|
it { is_expected.to_not allow_values([], %w(invalid)).for(:context) }
|
||||||
record = described_class.new(context: [])
|
it { is_expected.to allow_values(%w(home)).for(: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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'Normalizations' do
|
describe 'Normalizations' do
|
||||||
|
|
Loading…
Reference in a new issue