test/unit/source_proxy_tests.rb in dassets-0.12.0 vs test/unit/source_proxy_tests.rb in dassets-0.13.0
- old
+ new
@@ -13,11 +13,12 @@
setup do
@source_proxy = Dassets::SourceProxy.new(Factory.string)
end
subject{ @source_proxy }
- should have_readers :digest_path, :cache, :source_files
+ should have_readers :digest_path, :content_cache, :fingerprint_cache
+ should have_readers :source_files
should have_imeths :key, :content, :fingerprint, :mtime, :exists?
end
class NotComboTests < UnitTests
@@ -28,12 +29,13 @@
should "know its digest path" do
assert_equal 'file1.txt', subject.digest_path
end
- should "use a `NoCache` cache handler by default" do
- assert_kind_of Dassets::Cache::NoCache, subject.cache
+ should "use no cache by default" do
+ assert_kind_of Dassets::Cache::NoCache, subject.content_cache
+ assert_kind_of Dassets::Cache::NoCache, subject.fingerprint_cache
end
should "have a single source file" do
assert_equal 1, subject.source_files.size
exp_source_file = Dassets::SourceFile.find_by_digest_path('file1.txt')
@@ -153,11 +155,14 @@
class NoCacheTests < UnitTests
desc "with a `NoCache` cache handler"
setup do
@cache = Dassets::Cache::NoCache.new
- @source_proxy = Dassets::SourceProxy.new('file1.txt', @cache)
+ @source_proxy = Dassets::SourceProxy.new('file1.txt', {
+ :content_cache => @cache,
+ :fingerprint_cache => @cache
+ })
end
should "not cache its source content/fingerprint" do
content1 = subject.content
content2 = subject.content
@@ -171,11 +176,15 @@
end
class MemCacheTests < UnitTests
desc "with a `MemCache` cache handler"
setup do
- @cache = Dassets::Cache::MemCache.new
- @source_proxy = Dassets::SourceProxy.new('file1.txt', @cache)
+ @content_cache = Dassets::Cache::MemCache.new
+ @fingerprint_cache = Dassets::Cache::MemCache.new
+ @source_proxy = Dassets::SourceProxy.new('file1.txt', {
+ :content_cache => @content_cache,
+ :fingerprint_cache => @fingerprint_cache
+ })
end
should "cache its source content/fingerprint in memory" do
content1 = subject.content
content2 = subject.content