Sha256: 3b294a89664d12627f46f7ce465a0cfc8db62673b3fe29e4863aef1bbf85a89d

Contents?: true

Size: 746 Bytes

Versions: 5

Compression:

Stored size: 746 Bytes

Contents

require 'test_helper'
require 'vedeu/support/events'

module Vedeu
  describe Events do
    describe '#on' do
      it 'returns an Array' do
        events = Events.new
        events.on(:some_event) { proc { |x| x } }
          .must_be_instance_of(Array)
      end
    end

    describe '#trigger' do
      it 'returns a collection containing the event when the event is pre-registered' do
        events = Events.new do
          on(:_exit_) { fail StopIteration }
        end
        proc { events.trigger(:_exit_) }.must_raise(StopIteration)
      end

      it 'returns an empty collection when the event has not been registered' do
        events = Events.new
        events.trigger(:_not_found_).must_be_empty
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.1.1 test/lib/vedeu/support/events_test.rb
vedeu-0.1.0 test/lib/vedeu/support/events_test.rb
vedeu-0.0.42 test/lib/vedeu/support/events_test.rb
vedeu-0.0.41 test/lib/vedeu/support/events_test.rb
vedeu-0.0.40 test/lib/vedeu/support/events_test.rb