main
 1require "spec_helper"
 2
 3describe Publish do
 4  context "when publishing an event" do
 5    let(:event_aggregator) { double("event_aggregator", :publish => true) }
 6
 7    before :each do
 8      allow(Spank::IOC).to receive(:resolve).and_return(event_aggregator)
 9    end
10
11    it "publishes the event using the event aggregator (no message)" do
12      Publish.event(:hello)
13      expect(event_aggregator).to have_received(:publish)
14    end
15
16    it "publishes the event using the event aggregator (with message)" do
17      Publish.event(:hello, "you")
18      expect(event_aggregator).to have_received(:publish).with(:hello, ["you"])
19    end
20  end
21end