Sha256: f38ef7b2a86a71322e495efd99522aca70fb101d0a20d1dad2b7900941b796e7

Contents?: true

Size: 692 Bytes

Versions: 2

Compression:

Stored size: 692 Bytes

Contents

require 'rubygems'


$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../..', 'lib'))

## Fake rails for testing Rails.cache
class Rails
  def self.cache
    self
  end

  def self.fetch(key, options, &block)
    eval("@#{key.gsub(':', '_')} ||= block.call")
  end

  def self.write(key, val, options, &block)
    eval("@#{key.gsub(':', '_')} = val")
  end

  def self.read(key, options)
    eval("@#{key.gsub(':', '_')}")
  end
end


require 'method_cacheable'
class User
  include MethodCacheable
  define_keys :foo

  def foo(var=nil)
    "bar#{var}"
  end

  def id
   @id ||= rand(100)
  end
end


require 'rspec'
require 'rspec/autorun'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
method_cacheable-0.0.3 spec/spec_helper.rb
method_cacheable-0.0.2 spec/spec_helper.rb