Sha256: 8dd8fa37afc05056766858022ff67a6aa7e01fd9c57910ceb60e1cf44109c7b8

Contents?: true

Size: 895 Bytes

Versions: 4

Compression:

Stored size: 895 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_mock('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.1.4 test/unit/event_test.rb
apotomo-1.1.3 test/unit/event_test.rb
apotomo-1.1.2 test/unit/event_test.rb
apotomo-1.1.1 test/unit/event_test.rb