Sha256: 5d0ae552adeb8946712dcf70aa5f80b5068e0d35af861474d05422aec6c8e4c0

Contents?: true

Size: 936 Bytes

Versions: 2

Compression:

Stored size: 936 Bytes

Contents

require 'test_helper'

class EventTest < Test::Unit::TestCase
  context "An event" do
    should "accept its type and source in the constructor" do
      event = Onfire::Event.new(:click, :source)
      
      assert_equal :click,  event.type
      assert_equal :source, event.source
      assert_nil  event.data
    end
    
    should "be fine without any parameters at all" do
      event = Onfire::Event.new
      
      assert_nil  event.type
      assert_nil  event.source
      assert_nil  event.data
    end
    
    should "accept payload data" do
      event = Onfire::Event.new(:drag, :source, :target => 'me')
      
      assert_equal :drag,   event.type
      assert_equal :source, event.source
      assert_equal({:target => 'me'}, event.data)
    end
    
    should "stop if needed" do
      event = Onfire::Event.new
      
      assert ! event.stopped?
      event.stop!
      assert event.stopped?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
onfire-0.1.2 test/event_test.rb
onfire-0.1.1 test/event_test.rb