Sha256: de7a8fe3977384f019d3e150b03e674ea0dc5837291abae6b162dcd6021250e4
Contents?: true
Size: 1.09 KB
Versions: 18
Compression:
Stored size: 1.09 KB
Contents
require 'spec_helper' require 'rom/memory' RSpec.describe 'Mapper definition DSL' do include_context 'container' before do configuration.relation(:users) users = configuration.default.dataset(:users) users.insert( user_id: 1, user_name: 'Joe', user_email: 'joe@doe.com', 'user.skype' => 'joe', :'user.phone' => '1234567890' ) end describe 'prefix' do subject(:mapped_users) { container.relation(:users).as(:users).to_a } it 'applies new separator to the attributes following it' do configuration.mappers do define(:users) do prefix :user attribute :id attribute :name wrap :contacts do attribute :email prefix_separator '.' attribute 'skype' attribute :phone end end end expect(mapped_users).to eql [ { id: 1, name: 'Joe', contacts: { email: 'joe@doe.com', 'skype' => 'joe', phone: '1234567890' } } ] end end end
Version data entries
18 entries across 18 versions & 1 rubygems