Sha256: b4c5a45d2a6b8f331c95d2fdb2f9f0a32c27fbe882844093738d011778bcd64d
Contents?: true
Size: 832 Bytes
Versions: 16
Compression:
Stored size: 832 Bytes
Contents
require "spec_helper" describe Shamu::Services::LazyAssociation do it "calls block to look up association" do assoc = double expect( assoc ).to receive( :label ) lazy = Shamu::Services::LazyAssociation.new( 1 ) { assoc } lazy.label end it "delegates ==" do assoc = double lazy = Shamu::Services::LazyAssociation.new( 1 ) { assoc } expect( lazy ).to eq assoc end it "does not delegate id" do assoc = double expect( assoc ).not_to receive( :id ) lazy = Shamu::Services::LazyAssociation.new( 1 ) { assoc } lazy.id end it "has the same class as original object" do assoc = double expect( assoc ).to receive( :to_entity ).and_return assoc lazy = Shamu::Services::LazyAssociation.new( 1 ) { assoc } expect( lazy.to_entity ).to be_kind_of assoc.class end end
Version data entries
16 entries across 16 versions & 1 rubygems