Sha256: 7b6a03cef1a3b930c93bb445aad771f21a168a829ae6ed8fe0f557bb878ac8a6

Contents?: true

Size: 914 Bytes

Versions: 10

Compression:

Stored size: 914 Bytes

Contents

require '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

10 entries across 10 versions & 1 rubygems

Version Path
apotomo-1.0.5 test/unit/event_test.rb
apotomo-1.0.4 test/unit/event_test.rb
apotomo-1.0.3 test/unit/event_test.rb
apotomo-1.0.2 test/unit/event_test.rb
apotomo-1.0.1 test/unit/event_test.rb
apotomo-1.0.0 test/unit/event_test.rb
apotomo-1.0.0.beta2 test/unit/event_test.rb
apotomo-1.0.0.beta1 test/unit/event_test.rb
apotomo-0.1.4 test/unit/event_test.rb
apotomo-0.1.3 test/unit/event_test.rb