Sha256: cdcaf0539621a76fcd8ee4e474b9e26501f39139cec0e58f767e8e4e550bb3ed

Contents?: true

Size: 867 Bytes

Versions: 3

Compression:

Stored size: 867 Bytes

Contents

require 'helper'

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

  it "should use Toy.logger for class" do
    User.logger.should == Toy.logger
  end

  it "should use Toy.logger for instance" do
    User.new.logger.should == Toy.logger
  end

  describe ".log_operation" do
    let(:adapter) { Adapter[:memory].new({}) }

    it "logs operation" do
      User.logger.should_receive(:debug).with('ToyStore GET :memory "foo"')
      User.logger.should_receive(:debug).with('  "bar"')
      User.log_operation('GET', adapter, 'foo', 'bar')
    end
  end

  describe "#log_operation" do
    let(:adapter) { Adapter[:memory].new({}) }

    it "logs operation" do
      User.logger.should_receive(:debug).with('ToyStore GET :memory "foo"')
      User.logger.should_receive(:debug).with('  "bar"')
      User.log_operation('GET', adapter, 'foo', 'bar')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
toystore-0.6.1 spec/toy/logger_spec.rb
toystore-0.6 spec/toy/logger_spec.rb
toystore-0.5 spec/toy/logger_spec.rb