Remove double subject call in `services/activitypub/process_account_service` spec (#28214)
This commit is contained in:
		
							parent
							
								
									faffd81976
								
							
						
					
					
						commit
						5517df61de
					
				| 
						 | 
					@ -129,12 +129,10 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
 | 
				
			||||||
      stub_const 'ActivityPub::ProcessAccountService::SUBDOMAINS_RATELIMIT', 5
 | 
					      stub_const 'ActivityPub::ProcessAccountService::SUBDOMAINS_RATELIMIT', 5
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'creates at least some accounts' do
 | 
					    it 'creates accounts without exceeding rate limit' do
 | 
				
			||||||
      expect { subject }.to change { Account.remote.count }.by_at_least(2)
 | 
					      expect { subject }
 | 
				
			||||||
    end
 | 
					        .to create_some_remote_accounts
 | 
				
			||||||
 | 
					        .and create_fewer_than_rate_limit_accounts
 | 
				
			||||||
    it 'creates no more account than the limit allows' do
 | 
					 | 
				
			||||||
      expect { subject }.to change { Account.remote.count }.by_at_most(5)
 | 
					 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -195,12 +193,20 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'creates at least some accounts' do
 | 
					    it 'creates accounts without exceeding rate limit' do
 | 
				
			||||||
      expect { subject.call('user1', 'foo.test', payload) }.to change { Account.remote.count }.by_at_least(2)
 | 
					      expect { subject.call('user1', 'foo.test', payload) }
 | 
				
			||||||
 | 
					        .to create_some_remote_accounts
 | 
				
			||||||
 | 
					        .and create_fewer_than_rate_limit_accounts
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it 'creates no more account than the limit allows' do
 | 
					  private
 | 
				
			||||||
      expect { subject.call('user1', 'foo.test', payload) }.to change { Account.remote.count }.by_at_most(5)
 | 
					
 | 
				
			||||||
 | 
					  def create_some_remote_accounts
 | 
				
			||||||
 | 
					    change(Account.remote, :count).by_at_least(2)
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def create_fewer_than_rate_limit_accounts
 | 
				
			||||||
 | 
					    change(Account.remote, :count).by_at_most(5)
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue