Sha256: 06391ec392cb66c92f26880463301112dfa867b9a73bb69ba204b5c0f5ff4841

Contents?: true

Size: 479 Bytes

Versions: 2

Compression:

Stored size: 479 Bytes

Contents

require "test_helper"

# TODO: test caching without rails

class CacheTest < Minitest::Spec
  STORE = Class.new(Hash) do
    def fetch(key, options, &block)
      self[key] || self[key] = yield
    end
  end.new

  module Cache
    def show
      "#{@model}"
    end

    def cache_store
      STORE
    end
  end

  class Index < Cell::ViewModel
    cache :show
    include Cache
  end

  it do
    Index.new(1).().must_equal("1")
    Index.new(2).().must_equal("1")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cells-4.1.7 test/cache_test.rb
cells-4.1.6 test/cache_test.rb