Sha256: 47a8e1595418664b95c50104ebdc6a3aea6eac61de1d85461e45212394c06d46

Contents?: true

Size: 801 Bytes

Versions: 1

Compression:

Stored size: 801 Bytes

Contents

require 'spec_helper'


describe JohnnyCache::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
johnny_cache-0.0.1 spec/johnny_cache/method_cache_spec.rb