Sha256: a3daf2f7a8e97138b1e6aa8ddb499d11bf99498f261a662cb28d065d8b0e5757

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 Bytes

Contents

require 'spec_helper'

class Waffle::Transports::Redis
  def initialize
  end
end

describe Waffle::Transports::Redis do
  subject{Waffle::Transports::Redis.new}

  let(:redis){mock(:redis)}
  let(:subscription){mock(:subscription)}

  before do
    subject.stub(:db => redis)
  end

  describe '.publish' do
    before{redis.should_receive(:publish).with('events', '"message"')}
    specify{subject.publish('events', 'message')}
  end

  describe '.subscribe' do
    before do
      redis.should_receive(:subscribe).with('events').and_yield(subscription)
      subscription.should_receive(:message).and_yield('event', '{"data":"message"}')
    end
    specify{subject.subscribe('events'){}}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
waffle-0.4.0 spec/waffle/transports/redis_spec.rb