Sha256: 543ea3953f6cf21445099caf911287cd460a68e455ff1c7de89f31ae151c1993

Contents?: true

Size: 890 Bytes

Versions: 4

Compression:

Stored size: 890 Bytes

Contents

require 'test_helper'
 
class EventTest < Test::Unit::TestCase
  include Apotomo::TestCaseMethods::TestController
  
  context "An Event" do
    should "respond to #type and #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 "delegate #[] to data" do
      @event = Apotomo::Event.new(:footsteps, 'mum', {:volume => :loud})
      assert_equal :loud, @event[:volume]
    end
    
    should "respond to #to_s" do
      @event = Apotomo::Event.new(:footsteps, mouse('mum'))
      assert_equal "<Event :footsteps source=mum>", @event.to_s
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
apotomo-1.2.3 test/event_test.rb
apotomo-1.2.2 test/event_test.rb
apotomo-1.2.1 test/event_test.rb
apotomo-1.2.0 test/event_test.rb