Sha256: 6778e9eac86f74d359065109fe877ee67c761d129b2ecaf59a81e5448e459bd4

Contents?: true

Size: 1.2 KB

Versions: 11

Compression:

Stored size: 1.2 KB

Contents

shared_examples :marshallable_key do
  it 'refuses to #[] from keys that cannot be marshalled' do
    expect do
      store[Struct.new(:foo).new(:bar)]
    end.to raise_error(marshal_error)
  end

  it 'refuses to load from keys that cannot be marshalled' do
    expect do
      store.load(Struct.new(:foo).new(:bar))
    end.to raise_error(marshal_error)
  end

  it 'refuses to fetch from keys that cannot be marshalled' do
    expect do
      store.fetch(Struct.new(:foo).new(:bar), true)
    end.to raise_error(marshal_error)
  end

  it 'refuses to #[]= to keys that cannot be marshalled' do
    expect do
      store[Struct.new(:foo).new(:bar)] = 'value'
    end.to raise_error(marshal_error)
  end

  it 'refuses to store to keys that cannot be marshalled' do
    expect do
      store.store Struct.new(:foo).new(:bar), 'value'
    end.to raise_error(marshal_error)
  end

  it 'refuses to check for #key? if the key cannot be marshalled' do
    expect do
      store.key? Struct.new(:foo).new(:bar)
    end.to raise_error(marshal_error)
  end

  it 'refuses to delete a key if the key cannot be marshalled' do
    expect do
      store.delete Struct.new(:foo).new(:bar)
    end.to raise_error(marshal_error)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
moneta-1.5.2 spec/features/marshallable_key.rb
moneta-1.5.1 spec/features/marshallable_key.rb
moneta-1.5.0 spec/features/marshallable_key.rb
moneta-1.4.2 spec/features/marshallable_key.rb
moneta-1.4.1 spec/features/marshallable_key.rb
moneta-1.4.0 spec/features/marshallable_key.rb
moneta-1.3.0 spec/features/marshallable_key.rb
moneta-1.2.1 spec/features/marshallable_key.rb
moneta-1.2.0 spec/features/marshallable_key.rb
moneta-1.1.1 spec/features/marshallable_key.rb
moneta-1.1.0 spec/features/marshallable_key.rb