Sha256: 9e78e4ada874f42d9f256c313dc70e36ba4ab578e1cf517011211db41baaccb9

Contents?: true

Size: 540 Bytes

Versions: 4

Compression:

Stored size: 540 Bytes

Contents

describe HashPresenter::Cached do

  extend BaseHashPresenterTest
  test_presenter(HashPresenter::Cached)

  context 'Special Behavior' do

    it 'should not depend on an attribute object' do
      original = { a: 2 }
      hp = HashPresenter::Cached.new(original)

      expect(hp.a).to eq(2)

      original[:a] = 3

      expect(hp.a).to eq(2)
    end

    it 'should not calculate result for a nested hash twice' do
      hp = HashPresenter::Cached.new(a: { b: 1 })
      expect(hp.a.object_id).to eq(hp.a.object_id)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tarvit-helpers-0.0.23 spec/modules/hash_presenter/cached_spec.rb
tarvit-helpers-0.0.22 spec/modules/hash_presenter/cached_spec.rb
tarvit-helpers-0.0.21 spec/modules/hash_presenter/cached_spec.rb
tarvit-helpers-0.0.20 spec/modules/hash_presenter/cached_spec.rb