Sha256: 72df95b7ff26ebb46d3c58a7a3a0f2ae2756773e92a55fb13abe1ffa8a838da2

Contents?: true

Size: 942 Bytes

Versions: 1

Compression:

Stored size: 942 Bytes

Contents

require "spec_helper"

require "sequel_mapper/public_conveniencies"

RSpec.describe SequelMapper::PublicConveniencies do
  subject(:conveniences) {
    Module.new.extend(SequelMapper::PublicConveniencies)
  }

  describe "#mapper" do
    let(:datastore) {
      {
        things: [ thing_record ],
      }
    }

    let(:mapper_config) {
      {
        things: double(
          :thing_config,
          namespace: :things,
          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
      expect(
        conveniences
          .mapper(
            config: mapper_config,
            datastore: datastore,
            name: mapping_name,
          )
          .all.first.fetch(:id)
      ).to eq("THE THING")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sequel_mapper-0.0.3 spec/sequel_mapper/public_conveniencies_spec.rb