Sha256: 6128d1db17f8a03651e89352347f190ec24b2e3676704cf850ee2bd875194b69

Contents?: true

Size: 610 Bytes

Versions: 5

Compression:

Stored size: 610 Bytes

Contents

# encoding: utf-8

require 'spec_helper'
require File.expand_path('../../fixtures/classes', __FILE__)

describe Memoizable::InstanceMethods, '#freeze' do
  subject { object.freeze }

  let(:described_class) { Class.new(Fixture::Object) }

  before do
    described_class.memoize(:test)
  end

  let(:object) { described_class.allocate }

  it_should_behave_like 'a command method'

  it 'freezes the object' do
    expect { subject }.to change(object, :frozen?).from(false).to(true)
  end

  it 'allows methods not yet called to be memoized' do
    subject
    expect(object.test).to be(object.test)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
memoizable-0.4.2 spec/unit/memoizable/instance_methods/freeze_spec.rb
memoizable-0.4.1 spec/unit/memoizable/instance_methods/freeze_spec.rb
memoizable-0.4.0 spec/unit/memoizable/instance_methods/freeze_spec.rb
memoizable-0.3.1 spec/unit/memoizable/instance_methods/freeze_spec.rb
memoizable-0.3.0 spec/unit/memoizable/instance_methods/freeze_spec.rb