Sha256: e23866cf4a542d7f34798a0cf804ccc00dec63f2f7b2e7c6921e54296793fd32
Contents?: true
Size: 922 Bytes
Versions: 1
Compression:
Stored size: 922 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 < Test::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.3.0 | test/group_cache_key_test.rb |