Sha256: 462ae143a930f0948347775b7a82154864db73c7f983fd97283890c3c404f3e7

Contents?: true

Size: 608 Bytes

Versions: 1

Compression:

Stored size: 608 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Mapper::Header, '#keys' do
  subject { object.keys }

  let(:object)  { Mapper::Header.build(attributes) }
  let(:id)      { object[:id] }
  let(:name)    { object[:name] }

  context 'without mapping' do
    let(:attributes) { [[:id], [:name]] }

    it { should eql([]) }
  end

  context 'with mapping' do
    let(:attributes) { [[:id, from: :user_id, key: true], [:name]] }

    it { should eql([id]) }
  end

  context 'with multiple keys' do
    let(:attributes) { [[:id, key: true], [:name, key: true]] }

    it { should eql([id, name]) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rom-0.2.0 spec/unit/rom/mapper/header/keys_spec.rb