Sha256: b5c25a51f6360f7ebc9440caa2db2590a991987fb630a86b4d3801ea608e9f6f

Contents?: true

Size: 592 Bytes

Versions: 5

Compression:

Stored size: 592 Bytes

Contents

require 'rom/memory'

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

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

      view(:base, [:id, :name]) do
        self
      end

      view(:ids, [:id]) do
        self
      end
    end
  end

  describe '#attributes' do
    it 'returns base view attributes by default' do
      expect(relation.attributes).to eql([:id, :name])
    end

    it 'returns attributes for a configured view' do
      expect(relation.ids.attributes).to eql([:id])
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rom-repository-0.3.1 spec/unit/plugins/view_spec.rb
rom-repository-0.3.0 spec/unit/plugins/view_spec.rb
rom-repository-0.2.0 spec/unit/plugins/view_spec.rb
rom-repository-0.2.0.rc1 spec/unit/plugins/view_spec.rb
rom-repository-0.2.0.beta1 spec/unit/plugins/view_spec.rb