Sha256: f60cbd493b6b7cc51e45b2414c78bd8e6dbeec81bef4e9d20f328fc7f816662f

Contents?: true

Size: 945 Bytes

Versions: 5

Compression:

Stored size: 945 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, { autorefresh: true })
    store = CacheKeeper::Store.new([cached_method, autorefreshed_cached_method])

    assert_equal [autorefreshed_cached_method], store.autorefreshed
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cache_keeper-0.4.1 test/store_test.rb
cache_keeper-0.4.0 test/store_test.rb
cache_keeper-0.3.0 test/store_test.rb
cache_keeper-0.2.1 test/store_test.rb
cache_keeper-0.2.0 test/store_test.rb