Sha256: fa9abd7f8330124f0b62ee182600526284d04620dd91c8a6a4eb8bfcbc57b4a3

Contents?: true

Size: 1.42 KB

Versions: 48

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", id: 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", id: 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

48 entries across 48 versions & 1 rubygems

Version Path
flydata-0.6.8 flydata-core/spec/event/flydata_event_processor_spec.rb
flydata-0.6.7 flydata-core/spec/event/flydata_event_processor_spec.rb
flydata-0.6.6 flydata-core/spec/event/flydata_event_processor_spec.rb
flydata-0.6.5 flydata-core/spec/event/flydata_event_processor_spec.rb
flydata-0.6.4 flydata-core/spec/event/flydata_event_processor_spec.rb
flydata-0.6.3 flydata-core/spec/event/flydata_event_processor_spec.rb
flydata-0.6.2 flydata-core/spec/event/flydata_event_processor_spec.rb
flydata-0.6.1 flydata-core/spec/event/flydata_event_processor_spec.rb