1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Update tests

This commit is contained in:
Fawaz Farid 2024-04-17 17:48:18 +03:00
parent c6047b2f1e
commit 7060867bb2
2 changed files with 14 additions and 14 deletions

View file

@ -246,8 +246,8 @@ describe Mastodon::CLI::Accounts do
end
context 'with --email option' do
let(:user) { Fabricate(:user, email: 'old_email@email.com') }
let(:options) { { email: 'new_email@email.com' } }
let(:user) { Fabricate(:user, email: 'old_email@example.com') }
let(:options) { { email: 'new_email@example.com' } }
it "sets the user's unconfirmed email to the provided email address" do
expect { subject }
@ -260,12 +260,12 @@ describe Mastodon::CLI::Accounts do
expect { subject }
.to output_results('OK')
expect(user.reload.email).to eq('old_email@email.com')
expect(user.reload.email).to eq('old_email@example.com')
end
context 'with --confirm option' do
let(:user) { Fabricate(:user, email: 'old_email@email.com', confirmed_at: nil) }
let(:options) { { email: 'new_email@email.com', confirm: true } }
let(:user) { Fabricate(:user, email: 'old_email@example.com', confirmed_at: nil) }
let(:options) { { email: 'new_email@example.com', confirm: true } }
it "updates the user's email address to the provided email" do
expect { subject }

View file

@ -6,7 +6,7 @@ RSpec.describe AppSignUpService do
subject { described_class.new }
let(:app) { Fabricate(:application, scopes: 'read write') }
let(:good_params) { { username: 'alice', password: '12345678', email: 'good@email.com', agreement: true } }
let(:good_params) { { username: 'alice', password: '12345678', email: 'good@example.com', agreement: true } }
let(:remote_ip) { IPAddr.new('198.0.2.1') }
describe '#call' do
@ -30,7 +30,7 @@ RSpec.describe AppSignUpService do
context 'when the email address requires approval' do
before do
Setting.registrations_mode = 'open'
Fabricate(:email_domain_block, allow_with_approval: true, domain: 'email.com')
Fabricate(:email_domain_block, allow_with_approval: true, domain: 'example.com')
end
it 'creates an unapproved user', :aggregate_failures do
@ -51,18 +51,18 @@ RSpec.describe AppSignUpService do
context 'when the email address requires approval through MX records' do
before do
Setting.registrations_mode = 'open'
Fabricate(:email_domain_block, allow_with_approval: true, domain: 'smtp.email.com')
Fabricate(:email_domain_block, allow_with_approval: true, domain: 'smtp.example.com')
allow(User).to receive(:skip_mx_check?).and_return(false)
resolver = instance_double(Resolv::DNS, :timeouts= => nil)
allow(resolver).to receive(:getresources)
.with('email.com', Resolv::DNS::Resource::IN::MX)
.and_return([instance_double(Resolv::DNS::Resource::MX, exchange: 'smtp.email.com')])
allow(resolver).to receive(:getresources).with('email.com', Resolv::DNS::Resource::IN::A).and_return([])
allow(resolver).to receive(:getresources).with('email.com', Resolv::DNS::Resource::IN::AAAA).and_return([])
allow(resolver).to receive(:getresources).with('smtp.email.com', Resolv::DNS::Resource::IN::A).and_return([instance_double(Resolv::DNS::Resource::IN::A, address: '2.3.4.5')])
allow(resolver).to receive(:getresources).with('smtp.email.com', Resolv::DNS::Resource::IN::AAAA).and_return([instance_double(Resolv::DNS::Resource::IN::AAAA, address: 'fd00::2')])
.with('example.com', Resolv::DNS::Resource::IN::MX)
.and_return([instance_double(Resolv::DNS::Resource::MX, exchange: 'smtp.example.com')])
allow(resolver).to receive(:getresources).with('example.com', Resolv::DNS::Resource::IN::A).and_return([])
allow(resolver).to receive(:getresources).with('example.com', Resolv::DNS::Resource::IN::AAAA).and_return([])
allow(resolver).to receive(:getresources).with('smtp.example.com', Resolv::DNS::Resource::IN::A).and_return([instance_double(Resolv::DNS::Resource::IN::A, address: '2.3.4.5')])
allow(resolver).to receive(:getresources).with('smtp.example.com', Resolv::DNS::Resource::IN::AAAA).and_return([instance_double(Resolv::DNS::Resource::IN::AAAA, address: 'fd00::2')])
allow(Resolv::DNS).to receive(:open).and_yield(resolver)
end