Sha256: 092f4c839042289745a4663d82bad8c9fd96288a7419fc45a3b39b55554fdcf9

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

require 'spec_helper'

module GameMachine
  module GameSystems
    
    describe ChatManager do

      let(:player_id) {'player1'}
      let(:topic) {'test_topic'}
      let(:chat_text) {'test text'}
      let(:client_id) {'player1_id'}
      let(:gateway) {'blah'}

      let(:game_message) do
        Helpers::GameMessage.new(player_id)
      end

      let(:join_request) do
        game_message.join_chat(topic)
        game_message.to_entity
      end

      let(:chat_message) do
        game_message.chat_message('group',chat_text,topic)
        game_message.to_entity
      end

      let(:actor_builder) {double('Actor::Builder', :with_parent => actor_builder, :start => true)}

      let(:chat_invite) do
        chat = Commands::ChatCommands.new
        chat.invite_message('inviter','invitee','test')
      end

      subject do
        ref = Actor::Builder.new(GameSystems::ChatManager).with_name('chat_manager').test_ref
        ref.underlying_actor
      end

      describe "chat invites" do
        it "chat manager calls send_invite when it receives a chat invite" do
          expect(subject).to receive(:send_invite).with(chat_invite.chat_invite)
          subject.on_receive(chat_invite)
        end

      end

      describe "multiple players" do

      end

      describe "managing chat messages" do

        it "creates chat actor for player if it does not exist" do
          expect(subject).to receive(:forward_chat_request)
          subject.on_receive(chat_message)
        end

      end

    end

  end
end


Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
game_machine-1.0.4 spec/game_systems/chat_manager_spec.rb
game_machine-1.0.2 spec/game_systems/chat_manager_spec.rb
game_machine-0.0.11 spec/game_systems/chat_manager_spec.rb