Sha256: e7726d11a0a8b70c794b850709baf927360e9237f384d9c16e0ea1334dcb4e28

Contents?: true

Size: 781 Bytes

Versions: 3

Compression:

Stored size: 781 Bytes

Contents

require 'spec_helper'

describe Waffle::Event do
  describe '.occured' do
    let(:flow){'event name'}
    let(:now){Time.now}
    let(:options){{:event_name => flow, :queue => :default}}
    let(:transport){double(:transport)}
    
    before do
      Time.stub(:now => now)
      Waffle.should_receive(:queue).with(:default).and_return(transport)
      transport.should_receive(:publish).with(flow, message)
    end
    
    context do
      let(:message){{"key1" => "value1", "key2" => "value2", "occured_at" => now}}
      specify{Waffle::Event.occured(message, {:event_name => flow})}
    end
    
    context do
      let(:message){{"body" => "message data", "occured_at" => now}}
      specify{Waffle::Event.occured('message data', {:event_name => flow})}
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
waffle-0.6.0 spec/waffle/event_spec.rb
waffle-0.5.1 spec/waffle/event_spec.rb
waffle-0.5.0 spec/waffle/event_spec.rb