Sha256: c1c4dbf5d0a82875675c7fce0c6881a2464ba41f01763d621d9fee120eb6b30d
Contents?: true
Size: 979 Bytes
Versions: 1
Compression:
Stored size: 979 Bytes
Contents
require 'spec_helper' describe ROM::Transformer do subject(:transformer) { ROM::Transformer.build(header) } let(:header) do ROM::Header.coerce([ [:name], [:address, type: Hash, header: [[:street], [:zipcode]]], [:tasks, type: Array, header: [[:title], [:priority]]] ]) end let(:relation) do [{ name: 'Jane', street: 'Street 1', zipcode: '123', title: 'Sing a song', priority: 'high' }, { name: 'Jane', street: 'Street 1', zipcode: '123', title: 'Relax', priority: 'very-high' }] end it 'transforms a tuple' do expect(transformer.call(relation)).to eql([ name: 'Jane', address: { street: 'Street 1', zipcode: '123' }, tasks: [ { title: 'Sing a song', priority: 'high' }, { title: 'Relax', priority: 'very-high' } ] ]) end it 'skip transforming if tuple is empty' do expect(transformer.call([])).to eql([]) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rom-0.4.2 | spec/unit/rom/transformer_spec.rb |