Module: Spree::TestingSupport::Caching

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) assert_written_to_cache(key)



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) }
    fail %{Expected to find #{key} in the cache, but didn't.

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

- (Object) cache_writes



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

def cache_writes
  @cache_write_events
end

- (Object) clear_cache_events



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

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