Fix streaming still being authorized for suspended accounts (#36449)
This commit is contained in:
		@@ -98,4 +98,28 @@ RSpec.describe 'Streaming', :inline_jobs, :streaming do
 | 
			
		||||
      expect(streaming_client.open?).to be(false)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context 'with a suspended user account' do
 | 
			
		||||
    before do
 | 
			
		||||
      user.account.suspend!
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it 'receives an 401 unauthorized error when trying to connect' do
 | 
			
		||||
      streaming_client.connect
 | 
			
		||||
 | 
			
		||||
      expect(streaming_client.status).to eq(401)
 | 
			
		||||
      expect(streaming_client.open?).to be(false)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context 'when the user account is suspended whilst connected' do
 | 
			
		||||
    it 'terminates the connection for the user' do
 | 
			
		||||
      streaming_client.connect
 | 
			
		||||
 | 
			
		||||
      user.account.suspend!
 | 
			
		||||
 | 
			
		||||
      expect(streaming_client.wait_for(:closed).code).to be(1000)
 | 
			
		||||
      expect(streaming_client.open?).to be(false)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user