Sha256: c371a2acafc612246c0eb1bc22419391c55fd9edb4e6318192b9916c5ee53d16

Contents?: true

Size: 492 Bytes

Versions: 1

Compression:

Stored size: 492 Bytes

Contents

require "spec_helper"

describe Mapper::Attribute::EmbeddedValue, '#to_ast' do
  subject(:attribute) { Mapper::Attribute::EmbeddedValue.build(:model, node: mapper.loader.node) }

  let(:mapper) { Mapper.build([[:id]], model: model) }
  let(:model) { mock_model(:id) }

  it 'returns a morpher transformer node' do
    loader = Morpher.compile(attribute.to_ast)
    object = model.new(id: 1)
    tuple  = { model: { id: 1 } }

    expect(loader.call(tuple)).to eql([:model, object])
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rom-0.2.0 spec/unit/rom/mapper/attribute/embedded_value/to_ast_spec.rb