Sha256: 18d38440f780841e526f37aaa007abee5f0f5d2f95f917ee09d3cdd153662db4

Contents?: true

Size: 706 Bytes

Versions: 25

Compression:

Stored size: 706 Bytes

Contents

RSpec.describe ROM::Relation, '#associations' 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(infer: true) do
            associations do
              has_many :tasks
            end
          end
        end

        expect(relation.associations[:tasks]).to be(container.relations.users.schema.associations[:tasks])
      end
    end

    context 'without schema' do
      it 'returns an empty association set' do
        expect(relation.associations.elements).to be_empty
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

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