Merge remote-tracking branch 'parent/main' into upstream-20231021
This commit is contained in:
commit
f9eaaec4e7
95 changed files with 1002 additions and 657 deletions
|
@ -356,7 +356,7 @@ RSpec.describe Account do
|
|||
end
|
||||
|
||||
it 'does not return suspended users' do
|
||||
match = Fabricate(
|
||||
Fabricate(
|
||||
:account,
|
||||
display_name: 'Display Name',
|
||||
username: 'username',
|
||||
|
@ -483,7 +483,7 @@ RSpec.describe Account do
|
|||
end
|
||||
|
||||
it 'does not return non-followed accounts' do
|
||||
match = Fabricate(
|
||||
Fabricate(
|
||||
:account,
|
||||
display_name: 'A & l & i & c & e',
|
||||
username: 'username',
|
||||
|
@ -495,7 +495,7 @@ RSpec.describe Account do
|
|||
end
|
||||
|
||||
it 'does not return suspended users' do
|
||||
match = Fabricate(
|
||||
Fabricate(
|
||||
:account,
|
||||
display_name: 'Display Name',
|
||||
username: 'username',
|
||||
|
@ -535,7 +535,7 @@ RSpec.describe Account do
|
|||
end
|
||||
|
||||
it 'does not return suspended users' do
|
||||
match = Fabricate(
|
||||
Fabricate(
|
||||
:account,
|
||||
display_name: 'Display Name',
|
||||
username: 'username',
|
||||
|
@ -719,10 +719,10 @@ RSpec.describe Account do
|
|||
|
||||
context 'when is local' do
|
||||
it 'is invalid if the username is not unique in case-insensitive comparison among local accounts' do
|
||||
account_1 = Fabricate(:account, username: 'the_doctor')
|
||||
account_2 = Fabricate.build(:account, username: 'the_Doctor')
|
||||
account_2.valid?
|
||||
expect(account_2).to model_have_error_on_field(:username)
|
||||
_account = Fabricate(:account, username: 'the_doctor')
|
||||
non_unique_account = Fabricate.build(:account, username: 'the_Doctor')
|
||||
non_unique_account.valid?
|
||||
expect(non_unique_account).to model_have_error_on_field(:username)
|
||||
end
|
||||
|
||||
it 'is invalid if the username is reserved' do
|
||||
|
@ -743,9 +743,9 @@ RSpec.describe Account do
|
|||
end
|
||||
|
||||
it 'is valid if we are creating a possibly-conflicting instance actor account' do
|
||||
account_1 = Fabricate(:account, username: 'examplecom')
|
||||
account_2 = Fabricate.build(:account, id: -99, actor_type: 'Application', locked: true, username: 'example.com')
|
||||
expect(account_2.valid?).to be true
|
||||
_account = Fabricate(:account, username: 'examplecom')
|
||||
instance_account = Fabricate.build(:account, id: -99, actor_type: 'Application', locked: true, username: 'example.com')
|
||||
expect(instance_account.valid?).to be true
|
||||
end
|
||||
|
||||
it 'is invalid if the username doesn\'t only contains letters, numbers and underscores' do
|
||||
|
@ -877,17 +877,17 @@ RSpec.describe Account do
|
|||
|
||||
describe 'remote' do
|
||||
it 'returns an array of accounts who have a domain' do
|
||||
account_1 = Fabricate(:account, domain: nil)
|
||||
account_2 = Fabricate(:account, domain: 'example.com')
|
||||
expect(described_class.remote).to contain_exactly(account_2)
|
||||
_account = Fabricate(:account, domain: nil)
|
||||
account_with_domain = Fabricate(:account, domain: 'example.com')
|
||||
expect(described_class.remote).to contain_exactly(account_with_domain)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'local' do
|
||||
it 'returns an array of accounts who do not have a domain' do
|
||||
account_1 = Fabricate(:account, domain: nil)
|
||||
account_2 = Fabricate(:account, domain: 'example.com')
|
||||
expect(described_class.where('id > 0').local).to contain_exactly(account_1)
|
||||
local_account = Fabricate(:account, domain: nil)
|
||||
_account_with_domain = Fabricate(:account, domain: 'example.com')
|
||||
expect(described_class.where('id > 0').local).to contain_exactly(local_account)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -911,17 +911,17 @@ RSpec.describe Account do
|
|||
|
||||
describe 'silenced' do
|
||||
it 'returns an array of accounts who are silenced' do
|
||||
account_1 = Fabricate(:account, silenced: true)
|
||||
account_2 = Fabricate(:account, silenced: false)
|
||||
expect(described_class.silenced).to contain_exactly(account_1)
|
||||
silenced_account = Fabricate(:account, silenced: true)
|
||||
_account = Fabricate(:account, silenced: false)
|
||||
expect(described_class.silenced).to contain_exactly(silenced_account)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'suspended' do
|
||||
it 'returns an array of accounts who are suspended' do
|
||||
account_1 = Fabricate(:account, suspended: true)
|
||||
account_2 = Fabricate(:account, suspended: false)
|
||||
expect(described_class.suspended).to contain_exactly(account_1)
|
||||
suspended_account = Fabricate(:account, suspended: true)
|
||||
_account = Fabricate(:account, suspended: false)
|
||||
expect(described_class.suspended).to contain_exactly(suspended_account)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ RSpec.describe DomainBlock do
|
|||
end
|
||||
|
||||
it 'is invalid if the same normalized domain already exists' do
|
||||
domain_block_1 = Fabricate(:domain_block, domain: 'にゃん')
|
||||
domain_block_2 = Fabricate.build(:domain_block, domain: 'xn--r9j5b5b')
|
||||
domain_block_2.valid?
|
||||
expect(domain_block_2).to model_have_error_on_field(:domain)
|
||||
_domain_block = Fabricate(:domain_block, domain: 'にゃん')
|
||||
domain_block_with_normalized_value = Fabricate.build(:domain_block, domain: 'xn--r9j5b5b')
|
||||
domain_block_with_normalized_value.valid?
|
||||
expect(domain_block_with_normalized_value).to model_have_error_on_field(:domain)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -341,7 +341,7 @@ RSpec.describe Status do
|
|||
|
||||
describe '#replies_count' do
|
||||
it 'is the number of replies' do
|
||||
reply = Fabricate(:status, account: bob, thread: subject)
|
||||
Fabricate(:status, account: bob, thread: subject)
|
||||
expect(subject.replies_count).to eq 1
|
||||
end
|
||||
|
||||
|
|
|
@ -55,17 +55,17 @@ RSpec.describe User do
|
|||
describe 'scopes' do
|
||||
describe 'recent' do
|
||||
it 'returns an array of recent users ordered by id' do
|
||||
user_1 = Fabricate(:user)
|
||||
user_2 = Fabricate(:user)
|
||||
expect(described_class.recent).to eq [user_2, user_1]
|
||||
first_user = Fabricate(:user)
|
||||
second_user = Fabricate(:user)
|
||||
expect(described_class.recent).to eq [second_user, first_user]
|
||||
end
|
||||
end
|
||||
|
||||
describe 'confirmed' do
|
||||
it 'returns an array of users who are confirmed' do
|
||||
user_1 = Fabricate(:user, confirmed_at: nil)
|
||||
user_2 = Fabricate(:user, confirmed_at: Time.zone.now)
|
||||
expect(described_class.confirmed).to contain_exactly(user_2)
|
||||
Fabricate(:user, confirmed_at: nil)
|
||||
confirmed_user = Fabricate(:user, confirmed_at: Time.zone.now)
|
||||
expect(described_class.confirmed).to contain_exactly(confirmed_user)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ RSpec.describe WebauthnCredential do
|
|||
end
|
||||
|
||||
it 'is invalid if already exist a webauthn credential with the same external id' do
|
||||
existing_webauthn_credential = Fabricate(:webauthn_credential, external_id: '_Typ0ygudDnk9YUVWLQayw')
|
||||
Fabricate(:webauthn_credential, external_id: '_Typ0ygudDnk9YUVWLQayw')
|
||||
new_webauthn_credential = Fabricate.build(:webauthn_credential, external_id: '_Typ0ygudDnk9YUVWLQayw')
|
||||
|
||||
new_webauthn_credential.valid?
|
||||
|
@ -47,7 +47,7 @@ RSpec.describe WebauthnCredential do
|
|||
|
||||
it 'is invalid if user already registered a webauthn credential with the same nickname' do
|
||||
user = Fabricate(:user)
|
||||
existing_webauthn_credential = Fabricate(:webauthn_credential, user_id: user.id, nickname: 'USB Key')
|
||||
Fabricate(:webauthn_credential, user_id: user.id, nickname: 'USB Key')
|
||||
new_webauthn_credential = Fabricate.build(:webauthn_credential, user_id: user.id, nickname: 'USB Key')
|
||||
|
||||
new_webauthn_credential.valid?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue