Sha256: bd5c847026daa39a3d5b21017aacf8a2b903b9fcf8072d2714d953303ad2c728

Contents?: true

Size: 774 Bytes

Versions: 4

Compression:

Stored size: 774 Bytes

Contents

require 'test_helper'

module Alondra

  class CommandTest < ActiveSupport::TestCase

    def setup
      @connection = MockConnection.new
    end

    test "it is created with a connection and a hash" do
      command = Command.new @connection, :command => 'subscribe', :channel => 'test'

      assert_equal :subscribe, command.name
      assert_equal 'test', command.channel.name
    end

    test "subscribe to channel when subscribe command is executed" do
      channel = Channel['test']
      assert_equal 0, channel.connections.size

      command = Command.new @connection, :command => 'subscribe', :channel => 'test'
      command.execute!

      assert_equal 1, channel.connections.size
      assert channel.connections.keys.include? @connection
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alondra-0.1.1 test/models/command_test.rb
alondra-0.1.0 test/models/command_test.rb
alondra-0.0.4 test/models/command_test.rb
alondra-0.0.3 test/models/command_test.rb