Sha256: 98c069d39c72649f54e9e958c176b1fa9ccb433ab08a68fffd47093e2b29c8ed

Contents?: true

Size: 1.3 KB

Versions: 68

Compression:

Stored size: 1.3 KB

Contents

# encoding: utf-8

require "ostruct"
require "spec_helper"
require "amq/client/adapter"

class SampleAdapter
  include AMQ::Client::Adapter
end

describe SampleAdapter do
  before(:all) do
    load "amq/client.rb"
  end

  describe ".settings" do
    it "should provide some default values" do
      described_class.settings.should_not be_nil
      described_class.settings[:host].should_not be_nil
    end
  end

  describe ".logger" do
    it "should provide a default logger" do
      described_class.logger.should respond_to(:debug)
      described_class.logger.should respond_to(:info)
      described_class.logger.should respond_to(:error)
      described_class.logger.should respond_to(:fatal)
    end
  end

  describe ".logger=(logger)" do
    context "when new logger doesn't respond to all the necessary methods" do
      it "should raise an exception" do
        lambda {
          described_class.logger = Object.new
        }.should raise_error(AMQ::Client::Logging::IncompatibleLoggerError)
      end

      it "should pass if the object provides all the necessary methods" do
        described_class.logging = true

        mock = OpenStruct.new(:debug => nil, :info => nil, :error => nil, :fatal => nil)
        described_class.logger = mock
        described_class.logger.should eql(mock)
      end
    end
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
amq-client-0.7.0.alpha7 spec/unit/client/adapter_spec.rb
amq-client-0.7.0.alpha6 spec/unit/client/adapter_spec.rb
amq-client-0.7.0.alpha5 spec/unit/client/adapter_spec.rb
amq-client-0.7.0.alpha4 spec/unit/client/adapter_spec.rb
amq-client-0.7.0.alpha3 spec/unit/client/adapter_spec.rb
amq-client-0.7.0.alpha2 spec/unit/client/adapter_spec.rb
amq-client-0.7.0.alpha1 spec/unit/client/adapter_spec.rb
amq-client-0.5.0 spec/unit/client/adapter_spec.rb