Sha256: 9c3fd0c8f839db07851b621e45e1faec6cb1de639cefe0d4913d874c4ecd020a
Contents?: true
Size: 788 Bytes
Versions: 2
Compression:
Stored size: 788 Bytes
Contents
require 'spec_helper' class ::Person < Volt::Model has_many :addresses end class ::Address < Volt::Model belongs_to :person end describe Volt::Associations do if RUBY_PLATFORM != 'opal' before do store._people! << {name: 'Jimmy'} @person = store._people[0] @person._addresses! << {city: 'Bozeman'} @person._addresses << {city: 'Portland'} end it 'should associate via belongs_to' do address = store._addresses!.fetch_first.sync expect(address.person.sync._id).to eq(@person._id) end it 'should associate via has_many' do person = store._people!.fetch_first.sync addresses = person.addresses.fetch.sync expect(addresses.size).to eq(2) expect(addresses[0]._city).to eq('Bozeman') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
volt-0.9.1 | spec/models/associations_spec.rb |
volt-0.9.1.pre5 | spec/models/associations_spec.rb |