Sha256: b2517dc7ec5cc7d7d68104e4f0dabe4e5dd2c845a25050f3f765b8aeba9c88d8
Contents?: true
Size: 1.33 KB
Versions: 3
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_context "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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
key_vortex-contract-0.2.5 | lib/key_vortex/contract.rb |
key_vortex-contract-0.2.4 | lib/key_vortex/contract.rb |
key_vortex-contract-0.2.3.1 | lib/key_vortex/contract.rb |