Sha256: d722d1847e2601353b1c247ce655e159c461a82207c4d13962c1a6df87399cf5

Contents?: true

Size: 1.42 KB

Versions: 3

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'
require 'flydata-core/event/flydata_event_processor'
require 'flydata-core/event/flydata_event'
require 'event/shared_event'

module FlydataCore
  module Event
    describe  FlydataEventProcessor do
      describe "#process" do

        context "when event has one verb handler and one any verb handler," do
          let(:event) {FlydataEvent.new("test2","testing",nil, 1)}
          it "should call both handlers" do
            expect(AnyHandler).to receive(:handle).with(event)
            expect(Handler3).to receive(:handle).with(event)
            FlydataEventProcessor.process(event)
          end
        end

        context "when event has two handlers," do
          let(:event) {FlydataEvent.new("test","testing",nil, 1)}
          it "should call both handlers" do
            expect(Handler1).to receive(:handle).with(event)
            expect(Handler2).to receive(:handle).with(event)
            FlydataEventProcessor.process(event)
          end
        end

        context "when a event has no handlers," do
          let(:event) {FlydataEvent.new("test5","testing")}
          it "no handler should be called" do
            expect(Handler1).not_to receive(:handle).with(event)
            expect(Handler2).not_to receive(:handle).with(event)
            expect(Handler3).not_to receive(:handle).with(event)
            FlydataEventProcessor.process(event)
          end
        end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flydata-0.6.0 flydata-core/spec/event/flydata_event_processor_spec.rb
flydata-0.5.21 flydata-core/spec/event/flydata_event_processor_spec.rb
flydata-0.5.20 flydata-core/spec/event/flydata_event_processor_spec.rb