Merge remote-tracking branch 'parent/main' into upstream-20240218
This commit is contained in:
commit
7684b5de6f
47 changed files with 412 additions and 115 deletions
|
@ -957,13 +957,13 @@ RSpec.describe Account do
|
|||
end
|
||||
|
||||
it 'is valid if we are creating an instance actor account with a period' do
|
||||
account = Fabricate.build(:account, id: -99, actor_type: 'Application', locked: true, username: 'example.com')
|
||||
account = Fabricate.build(:account, id: described_class::INSTANCE_ACTOR_ID, actor_type: 'Application', locked: true, username: 'example.com')
|
||||
expect(account.valid?).to be true
|
||||
end
|
||||
|
||||
it 'is valid if we are creating a possibly-conflicting instance actor account' do
|
||||
_account = Fabricate(:account, username: 'examplecom')
|
||||
instance_account = Fabricate.build(:account, id: -99, actor_type: 'Application', locked: true, username: 'example.com')
|
||||
instance_account = Fabricate.build(:account, id: described_class::INSTANCE_ACTOR_ID, actor_type: 'Application', locked: true, username: 'example.com')
|
||||
expect(instance_account.valid?).to be true
|
||||
end
|
||||
|
||||
|
|
|
@ -164,12 +164,12 @@ RSpec.describe UserRole do
|
|||
end
|
||||
|
||||
describe '#everyone?' do
|
||||
it 'returns true when id is -99' do
|
||||
subject.id = -99
|
||||
it 'returns true when id matches the everyone id' do
|
||||
subject.id = described_class::EVERYONE_ROLE_ID
|
||||
expect(subject.everyone?).to be true
|
||||
end
|
||||
|
||||
it 'returns false when id is not -99' do
|
||||
it 'returns false when id does not match the everyone id' do
|
||||
subject.id = 123
|
||||
expect(subject.everyone?).to be false
|
||||
end
|
||||
|
|
|
@ -487,18 +487,20 @@ RSpec.describe User do
|
|||
|
||||
let!(:user) { Fabricate(:user, confirmed_at: confirmed_at) }
|
||||
|
||||
before { ActionMailer::Base.deliveries.clear }
|
||||
|
||||
after { ActionMailer::Base.deliveries.clear }
|
||||
|
||||
context 'when user is new' do
|
||||
let(:confirmed_at) { nil }
|
||||
|
||||
it 'confirms user and delivers welcome email', :sidekiq_inline do
|
||||
subject
|
||||
emails = capture_emails { subject }
|
||||
|
||||
expect(user.confirmed_at).to be_present
|
||||
expect(ActionMailer::Base.deliveries.count).to eq 1
|
||||
expect(emails.size)
|
||||
.to eq(1)
|
||||
expect(emails.first)
|
||||
.to have_attributes(
|
||||
to: contain_exactly(user.email),
|
||||
subject: eq(I18n.t('user_mailer.welcome.subject'))
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -506,10 +508,10 @@ RSpec.describe User do
|
|||
let(:confirmed_at) { Time.zone.now }
|
||||
|
||||
it 'confirms user but does not deliver welcome email' do
|
||||
subject
|
||||
emails = capture_emails { subject }
|
||||
|
||||
expect(user.confirmed_at).to be_present
|
||||
expect(ActionMailer::Base.deliveries.count).to eq 0
|
||||
expect(emails).to be_empty
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue