Sha256: f2f023fe1ec27b5c3a8161fb5cb47da44e0f7b659c6bd52e2a55d784f8710f5f
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
require "spec_helper" require "terrestrial/public_conveniencies" RSpec.describe Terrestrial::PublicConveniencies do subject(:conveniences) { Module.new.extend(Terrestrial::PublicConveniencies) } class MockDatastore < DelegateClass(Hash) def transaction(&block) block.call end end describe "#mappers" do let(:datastore) { MockDatastore.new( { things: [ thing_record ], } ) } let(:mapper_config) { { things: double( :thing_config, name: mapping_name, namespace: :things, fields: [:id], associations: [], primary_key: [], factory: ->(x){x} ) } } let(:mapping_name) { :things } let(:thing_record) { { id: "THE THING", } } it "returns a mapper for the specified mapping" do mappers = conveniences.mappers( mappings: mapper_config, datastore: datastore, ) expect( mappers[:things].all.first.fetch(:id) ).to eq("THE THING") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
terrestrial-0.1.1 | spec/sequel_mapper/public_conveniencies_spec.rb |