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-1.0.4 spec/unit/client/adapter_spec.rb
amq-client-1.0.3 spec/unit/client/adapter_spec.rb
amq-client-1.1.0.pre1 spec/unit/client/adapter_spec.rb
amq-client-1.0.2 spec/unit/client/adapter_spec.rb
amq-client-1.0.1 spec/unit/client/adapter_spec.rb
amq-client-1.0.0 spec/unit/client/adapter_spec.rb
amq-client-0.9.12 spec/unit/client/adapter_spec.rb
amq-client-0.9.11 spec/unit/client/adapter_spec.rb
amq-client-0.9.10 spec/unit/client/adapter_spec.rb
amq-client-0.9.9 spec/unit/client/adapter_spec.rb
amq-client-0.9.8 spec/unit/client/adapter_spec.rb
amq-client-0.9.7 spec/unit/client/adapter_spec.rb
amq-client-0.9.6 spec/unit/client/adapter_spec.rb
amq-client-0.9.5 spec/unit/client/adapter_spec.rb
amq-client-0.9.4 spec/unit/client/adapter_spec.rb
amq-client-1.0.0.pre2 spec/unit/client/adapter_spec.rb
amq-client-0.9.3 spec/unit/client/adapter_spec.rb
amq-client-1.0.0.pre1 spec/unit/client/adapter_spec.rb
amq-client-0.9.2 spec/unit/client/adapter_spec.rb
amq-client-0.9.1 spec/unit/client/adapter_spec.rb