test/unit/dassets_tests.rb in dassets-0.7.0 vs test/unit/dassets_tests.rb in dassets-0.8.0
- old
+ new
@@ -1,12 +1,14 @@
require 'assert'
-require 'fileutils'
require 'dassets'
+require 'fileutils'
+require 'dassets/asset_file'
+
module Dassets
- class BaseTests < Assert::Context
+ class UnitTests < Assert::Context
desc "Dassets"
subject{ Dassets }
should have_imeths :config, :configure, :init, :[]
should have_imeths :source_list
@@ -19,9 +21,16 @@
file = subject['nested/file3.txt']
assert_kind_of Dassets::AssetFile, file
assert_equal 'nested/file3.txt', file.digest_path
assert_equal 'd41d8cd98f00b204e9800998ecf8427e', file.fingerprint
+ end
+
+ should "cache asset files" do
+ file1 = subject['nested/file3.txt']
+ file2 = subject['nested/file3.txt']
+
+ assert_same file2, file1
end
should "return an asset file that doesn't exist if digest path not found" do
file = subject['path/not/found.txt']
assert_not file.exists?