Sha256: 9e0e7df92640f031bcaafd13795fea37027ca83738f38e65321d6225022715ec

Contents?: true

Size: 887 Bytes

Versions: 2

Compression:

Stored size: 887 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 User :memory "foo"')
      User.logger.should_receive(:debug).with('  "bar"')
      User.log_operation(:get, User, 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 User :memory "foo"')
      User.logger.should_receive(:debug).with('  "bar"')
      User.log_operation(:get, User, adapter, 'foo', 'bar')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
toystore-0.8.0 spec/toy/logger_spec.rb
toystore-0.7.0 spec/toy/logger_spec.rb