Sha256: 508b74cea6af6a8eae2e6cb17b5662a87eab4c6ef19e4ae4e48077c9ca84a530

Contents?: true

Size: 1011 Bytes

Versions: 1

Compression:

Stored size: 1011 Bytes

Contents

require 'spec_helper'
require 'flirt/flirt_test_classes'

describe Flirt do

    describe "with a single :pancake_fried subscriber" do

        let(:response)    { { topping: "cream" } }
        let(:event)       { :pancake_fried }
        let(:wrong_event) { :spud_baked }
        let!(:listener)   { TestListener.new(event) }

        it "listens to the correct broadcast event" do
            Flirt.broadcast event, response
            expect(listener.responded).to eq(response)
        end

        it "listens to the correct publish event" do
            Flirt.publish event, response
            expect(listener.responded).to eq(response)
        end

        it "doesn't listen to the wrong broadcast event" do
            Flirt.broadcast wrong_event, response
            expect(listener.responded).to be_nil
        end

        it "doesn't listen to the wrong publish event" do
            Flirt.broadcast wrong_event, response
            expect(listener.responded).to be_nil
        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flirt-0.0.1 spec/flirt/flirt_spec.rb