Sha256: 7c0d57f19a3931bec9c28ba8796960bdf82266c47fa9393530525f086d7a70c3

Contents?: true

Size: 1.01 KB

Versions: 11

Compression:

Stored size: 1.01 KB

Contents

require 'helper'

describe Toy::Connection do
  uses_constants('User')

  before do
    @logger = Toy.logger
  end

  after do
    Toy.logger = @logger
  end

  describe ".logger" do
    it "should set the default logger" do
      logger = stub
      Toy.logger = logger
      Toy.logger.should == logger
    end

    it "should be an instance of Logger if not set" do
      Toy.logger = nil
      Toy.logger.should be_instance_of(Logger)
    end

    it "should use RAILS_DEFAULT_LOGGER if defined" do
      remove_constants("RAILS_DEFAULT_LOGGER")
      RAILS_DEFAULT_LOGGER = stub

      Toy.logger = nil
      Toy.logger.should == RAILS_DEFAULT_LOGGER
    end
  end

  describe ".key_factory" do
    it "should set the default key_factory" do
      key_factory = stub
      Toy.key_factory = key_factory
      Toy.key_factory.should == key_factory
    end

    it "should default to the UUIDKeyFactory" do
      Toy.key_factory = nil
      Toy.key_factory.should be_instance_of(Toy::Identity::UUIDKeyFactory)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
toystore-0.8.1 spec/toy/connection_spec.rb
toystore-0.8.0 spec/toy/connection_spec.rb
toystore-0.7.0 spec/toy/connection_spec.rb
toystore-0.6.6 spec/toy/connection_spec.rb
toystore-0.6.5 spec/toy/connection_spec.rb
toystore-0.6.4 spec/toy/connection_spec.rb
toystore-0.6.3 spec/toy/connection_spec.rb
toystore-0.6.2 spec/toy/connection_spec.rb
toystore-0.6.1 spec/toy/connection_spec.rb
toystore-0.6 spec/toy/connection_spec.rb
toystore-0.5 spec/toy/connection_spec.rb