Last active
August 29, 2015 14:04
-
-
Save Papipo/4064648445f1bfc00391 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "unit_helper" | |
require "event_sourcing/event/bus/stream" | |
describe EventSourcing::Event::Bus::Stream do | |
let(:bus_stream) { EventSourcing::Event::Bus::Stream.new(store_stream, event_bus) } | |
let(:store_stream) { instance_double("EventSourcing::Event::Store::Stream") } | |
let(:event_bus) { instance_double("EventSourcing::Event::Bus::Reference") } | |
context "each" do | |
before do | |
# allow call to store_stream.each with block here | |
end | |
let(:enumerable) { double("Enumerable") } | |
let(:block) { lambda {} } | |
it "delegates to the store stream" do | |
expect(bus_stream.each(&block)).to eq(enumerable) | |
end | |
it "is an enumerable" do | |
expect(bus_stream).to be_a(Enumerable) | |
end | |
end | |
end |
cupakromer
commented
Aug 4, 2014
context "each" do
before do
@received_block = nil
allow(store_stream).to receive(:each) { |&b| @received_block = b }
bus_stream.each(&block)
end
let(:block) { lambda {} }
it "delegates to the store stream" do
expect(@received_block).to be(block)
end
it "is an enumerable" do
expect(bus_stream).to be_a(Enumerable)
end
end
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment