Sha256: 418758b8a7b7bd3b60b9684508a7035e8af21a8f3d6c871263b26e6bfbbbbfc3

Contents?: true

Size: 954 Bytes

Versions: 2

Compression:

Stored size: 954 Bytes

Contents

require File.join(File.dirname(__FILE__), *%w[.. test_helper])
 
class EventTest < Test::Unit::TestCase
  context "An Event" do
    should "require type and respond to #type" do
      assert_equal :footsteps, Apotomo::Event.new(:footsteps).type
    end
    
    should "require source and respond to #source" do
      @event = Apotomo::Event.new(:footsteps, 'mum')
      assert_equal :footsteps,  @event.type
      assert_equal 'mum',       @event.source
    end
    
    should "accept an additional data object and respond to #data" do
      @event = Apotomo::Event.new(:footsteps, 'mum', {:volume => :loud})
      assert_equal({:volume => :loud}, @event.data)
    end
    
    should "complain when serialized" do
      assert_raises RuntimeError do
        Marshal.dump(Apotomo::Event.new(:footsteps, 'mum'))
      end
    end
    
    should "respond to #stopped?" do
      assert_not Apotomo::Event.new(:footsteps, 'mum').stopped?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
apotomo-0.1.2 test/unit/event_test.rb
apotomo-0.1.1 test/unit/event_test.rb