From 7060867bb2cb6b88a78a1e0cd43e8f3b37529c85 Mon Sep 17 00:00:00 2001 From: Fawaz Farid Date: Wed, 17 Apr 2024 17:48:18 +0300 Subject: [PATCH] Update tests --- spec/lib/mastodon/cli/accounts_spec.rb | 10 +++++----- spec/services/app_sign_up_service_spec.rb | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/spec/lib/mastodon/cli/accounts_spec.rb b/spec/lib/mastodon/cli/accounts_spec.rb index 137f85c6ca2..8a3c3884bfe 100644 --- a/spec/lib/mastodon/cli/accounts_spec.rb +++ b/spec/lib/mastodon/cli/accounts_spec.rb @@ -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 } diff --git a/spec/services/app_sign_up_service_spec.rb b/spec/services/app_sign_up_service_spec.rb index ec7b7516f95..0b5fb8c9204 100644 --- a/spec/services/app_sign_up_service_spec.rb +++ b/spec/services/app_sign_up_service_spec.rb @@ -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