Sha256: c798e4baf37283473988499e5bf9d758bcccd3f749f5a30fa4cca8bfb25c3d4e

Contents?: true

Size: 593 Bytes

Versions: 3

Compression:

Stored size: 593 Bytes

Contents

require "spec_helper"

describe Faye::Publisher do
  let(:publisher) { Object.new.extend(Faye::Publisher) }

  describe "with subscribers that remove themselves" do
    before do
      @called_a = false
      @called_b = false

      handler = lambda do
        @called_a = true
        publisher.unbind(:event, &handler)
      end

      publisher.bind(:event, &handler)
      publisher.bind(:event) { @called_b = true }
    end

    it "successfully calls all the callbacks" do
      publisher.trigger(:event)
      @called_a.should == true
      @called_b.should == true
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
faye-0.8.11 spec/ruby/publisher_spec.rb
face-faye-0.8.9 spec/ruby/publisher_spec.rb
faye-0.8.9 spec/ruby/publisher_spec.rb