Sha256: 5f94ecbd13cdb7821a27f83d8ef2579b36f1ba52b4f84cc0ef19ea8106440f76

Contents?: true

Size: 852 Bytes

Versions: 7

Compression:

Stored size: 852 Bytes

Contents

$:.unshift File.join(File.dirname(__FILE__),'..','lib')

require 'test/unit'

require 'rhcp'

class BrokerTest < Test::Unit::TestCase

  def test_register_commands
    broker = RHCP::Broker.new()
    assert_not_nil broker
    commands = broker.get_command_list
    assert_not_nil commands
    assert_equal 0, commands.size
    
    command = RHCP::Command.new("test", "a test command", lambda {})
    broker.register_command(command)
    commands = broker.get_command_list
    assert_equal 1, commands.size
    assert_equal command, commands["test"]
  end
  
  def test_register_duplicate
    broker = RHCP::Broker.new()
    broker.register_command RHCP::Command.new("test", "a test command", lambda {})
    assert_raise(RHCP::RhcpException) { broker.register_command RHCP::Command.new("test", "a command with the same name", lambda {}) }
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rhcp-0.1.2 test/rhcp/broker_test.rb
rhcp-0.1.5 test/rhcp/broker_test.rb
rhcp-0.1.6 test/rhcp/broker_test.rb
rhcp-0.1.7 test/rhcp/broker_test.rb
rhcp-0.1.8 test/rhcp/broker_test.rb
rhcp-0.1.9 test/rhcp/broker_test.rb
rhcp-0.1.4 test/rhcp/broker_test.rb