Sha256: ccbc6dbe5b3bf8e936745c999739072c4cf4b183299b3c71705f41ccfeb942a0
Contents?: true
Size: 926 Bytes
Versions: 1
Compression:
Stored size: 926 Bytes
Contents
require 'test_helper' class Widget < ActiveRecord::Base def self.columns [] end attr_accessor :now def updated_at @now ||= Time.now end def created_at @now ||= Time.now end def id object_id end def self.empty_find [] end def self.find [self.new, self.new] end end class GroupCacheKeyTest < MiniTest::Unit::TestCase def test_empty_collection_should_return_unique_string_representation @widgets = Widget.empty_find assert_equal("empty/#{@widgets.object_id}", @widgets.cache_key) end def test_collection_should_return_unique_string_with_count_hash_and_timestamps @widgets = Widget.find hash = Digest::MD5.hexdigest(@widgets.collect{|w| w.id}.to_s) created = @widgets.first.created_at.to_i.to_s updated = @widgets.first.updated_at.to_i.to_s assert_equal("widgets/#{@widgets.length}-#{hash}-#{created}-#{updated}", @widgets.cache_key) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
group_cache_key-0.4.1 | ./test/group_cache_key_test.rb |