Sha256: 6602efe7c95e35e12f0614937e13b0bb3f1134cf8cd3e6d6d365e88032b8a92a

Contents?: true

Size: 1.37 KB

Versions: 6

Compression:

Stored size: 1.37 KB

Contents

require 'integration_helper'
module GameMachine

  describe "chat" do 
      
    before(:all) do
      @client = Clients::TestClient.start('test1',8200)
      @client2 = Clients::TestClient.start('test2',8202)
    end

    after(:all) do
      @client.stop
      @client2.stop
    end

    it "join chat request sends ChatChannels to client" do
      message = Helpers::GameMessage.new('player1')
      message.join_chat('mygroup')
      @client.send_to_server(message.client_message)
      expect(@client.entity_with_component('ChatChannels')).to be_true
    end

    it "receive chat message from other player" do
      client_join_message = Helpers::GameMessage.new('player1')
      client_join_message.join_chat('mygroup')

      client2_join_message = Helpers::GameMessage.new('player2')
      client2_join_message.join_chat('mygroup')

      chat_message = Helpers::GameMessage.new('player1')
      chat_message.chat_message('group','Chat it up!','mygroup')

      @client.send_to_server(client_join_message.client_message)
      expect(@client.entity_with_component('ChatChannels')).to be_true

      @client2.send_to_server(client2_join_message.client_message)
      expect(@client2.entity_with_component('ChatChannels')).to be_true

      @client.send_to_server(chat_message.client_message)
      expect(@client2.entity_with_component('ChatMessage',1)).to be_true
      
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
game_machine-1.0.4 integration_tests/chat_spec.rb
game_machine-1.0.2 integration_tests/chat_spec.rb
game_machine-0.0.11 integration_tests/chat_spec.rb
game_machine-0.0.10 integration_tests/chat_spec.rb
game_machine-0.0.9 integration_tests/chat_spec.rb
game_machine-0.0.8 integration_tests/chat_spec.rb