Sha256: ace2030b2c9fce4954375a14fbf570f62d367e7161e0a4850c79f834bffd1fd7

Contents?: true

Size: 1.16 KB

Versions: 16

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper.rb'

# Most of this class is just interacting with Rabbit so it's covered
# by the integration tests.
describe Pwwka::ChannelConnector do
  let(:bunny_session) { instance_double(Bunny::Session) }

  before do
    allow(Bunny).to receive(:new).and_return(bunny_session)
    allow(bunny_session).to receive(:start)
    allow(bunny_session).to receive(:create_channel)
    @default_allow_delayed = Pwwka.configuration.options[:allow_delayed]
  end

  after do
    Pwwka.configuration.options[:allow_delayed] = @default_allow_delayed
  end

  subject(:channel_connector) { described_class.new }

  describe "raise_if_delayed_not_allowed" do
    context "delayed is configured" do
      it "does not blow up" do
        Pwwka.configuration.options[:allow_delayed] = true
        expect {
          channel_connector.raise_if_delayed_not_allowed
        }.not_to raise_error
      end
    end
    context "delayed is not configured" do
      it "blows up" do
        Pwwka.configuration.options[:allow_delayed] = false
        expect {
          channel_connector.raise_if_delayed_not_allowed
        }.to raise_error(Pwwka::ConfigurationError)
      end
    end
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
pwwka-0.14.0 spec/unit/channel_connector_spec.rb
pwwka-0.13.3 spec/unit/channel_connector_spec.rb
pwwka-0.13.2 spec/unit/channel_connector_spec.rb
pwwka-0.13.1 spec/unit/channel_connector_spec.rb
pwwka-0.13.0 spec/unit/channel_connector_spec.rb
pwwka-0.13.0.RC2 spec/unit/channel_connector_spec.rb
pwwka-0.13.0.RC1 spec/unit/channel_connector_spec.rb
pwwka-0.12.0 spec/unit/channel_connector_spec.rb
pwwka-0.12.0.RC2 spec/unit/channel_connector_spec.rb
pwwka-0.12.0.RC1 spec/unit/channel_connector_spec.rb
pwwka-0.11.0 spec/unit/channel_connector_spec.rb
pwwka-0.11.0.RC1 spec/unit/channel_connector_spec.rb
pwwka-0.10.0 spec/unit/channel_connector_spec.rb
pwwka-0.10.0.RC spec/unit/channel_connector_spec.rb
pwwka-0.9.0 spec/unit/channel_connector_spec.rb
pwwka-0.9.0.RC1 spec/unit/channel_connector_spec.rb