Sha256: 87fd1d5006181c00d6ecace3a91853b71bc54f6e293f5c68bf952de557d08e3f

Contents?: true

Size: 558 Bytes

Versions: 17

Compression:

Stored size: 558 Bytes

Contents

require 'spec_helper'

describe 'LazyAttr' do
  class TestInovice
    include ActiveZuora::LazyAttr
    lazy_load :test_body
  end

  subject { TestInovice.new }

  it "should fetch a lazy loaded attribute from the api" do
    expect(subject).to receive(:fetch_field).with(:test_body){ 'Jesse "The Body"' }
    subject.test_body
  end

  it "should should not refetch an attribute after it's been loaded once" do
    expect(subject).to receive(:fetch_field).with(:test_body).once { 'Jesse "The Body"' }
    subject.test_body
    subject.test_body
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
active_zuora-2.6.0 spec/lazy_attr_spec.rb
active_zuora-2.5.4 spec/lazy_attr_spec.rb
active_zuora-2.5.3 spec/lazy_attr_spec.rb
active_zuora-2.5.2 spec/lazy_attr_spec.rb
active_zuora-2.5.1 spec/lazy_attr_spec.rb
active_zuora-2.5.0 spec/lazy_attr_spec.rb
active_zuora-2.4.1 spec/lazy_attr_spec.rb
active_zuora-2.4.0 spec/lazy_attr_spec.rb
active_zuora-2.3.1 spec/lazy_attr_spec.rb
active_zuora-2.3.0 spec/lazy_attr_spec.rb
active_zuora-2.2.7 spec/lazy_attr_spec.rb
active_zuora-2.2.6 spec/lazy_attr_spec.rb
active_zuora-2.2.5 spec/lazy_attr_spec.rb
active_zuora-2.2.4 spec/lazy_attr_spec.rb
active_zuora-2.2.3 spec/lazy_attr_spec.rb
active_zuora-2.2.2 spec/lazy_attr_spec.rb
active_zuora-2.2.1 spec/lazy_attr_spec.rb