Class: CachingMatcher::BeCachedMatcher

Inherits:
MatcherBase show all
Defined in:
lib/caching_matcher/caching_matcher.rb

Instance Attribute Summary

Attributes inherited from MatcherBase

#cache_key

Instance Method Summary collapse

Methods inherited from MatcherBase

#initialize

Constructor Details

This class inherits a constructor from CachingMatcher::MatcherBase

Instance Method Details

#failure_message_for_shouldObject



54
55
56
57
58
59
60
# File 'lib/caching_matcher/caching_matcher.rb', line 54

def failure_message_for_should
  if @before
    "Key: #{@cache_key} was cached before operation. Did you forget to call ActionController::Base.cache_store.clear in the before block?"
  elsif !@after
    "Key: #{@cache_key} was not cached after operation but should have been."
  end
end

#failure_message_for_should_notObject



62
63
64
65
66
# File 'lib/caching_matcher/caching_matcher.rb', line 62

def failure_message_for_should_not
  if @after
    "Key: #{@cache_key} was cached after operation but should not have been."
  end
end

#matches?(event_proc) ⇒ Boolean

Returns:

  • (Boolean)


49
50
51
52
# File 'lib/caching_matcher/caching_matcher.rb', line 49

def matches?(event_proc)
  run_match(event_proc)
  !@before && @after
end