Sha256: 25fb5e1cd4d1c1bc0886fc16648881203eb6a4cd3330f2552d00aaea933555a2

Contents?: true

Size: 958 Bytes

Versions: 15

Compression:

Stored size: 958 Bytes

Contents

require 'assert'
require 'dassets/cache'

module Dassets::Cache

  class UnitTests < Assert::Context
    desc "Dassets::Cache"

    should "define an in-memory cache handler" do
      assert MemCache
    end

    should "define a no-op cache handler" do
      assert NoCache
    end

  end

  class MemCacheTests < UnitTests
    desc "MemCache"
    setup do
      @cache = MemCache.new
    end
    subject{ @cache }

    should have_imeths :keys, :[], :[]=

    should "cache given key/value pairs in memory" do
      val = []
      subject['something'] = val
      assert_same val, subject['something']
    end

  end

  class NoCacheTests < UnitTests
    desc "NoCache"
    setup do
      @cache = NoCache.new
    end
    subject{ @cache }

    should have_imeths :keys, :[], :[]=

    should "not cache given key/value pairs in memory" do
      val = []
      subject['something'] = val
      assert_not_same val, subject['something']
    end

  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
dassets-0.14.5 test/unit/cache_tests.rb
dassets-0.14.4 test/unit/cache_tests.rb
dassets-0.14.3 test/unit/cache_tests.rb
dassets-0.14.2 test/unit/cache_tests.rb
dassets-0.14.1 test/unit/cache_tests.rb
dassets-0.14.0 test/unit/cache_tests.rb
dassets-0.13.2 test/unit/cache_tests.rb
dassets-0.13.1 test/unit/cache_tests.rb
dassets-0.13.0 test/unit/cache_tests.rb
dassets-0.12.0 test/unit/cache_tests.rb
dassets-0.11.0 test/unit/cache_tests.rb
dassets-0.10.1 test/unit/cache_tests.rb
dassets-0.10.0 test/unit/cache_tests.rb
dassets-0.9.0 test/unit/cache_tests.rb
dassets-0.8.0 test/unit/cache_tests.rb