Sha256: 1dd16f397c22fe780d958350bcee3644b8c908daf8b3aa3e57c00e63dd6031cd

Contents?: true

Size: 770 Bytes

Versions: 6

Compression:

Stored size: 770 Bytes

Contents

require 'wisper'
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

6 entries across 6 versions & 1 rubygems

Version Path
wisper-rspec-1.1.0 spec/wisper/rspec/stub_wisper_publisher_spec.rb
wisper-rspec-1.0.1 spec/wisper/rspec/stub_wisper_publisher_spec.rb
wisper-rspec-1.0.0 spec/wisper/rspec/stub_wisper_publisher_spec.rb
wisper-rspec-0.0.3 spec/wisper/rspec/stub_wisper_publisher_spec.rb
wisper-rspec-0.0.2 spec/wisper/rspec/stub_wisper_publisher_spec.rb
wisper-rspec-0.0.1 spec/wisper/rspec/stub_wisper_publisher_spec.rb