Sha256: 1671acc0340fb346265cceaed01e481567f6c4e43366afc1b6e87c61d1ecb581

Contents?: true

Size: 993 Bytes

Versions: 4

Compression:

Stored size: 993 Bytes

Contents

require 'test_helper'

class EventTest < MiniTest::Spec
  include Apotomo::TestCaseMethods::TestController

  describe "Event" do
    it "is a kind of Onfire::Event" do
      @event = Apotomo::Event.new(:footsteps, 'mum')

      assert_kind_of Onfire::Event, @event
    end

    it "respond to #type and #source" do
      @event = Apotomo::Event.new(:footsteps, 'mum')

      assert_equal :footsteps, @event.type
      assert_equal 'mum', @event.source
    end

    it "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

    it "delegate #[] to data" do
      @event = Apotomo::Event.new(:footsteps, 'mum', {:volume => :loud})

      assert_equal :loud, @event[:volume]
    end

    it "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.3.2 test/event_test.rb
apotomo-1.3.1 test/event_test.rb
apotomo-1.3.0 test/event_test.rb
apotomo-1.2.6 test/event_test.rb