Sha256: f20f5d60f948a185227864861f60f2701dbb320be1cfdc7675b9e9a69576bf32

Contents?: true

Size: 889 Bytes

Versions: 5

Compression:

Stored size: 889 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

5 entries across 5 versions & 1 rubygems

Version Path
toystore-0.6.6 spec/toy/logger_spec.rb
toystore-0.6.5 spec/toy/logger_spec.rb
toystore-0.6.4 spec/toy/logger_spec.rb
toystore-0.6.3 spec/toy/logger_spec.rb
toystore-0.6.2 spec/toy/logger_spec.rb