Sha256: 93f2bc4817903d6f4a25b99e77b594d9dfe1d7e7e19fdc28f776c5d9ab03fa80

Contents?: true

Size: 1.03 KB

Versions: 17

Compression:

Stored size: 1.03 KB

Contents

require "spec_helper"

describe Shamu::Events::InMemory::AsyncService do
  let( :service ) { scorpion.new Shamu::Events::InMemory::AsyncService }
  let( :message ) { Shamu::Events::Message.new }

  describe "#publish" do
    it "adds message to channel" do
      expect do
        service.publish( "spec", message )
      end.to change { service.channel_stats( "spec" )[ :queue_size ] }
    end

    it "serializes the message" do
      expect( service ).to receive( :serialize ).and_call_original
      service.publish( "spec", message )
    end
  end

  describe "#subscribe" do
    it "receives a message" do
      expect do |b|
        service.subscribe "spec", &b
        service.publish "spec", message

        wait_for { service.channel_stats( "spec" )[ :queue_size ] }.to eq 0
      end.to yield_control
    end

    it "deserializes the message" do
      expect( service ).to receive( :deserialize ).and_call_original
      service.publish "spec", message
      wait_for { service.channel_stats( "spec" )[ :queue_size ] }.to eq 0
    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
shamu-0.0.24 spec/lib/shamu/events/in_memory/async_service_spec.rb
shamu-0.0.21 spec/lib/shamu/events/in_memory/async_service_spec.rb
shamu-0.0.20 spec/lib/shamu/events/in_memory/async_service_spec.rb
shamu-0.0.19 spec/lib/shamu/events/in_memory/async_service_spec.rb
shamu-0.0.18 spec/lib/shamu/events/in_memory/async_service_spec.rb
shamu-0.0.17 spec/lib/shamu/events/in_memory/async_service_spec.rb
shamu-0.0.15 spec/lib/shamu/events/in_memory/async_service_spec.rb
shamu-0.0.14 spec/lib/shamu/events/in_memory/async_service_spec.rb
shamu-0.0.13 spec/lib/shamu/events/in_memory/async_service_spec.rb
shamu-0.0.11 spec/lib/shamu/events/in_memory/async_service_spec.rb
shamu-0.0.9 spec/lib/shamu/events/in_memory/async_service_spec.rb
shamu-0.0.8 spec/lib/shamu/events/in_memory/async_service_spec.rb
shamu-0.0.7 spec/lib/shamu/events/in_memory/async_service_spec.rb
shamu-0.0.5 spec/lib/shamu/events/in_memory/async_service_spec.rb
shamu-0.0.4 spec/lib/shamu/events/in_memory/async_service_spec.rb
shamu-0.0.3 spec/lib/shamu/events/in_memory/async_service_spec.rb
shamu-0.0.2 spec/lib/shamu/events/in_memory/async_service_spec.rb