Sha256: 178816e6482663363d670104349d887d6731bedc01b255c4b6a34dc5ee32b266
Contents?: true
Size: 1 KB
Versions: 13
Compression:
Stored size: 1 KB
Contents
require File.dirname(__FILE__) + '/test_helper.rb' require 'cache_advance/active_record_sweeper' class Article; end class Publication; end class ActiveRecordSweeperTest < Test::Unit::TestCase def setup @sweeper = CacheAdvance::ActiveRecordSweeper.instance end def test_should_call_observe_with_a_given_set_of_classes CacheAdvance::ActiveRecordSweeper.expects(:observe).with([:publication, :article]) CacheAdvance::ActiveRecordSweeper.initialize_observed([:publication, :article]) end def test_should_re_add_observers CacheAdvance::ActiveRecordSweeper.initialize_observed([:publication, :article]) Article.expects(:add_observer).with(@sweeper) Publication.expects(:add_observer).with(@sweeper) @sweeper.reload_sweeper end def test_should_expire_caches_on_changes CacheAdvance::Caches.expects(:expire_for_class).with(:publication).times(3) %w(after_create after_update after_destroy).each do |method| @sweeper.send(method, Publication.new) end end end
Version data entries
13 entries across 13 versions & 1 rubygems