Sha256: 6db812d2cb22a30e0db4c04cafdea363fe0eee040b0b17e46cb4695ab970158b

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

require "spec_helper"

RSpec.describe PubsubNotifier do
  describe ".configure" do
    subject { described_class.configure(&:logger) }
    it { is_expected.to be_a Logger }
  end

  describe ".config" do
    subject { described_class.config }
    it { is_expected.to be_an_instance_of described_class::Config }
  end

  describe ".register_client" do
    let(:name)  { :client }
    let(:klass) { Object }

    before do
      described_class.register_client(name, klass)
    end

    after do
      described_class.config.clients.delete(name)
    end

    it "registers notification client" do
      expect(described_class.config.clients.has_key?(name)).to be true
    end
  end

  describe ".register_broadcaster" do
    let(:name)  { :client }
    let(:klass) { Object }

    subject { described_class.register_broadcaster(name, klass) }

    before do
      config = double("configuration", broadcaster: true)
      allow(Wisper).to receive(:configuration).and_return(config)
    end

    it "register broadcaster" do
      is_expected.to be true
    end
  end

  describe ".init!" do
    it { expect { described_class.init! }.not_to raise_error }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pubsub_notifier-0.1.2 spec/pubsub_notifier_spec.rb