Sha256: dcf86aa9dc122ea4163810dfa6759121ef968a15169708ae0fba46671fdca3e1

Contents?: true

Size: 506 Bytes

Versions: 1

Compression:

Stored size: 506 Bytes

Contents

require File.expand_path 'test_helper', File.dirname(__FILE__)

class TestEventEmitter < MiniTest::Unit::TestCase

  class Foo
    include EventEmitter
  end

  def setup
    @foo = Foo.new
  end
  
  def test_on_emit
    result = nil
    @foo.on :chat do |data|
      puts "chat - #{data[:user]} : #{data[:message]}"
      result = data
    end

    @foo.emit :chat, :user => 'shokai', :message => 'hello world'

    assert result[:user] == 'shokai'
    assert result[:message] == 'hello world'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
event_emitter-0.0.1 test/test_event_emitter.rb