Sha256: 21445e914ed2081590d480d567bac349a437b561b9ce326d9dc0cc7abfea0410

Contents?: true

Size: 1.17 KB

Versions: 22

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'
require 'certmeister/test/memory_store_interface'

require 'certmeister/in_memory_store'

describe Certmeister::InMemoryStore do

  class << self
    include Certmeister::Test::MemoryStoreInterface
  end

  it_behaves_like_a_certmeister_store

  describe "for use in testing" do

    it "can be initialized with an existing data set" do
      existing = {'axl.hetzner.africa' => '...cert...'}
      store = Certmeister::InMemoryStore.new(existing)
      expect(store.fetch('axl.hetzner.africa')).to eql '...cert...'
    end

    it "store raises Certmeister::StoreError when broken" do
      subject.send(:break!)
      expect { subject.store('axl.hetzner.africa', "first") }.to raise_error(Certmeister::StoreError)
    end

    it "fetch raises Certmeister::StoreError when broken" do
      subject.send(:break!)
      expect { subject.fetch('axl.hetzner.africa') }.to raise_error(Certmeister::StoreError, "in-memory store is broken")
    end

    it "remove raises Certmeister::StoreError when broken" do
      subject.send(:break!)
      expect { subject.remove('axl.hetzner.africa') }.to raise_error(Certmeister::StoreError, "in-memory store is broken")
    end

  end

end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
certmeister-2.3.2 spec/certmeister/in_memory_store_spec.rb
certmeister-2.3.1 spec/certmeister/in_memory_store_spec.rb
certmeister-2.3.0 spec/certmeister/in_memory_store_spec.rb
certmeister-2.2.0 spec/certmeister/in_memory_store_spec.rb
certmeister-2.1.0 spec/certmeister/in_memory_store_spec.rb
certmeister-2.0.0 spec/certmeister/in_memory_store_spec.rb
certmeister-1.2.1 spec/certmeister/in_memory_store_spec.rb
certmeister-1.2.0 spec/certmeister/in_memory_store_spec.rb
certmeister-1.1.0 spec/certmeister/in_memory_store_spec.rb
certmeister-1.0.1 spec/certmeister/in_memory_store_spec.rb
certmeister-1.0.0 spec/certmeister/in_memory_store_spec.rb
certmeister-0.4.1 spec/certmeister/in_memory_store_spec.rb
certmeister-0.4.0 spec/certmeister/in_memory_store_spec.rb
certmeister-0.3.2 spec/certmeister/in_memory_store_spec.rb
certmeister-0.3.1 spec/certmeister/in_memory_store_spec.rb
certmeister-0.3.0 spec/certmeister/in_memory_store_spec.rb
certmeister-0.2.3 spec/certmeister/in_memory_store_spec.rb
certmeister-0.2.1 spec/certmeister/in_memory_store_spec.rb
certmeister-0.2.0 spec/certmeister/in_memory_store_spec.rb
certmeister-0.1.0 spec/certmeister/in_memory_store_spec.rb