Sha256: f8ded50f29ec2b7ddfeabd331af94d2a1b43318a825068e3576aa8a6e21c5102

Contents?: true

Size: 804 Bytes

Versions: 1

Compression:

Stored size: 804 Bytes

Contents

require 'spec_helper'


describe MethodCachable::MethodCache do
  before(:all) do
    @user = User.new
  end

  before(:each) do
    @uniq ||= 0
    @uniq += 1
  end

  describe 'initialize' do
    it 'saves caller' do
      @user.cache.caller_object.should eq(@user)
    end

    it 'saves cache_method' do
      cache_method = :fetch
      @user.cache(cache_method).cache_operation.should eq(cache_method)
    end

    it 'saves options' do
      options = {:foo => "bar"}
      @user.cache(options).options.should eq(options)
    end

    it 'saves options and cache_method' do
      cache_method = :write
      options = {:foo => "bar"}
      cache = @user.cache(cache_method, options)
      cache.options.should      eq(options)
      cache.cache_operation.should eq(cache_method)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
method_cacheable-0.0.1 spec/method_cachable/method_cache_spec.rb