Sha256: 06679df32d8d6ad34d0912036a3165fcb8f60fbf0c4ab085645d51f4ae09d5d9
Contents?: true
Size: 992 Bytes
Versions: 2
Compression:
Stored size: 992 Bytes
Contents
require 'spec_helper' module Test class Status include Virtus.model attribute :code, Integer end class Position include Virtus.model attribute :name attribute :status, Status end class User include Virtus.model attribute :name, String attribute :position, Test::Position end end describe Whisperer::Convertors::Hash do describe '#convert' do let(:attrs) { { name: 'Tester', position: { name: 'developer', status: { code: 1 } } } } let(:expected_attrs) { { 'name' => 'Tester', 'position' => { 'name' => 'developer', 'status' => { 'code' => 1 } } } } subject { described_class.new(Test::User.new(attrs)) } it 'returns a hash with all related objects' do expect(subject.convert).to eq( expected_attrs ) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
whisperer-0.0.2 | spec/unit/convertors/hash_spec.rb |
whisperer-0.0.1 | spec/unit/convertors/hash_spec.rb |