Sha256: 2d1dc4f08361a23761aec678b084f5ed280d2da706d54556a790118a9c6e9403

Contents?: true

Size: 578 Bytes

Versions: 4

Compression:

Stored size: 578 Bytes

Contents

require 'rom'
require 'rom/memory'
require 'rom/plugins/relation/key_inference'

RSpec.describe ROM::Plugins::Relation::KeyInference do
  subject(:relation) { relation_class.new([]) }

  let(:relation_class) do
    Class.new(ROM::Memory::Relation) do
      use :key_inference

      dataset :users
    end
  end

  describe '#base_name' do
    it 'returns dataset name by default' do
      expect(relation.base_name).to be(:users)
    end
  end

  describe '#foreign_key' do
    it 'returns default value' do
      expect(relation.foreign_key).to be(:user_id)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rom-1.0.0 spec/unit/rom/plugins/relation/key_inference_spec.rb
rom-1.0.0.rc1 spec/unit/rom/plugins/relation/key_inference_spec.rb
rom-1.0.0.beta2 spec/unit/rom/plugins/relation/key_inference_spec.rb
rom-1.0.0.beta1 spec/unit/rom/plugins/relation/key_inference_spec.rb