File: publisher_spec.rb

package info (click to toggle)
ruby-faye 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 1,792 kB
  • sloc: javascript: 14,833; ruby: 5,068; makefile: 30
file content (26 lines) | stat: -rw-r--r-- 599 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require "spec_helper"

describe Faye::Publisher do
  let(:publisher) { Class.new { include Faye::Publisher }.new }

  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