Add Account#remote? query method (#33508)
				
					
				
			This commit is contained in:
		@@ -48,14 +48,34 @@ RSpec.describe Account do
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#local?' do
 | 
			
		||||
    it 'returns true when the account is local' do
 | 
			
		||||
    it 'returns true when domain is null' do
 | 
			
		||||
      account = Fabricate(:account, domain: nil)
 | 
			
		||||
      expect(account.local?).to be true
 | 
			
		||||
      expect(account).to be_local
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it 'returns false when the account is on a different domain' do
 | 
			
		||||
    it 'returns false when domain is present' do
 | 
			
		||||
      account = Fabricate(:account, domain: 'foreign.tld')
 | 
			
		||||
      expect(account.local?).to be false
 | 
			
		||||
      expect(account).to_not be_local
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe '#remote?' do
 | 
			
		||||
    context 'when the domain is null' do
 | 
			
		||||
      subject { Fabricate.build :account, domain: nil }
 | 
			
		||||
 | 
			
		||||
      it { is_expected.to_not be_remote }
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'when the domain is blank' do
 | 
			
		||||
      subject { Fabricate.build :account, domain: '' }
 | 
			
		||||
 | 
			
		||||
      it { is_expected.to_not be_remote }
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'when the domain is present' do
 | 
			
		||||
      subject { Fabricate.build :account, domain: 'host.example' }
 | 
			
		||||
 | 
			
		||||
      it { is_expected.to be_remote }
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user