Sha256: f0513538bd244c313760e3c0fd8adc6c704e2fe2b9d07ca9aed68cc59c402011
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
# frozen_string_literal: true require "key_vortex/record" require "securerandom" class SampleRecord < KeyVortex::Record field :sample, String, length: 10 end class SampleRecordTwo < KeyVortex::Record field :sample, String, length: 10 end require "rantly/rspec_extensions" RSpec.shared_examples "an adapter" do |build_args = {}| around(:each) do |s| property_of { string }.check(100) do |sample| @sample = sample s.run end end let(:store) do KeyVortex.new( subject, SampleRecord ) end let(:record1) do SampleRecord.new( key: SecureRandom.uuid, sample: @sample ) end let(:record2) do SampleRecordTwo.new( key: SecureRandom.uuid, sample: @sample ) end it "registers a symbol on KeyVortex" do vortex = KeyVortex.vortex(described_class.symbol, SampleRecord, **build_args) expect(vortex.adapter).to be_a(described_class) end it "stores and removes a key" do store.save(record1) expect(store.find(record1.key)).to eq(record1) subject.remove(record1.key) expect(store.find(record1.key)).to be_nil end it "recreates the class that was provided" do store.save(record1) expect(store.find(record1.key)).to be_a(SampleRecord) store.save(record2) expect(store.find(record2.key)).to be_a(SampleRecordTwo) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
key_vortex-contract-1.0.0 | lib/key_vortex/contract.rb |