Sha256: 1c81627b7069f28ab03de3f94b9b1762c8e46b26512912e459e88ed7659dda72
Contents?: true
Size: 794 Bytes
Versions: 11
Compression:
Stored size: 794 Bytes
Contents
require_relative '../spec_helper' describe RestfulResource::Associations do describe "#has_many" do it "should add a method to access nested resource" do make = Make.new({ name: 'Volkswagen', models: [ {name: 'Golf', rrp: 1000}, {name: 'Passat', rrp: 3000} ] }) expect(make.models.first.name).to eq 'Golf' expect(make.models.last.name).to eq 'Passat' expect(make.models.first.rrp).to eq 1000 expect(make.models.last.rrp).to eq 3000 end end describe "#has_one" do it "should add a method to access nested resource" do model = Model.new({ name: 'Golf', make: {name: 'Volkswagen'} }) expect(model.make.name).to eq 'Volkswagen' end end end
Version data entries
11 entries across 11 versions & 1 rubygems