Sha256: 4442698dd9622f3aca670954c41f16390cdd13fba947b9c15689b8568695703e

Contents?: true

Size: 725 Bytes

Versions: 8

Compression:

Stored size: 725 Bytes

Contents

require 'spec_helper'
require 'rom/lint/spec'

require 'rom/memory/dataset'

RSpec.describe ROM::Memory::Dataset do
  subject(:dataset) { ROM::Memory::Dataset.new(data) }

  let(:data) do
    [
      { name: 'Jane', email: 'jane@doe.org', age: 10 },
      { name: 'Jade', email: 'jade@doe.org', age: 11 },
      { name: 'Joe', email: 'joe@doe.org', age: 12 }
    ]
  end

  it_behaves_like "a rom enumerable dataset"

  describe 'subclassing' do
    it 'supports options' do
      descendant = Class.new(ROM::Memory::Dataset) do
        option :path
      end

      dataset = descendant.new([1, 2, 3], path: '/data')

      expect(dataset.to_a).to eql([1, 2, 3])
      expect(dataset.path).to eql('/data')
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rom-3.3.3 spec/unit/rom/memory/dataset_spec.rb
rom-3.3.2 spec/unit/rom/memory/dataset_spec.rb
rom-3.3.1 spec/unit/rom/memory/dataset_spec.rb
rom-3.3.0 spec/unit/rom/memory/dataset_spec.rb
rom-3.2.3 spec/unit/rom/memory/dataset_spec.rb
rom-3.2.2 spec/unit/rom/memory/dataset_spec.rb
rom-3.2.1 spec/unit/rom/memory/dataset_spec.rb
rom-3.2.0 spec/unit/rom/memory/dataset_spec.rb