Sha256: fd06788b3963cd4c59604776ace72ff73d2e79045f6cb8a13121087001b790d4

Contents?: true

Size: 936 Bytes

Versions: 4

Compression:

Stored size: 936 Bytes

Contents

require "test_helper"

class CacheKeeper::StoreTest < ActiveSupport::TestCase
  test "#find_by returns only the one with the requested parameters" do
    cached_method = CacheKeeper::CachedMethod.new(String, :slow_method, {})
    autorefreshed_cached_method = CacheKeeper::CachedMethod.new(String, :really_slow_method, { autorefresh: true })
    store = CacheKeeper::Store.new([cached_method, autorefreshed_cached_method])

    assert_equal autorefreshed_cached_method, store.find_by(String, :really_slow_method)
  end

  test "#autorefreshed returns only the ones with the correct option" do
    cached_method = CacheKeeper::CachedMethod.new(String, :slow_method, {})
    autorefreshed_cached_method = CacheKeeper::CachedMethod.new(String, :really_slow_method, {}, &proc {})
    store = CacheKeeper::Store.new([cached_method, autorefreshed_cached_method])

    assert_equal [autorefreshed_cached_method], store.autorefreshed
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cache_keeper-0.6.1 test/store_test.rb
cache_keeper-0.6.0 test/store_test.rb
cache_keeper-0.5.1 test/store_test.rb
cache_keeper-0.5.0 test/store_test.rb