Sha256: 36bccf51a110b1b54ee229024f7fabc18df3966a2d6366c447ccd9913a54efea

Contents?: true

Size: 577 Bytes

Versions: 23

Compression:

Stored size: 577 Bytes

Contents

RSpec.describe ROM::SQL::Schema, :postgres do
  describe '#primary_key' do
    it 'returns primary key attributes' do
      schema = Class.new(ROM::Relation[:sql]).schema do
        attribute :id, ROM::SQL::Types::Serial
      end

      schema.finalize!

      expect(schema.primary_key).to eql([schema[:id]])
    end

    it 'returns empty array when there is no PK defined' do
      schema = Class.new(ROM::Relation[:sql]).schema do
        attribute :id, ROM::SQL::Types::Int
      end

      schema.finalize!

      expect(schema.primary_key).to eql([])
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
rom-sql-1.3.5 spec/unit/schema_spec.rb
rom-sql-1.3.4 spec/unit/schema_spec.rb
rom-sql-1.3.3 spec/unit/schema_spec.rb
rom-sql-1.3.2 spec/unit/schema_spec.rb
rom-sql-1.3.1 spec/unit/schema_spec.rb
rom-sql-1.3.0 spec/unit/schema_spec.rb
rom-sql-1.2.2 spec/unit/schema_spec.rb
rom-sql-1.2.1 spec/unit/schema_spec.rb
rom-sql-1.2.0 spec/unit/schema_spec.rb
rom-sql-1.1.2 spec/unit/schema_spec.rb
rom-sql-1.1.1 spec/unit/schema_spec.rb
rom-sql-1.1.0 spec/unit/schema_spec.rb
rom-sql-1.0.3 spec/unit/schema_spec.rb
rom-sql-1.0.2 spec/unit/schema_spec.rb
rom-sql-1.0.1 spec/unit/schema_spec.rb
rom-sql-1.0.0 spec/unit/schema_spec.rb
rom-sql-1.0.0.rc2 spec/unit/schema_spec.rb
rom-sql-1.0.0.rc1 spec/unit/schema_spec.rb
rom-sql-1.0.0.beta3 spec/unit/schema_spec.rb
rom-sql-1.0.0.beta2 spec/unit/schema_spec.rb