Sha256: 5869e470b8cd24f749399b45b4d7bdf8c869a6ae244dcb6cbe0441e2b86e7586

Contents?: true

Size: 919 Bytes

Versions: 4

Compression:

Stored size: 919 Bytes

Contents

require_relative '../../../test_helper'
require_relative '../../../../lib/vedeu/repository/event_repository'

module Vedeu
  describe EventRepository do
    describe '#handlers' do
      it 'returns a Hash' do
        EventRepository.handlers.must_be_instance_of(Hash)
      end
    end

    describe '#register' do
      it 'returns an Array' do
        EventRepository.register(: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
        EventRepository.register(:some_event) { proc { |x| x } }
        EventRepository.trigger(:_exit_, []).first.call
          .must_equal(:exit)
      end

      it 'returns an empty collection when the event has not been registered' do
        EventRepository.trigger(:_not_found_, []).must_be_empty
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.0.34 test/lib/vedeu/support/event_repository_test.rb
vedeu-0.0.33 test/lib/vedeu/support/event_repository_test.rb
vedeu-0.0.32 test/lib/vedeu/support/event_repository_test.rb
vedeu-0.0.31 test/lib/vedeu/support/event_repository_test.rb