Sha256: 75fea963511c56204f9aef951b599b52eaed4144d0b7f5136c6977ddd340d0cd

Contents?: true

Size: 550 Bytes

Versions: 6

Compression:

Stored size: 550 Bytes

Contents

require "test_helper"

class CacheKeeper::CachedMethodTest < ActiveSupport::TestCase
  test "#call caches the result of the original method" do
    recording = Recording.new(number: 5)
    cached_method = manager.handle(Recording, :another_method, expires_in: 1.hour)
    manager.activate_if_handling(Recording, :another_method)

    result = cached_method.call(recording)

    assert_equal 5, result
    assert cache_has_key? "CacheKeeper/Recording/another_method"
  end

  private

  def manager
    @manager ||= CacheKeeper::Manager.new
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cache_keeper-0.3.0 test/models/cached_method_test.rb
cache_keeper-0.2.1 test/models/cached_method_test.rb
cache_keeper-0.2.0 test/models/cached_method_test.rb
cache_keeper-0.1.2 test/models/cached_method_test.rb
cache_keeper-0.1.1 test/models/cached_method_test.rb
cache_keeper-0.1.0 test/models/cached_method_test.rb