Sha256: d98d2b7c5c8040e5dc0f4100aafd4b7b1af3fe5f7eafa7dc6a4456f8ef8f3e8f

Contents?: true

Size: 499 Bytes

Versions: 2

Compression:

Stored size: 499 Bytes

Contents

require 'spec_helper'

class MyPublisher
  include Wisper

  def do_something
    # ...
    broadcast(:bar, self)
    broadcast(:foo, self)
  end
end

describe 'simple publishing' do
  it 'subscribes listener to events' do
    listener = double('listener')
    listener.should_receive(:foo).with instance_of MyPublisher
    listener.should_receive(:bar).with instance_of MyPublisher

    my_publisher = MyPublisher.new
    my_publisher.add_listener(listener)
    my_publisher.do_something
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wisper-1.0.1 spec/lib/simple_example_spec.rb
wisper-1.0.0 spec/lib/simple_example_spec.rb