Sha256: 995aa25aa9a10978a8bff11edd0b19e12167295ceeada2543bc67ff59413997e

Contents?: true

Size: 624 Bytes

Versions: 7

Compression:

Stored size: 624 Bytes

Contents

require 'spec_helper'
require 'rom/memory'

describe 'Mapper definition DSL' do
  include_context 'container'

  before do
    configuration.relation(:users)

    users = configuration.default.dataset(:users)

    users.insert(name: 'Joe', email: 'joe@doe.com')
    users.insert(name: 'Jane', email: 'jane@doe.com')
  end

  describe 'exclude' do
    let(:mapped_users) { container.relation(:users).as(:users).to_a }

    it 'removes the attribute' do
      configuration.mappers do
        define(:users) { exclude :email }
      end

      expect(mapped_users).to eql [{ name: 'Joe' }, { name: 'Jane' }]
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rom-2.0.2 spec/integration/mappers/exclude_spec.rb
rom-2.0.1 spec/integration/mappers/exclude_spec.rb
rom-2.0.0 spec/integration/mappers/exclude_spec.rb
rom-1.0.0 spec/integration/mappers/exclude_spec.rb
rom-1.0.0.rc1 spec/integration/mappers/exclude_spec.rb
rom-1.0.0.beta2 spec/integration/mappers/exclude_spec.rb
rom-1.0.0.beta1 spec/integration/mappers/exclude_spec.rb