spec/caching_spec.rb in caching-0.0.1 vs spec/caching_spec.rb in caching-0.0.2
- old
+ new
@@ -21,10 +21,14 @@
end
def fast_method
@fast_method += 1
end
+
+ def reset
+ clear_cache
+ end
end
it 'Cache methods' do
object = Cachable.new
@@ -54,8 +58,20 @@
object.clear_cache :slow_method
object.slow_method.must_equal 2
object.other_slow_method.must_equal 1
+ end
+
+ it 'Clear cache inside object' do
+ object = Cachable.new
+
+ 3.times { object.slow_method.must_equal 1 }
+ 3.times { object.other_slow_method.must_equal 1 }
+
+ object.reset
+
+ object.slow_method.must_equal 2
+ object.other_slow_method.must_equal 2
end
end
\ No newline at end of file