Simplify model validation specs for `AccountStatusCleanupPolicy` (#32495)

pull/2889/head
Matt Jankowski 2024-10-25 04:41:24 -04:00 committed by GitHub
parent 66c0471515
commit 9464281f29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 7 deletions

View File

@ -5,13 +5,12 @@ require 'rails_helper'
RSpec.describe AccountStatusesCleanupPolicy do
let(:account) { Fabricate(:account, username: 'alice', domain: nil) }
describe 'validation' do
it 'disallow remote accounts' do
account.update(domain: 'example.com')
account_statuses_cleanup_policy = Fabricate.build(:account_statuses_cleanup_policy, account: account)
account_statuses_cleanup_policy.valid?
expect(account_statuses_cleanup_policy).to model_have_error_on_field(:account)
end
describe 'Validations' do
subject { Fabricate.build :account_statuses_cleanup_policy }
let(:remote_account) { Fabricate(:account, domain: 'example.com') }
it { is_expected.to_not allow_value(remote_account).for(:account) }
end
describe 'save hooks' do