Sha256: e039b1ad78393e561f92cf3977756be868b2f6077f0a3258e4ad65781474fc00

Contents?: true

Size: 895 Bytes

Versions: 1

Compression:

Stored size: 895 Bytes

Contents

require "spec_helper"

require "blobby/in_memory_store"
require "blobby/logging_store"
require "blobby/store_behaviour"
require "logger"
require "stringio"

describe Blobby::LoggingStore do

  let(:backing_store) { Blobby::InMemoryStore.new }
  let(:log_buffer) { StringIO.new }
  let(:logger) { Logger.new(log_buffer) }
  let(:log_output) { log_buffer.string }

  subject do
    described_class.new(backing_store, "THE STORE", logger)
  end

  it_behaves_like Blobby::Store

  describe "#write" do

    before do
      subject["foo"].write("bar")
    end

    it "logs the write" do
      expect(log_output).to include(%(wrote to "foo" in THE STORE))
    end

  end

  describe "#delete" do

    before do
      subject["foo"].write("bar")
      subject["foo"].delete
    end

    it "logs the delete" do
      expect(log_output).to include(%(deleted "foo" from THE STORE))
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blobby-1.1.0 spec/blobby/logging_store_spec.rb