Sha256: 5f4cd02d611fccb353e8b6c1778182a3bec83017a29937e454028c56003b74f3
Contents?: true
Size: 672 Bytes
Versions: 2
Compression:
Stored size: 672 Bytes
Contents
RSpec.describe ROM::Relation, '#primary_key' do subject(:relation) { container.relations.users } include_context 'users and tasks' with_adapters do context 'with schema' do it 'returns configured primary key from the schema' do conf.relation(:users) do schema do attribute :name, ROM::SQL::Types::String.meta(primary_key: true) end end expect(relation.primary_key).to be(:name) end end context 'without schema' do it 'returns :id by default' do conf.relation(:users) { schema(infer: true) } expect(relation.primary_key).to be(:id) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rom-sql-2.0.0.beta2 | spec/unit/relation/primary_key_spec.rb |
rom-sql-2.0.0.beta1 | spec/unit/relation/primary_key_spec.rb |