Module: Spree::TestingSupport::Caching

Defined in:
lib/spree/testing_support/caching.rb

Instance Method Summary collapse

Instance Method Details

#assert_written_to_cache(key) ⇒ Object


8
9
10
11
12
13
14
15
16
# File 'lib/spree/testing_support/caching.rb', line 8

def assert_written_to_cache(key)
  unless @cache_write_events.detect { |event| event[:key].starts_with?(key) }
    raise %Q{Expected to find #{key} in the cache, but didn't.

  Cache writes:
  #{@cache_write_events.join("\n")}
    }
  end
end

#cache_writesObject


4
5
6
# File 'lib/spree/testing_support/caching.rb', line 4

def cache_writes
  @cache_write_events
end

#clear_cache_eventsObject


18
19
20
21
# File 'lib/spree/testing_support/caching.rb', line 18

def clear_cache_events
  @cache_read_events = []
  @cache_write_events = []
end