Sha256: 56f016cfdbfdcc2f42bb07e5677d92e5113ada00ff8cfa2b9a2e2e4b32ee4087

Contents?: true

Size: 510 Bytes

Versions: 10

Compression:

Stored size: 510 Bytes

Contents

require 'spec_helper'

class Foo
  def self.reset
    @@foo = nil
  end

  def reload
    @reload = true
    self
  end

  def foo(*a)
    @@foo ||= 0
    @@foo += 1
  end
end

describe Mize::Reload do
  before do
    Mize.wrapped.clear

    class Foo
      memoize method: :foo
    end
    Foo.reset
  end

  let(:foo) { Foo.new }

  describe '#reload' do
    it 'clears cache after reload' do
      expect(foo.foo).to eq 1
      expect(foo.foo).to eq 1
      expect(foo.reload.foo).to eq 2
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mize-0.6.1 spec/mize/memoize_reload_spec.rb
mize-0.6.0 spec/mize/memoize_reload_spec.rb
mize-0.5.0 spec/mize/memoize_reload_spec.rb
mize-0.4.1 spec/mize/memoize_reload_spec.rb
mize-0.4.0 spec/mize/memoize_reload_spec.rb
mize-0.3.5 spec/mize/memoize_reload_spec.rb
mize-0.3.4 spec/mize/memoize_reload_spec.rb
mize-0.3.3 spec/mize/memoize_reload_spec.rb
mize-0.3.2 spec/mize/memoize_reload_spec.rb
mize-0.3.1 spec/mize/memoize_reload_spec.rb