1
0
Fork 0
forked from gitea/nas

Simplify basic presence validations (#29664)

This commit is contained in:
Matt Jankowski 2024-09-05 11:36:05 -04:00 committed by GitHub
parent bc435c63bd
commit 5acec087ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 28 additions and 159 deletions

View file

@ -9,17 +9,8 @@ RSpec.describe Follow do
describe 'validations' do
subject { described_class.new(account: alice, target_account: bob, rate_limit: true) }
it 'is invalid without an account' do
follow = Fabricate.build(:follow, account: nil)
follow.valid?
expect(follow).to model_have_error_on_field(:account)
end
it 'is invalid without a target_account' do
follow = Fabricate.build(:follow, target_account: nil)
follow.valid?
expect(follow).to model_have_error_on_field(:target_account)
end
it { is_expected.to belong_to(:account).required }
it { is_expected.to belong_to(:target_account).required }
it 'is invalid if account already follows too many people' do
alice.update(following_count: FollowLimitValidator::LIMIT)