mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-26 05:31:36 +01:00
Add coverage for AccountAlias
validations (#31936)
This commit is contained in:
parent
029c99bd7b
commit
6d2f865862
1 changed files with 22 additions and 0 deletions
|
@ -8,4 +8,26 @@ RSpec.describe AccountAlias do
|
||||||
it { is_expected.to normalize(:acct).from(' @username@domain ').to('username@domain') }
|
it { is_expected.to normalize(:acct).from(' @username@domain ').to('username@domain') }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'Validations' do
|
||||||
|
subject { described_class.new(account:) }
|
||||||
|
|
||||||
|
let(:account) { Fabricate :account }
|
||||||
|
|
||||||
|
it { is_expected.to_not allow_values(nil, '').for(:uri).against(:acct).with_message(not_found_message) }
|
||||||
|
|
||||||
|
it { is_expected.to_not allow_values(account_uri).for(:uri).against(:acct).with_message(self_move_message) }
|
||||||
|
|
||||||
|
def account_uri
|
||||||
|
ActivityPub::TagManager.instance.uri_for(subject.account)
|
||||||
|
end
|
||||||
|
|
||||||
|
def not_found_message
|
||||||
|
I18n.t('migrations.errors.not_found')
|
||||||
|
end
|
||||||
|
|
||||||
|
def self_move_message
|
||||||
|
I18n.t('migrations.errors.move_to_self')
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue