Sha256: 71bd47cb12d668fd722ebc1c6dc5cc85056c7b780a78a71ba7575d1b2ac20e74

Contents?: true

Size: 753 Bytes

Versions: 4

Compression:

Stored size: 753 Bytes

Contents

require 'wisper/rspec/stub_wisper_publisher'

describe '#stub_wisper_publisher' do
  describe "given a piece of code invoking a publisher" do
    class CodeThatReactsToEvents
      def do_something
        publisher = MyPublisher.new
        publisher.on(:some_event) do |variable1, variable2|
          return "Hello with #{variable1} #{variable2}!"
        end
        publisher.execute
      end
    end

    context "when stubbing the publisher to emit an event" do
      before do
        stub_wisper_publisher("MyPublisher", :execute, :some_event, "foo1", "foo2")
      end

      it "emits the event" do
        response = CodeThatReactsToEvents.new.do_something
        expect(response).to eq "Hello with foo1 foo2!"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wisper-1.6.1 spec/lib/wisper/rspec/stub_wisper_publisher_spec.rb
wisper-1.6.0 spec/lib/wisper/rspec/stub_wisper_publisher_spec.rb
wisper-1.5.0 spec/lib/wisper/rspec/stub_wisper_publisher_spec.rb
wisper-1.4.0 spec/lib/wisper/rspec/stub_wisper_publisher_spec.rb