Sha256: 1a9ae8bf88ea9e1d2cc8d494cfe3ef9815545c86d075db52ec4feb9127be22f6

Contents?: true

Size: 753 Bytes

Versions: 5

Compression:

Stored size: 753 Bytes

Contents

require 'spec_helper'
require 'wisper/rspec/stub_wisper_publisher'

describe Wisper 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
        response.should == "Hello with foo1 foo2!"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wisper-1.3.0 spec/lib/rspec_extensions_spec.rb
wisper-1.2.1 spec/lib/rspec_extensions_spec.rb
wisper-1.2.0 spec/lib/rspec_extensions_spec.rb
wisper-1.1.0 spec/lib/rspec_extensions_spec.rb
wisper-1.0.1 spec/lib/rspec_extensions_spec.rb