test/unit/config_tests.rb in dassets-0.13.2 vs test/unit/config_tests.rb in dassets-0.14.0
- old
+ new
@@ -1,27 +1,23 @@
require 'assert'
require 'dassets/config'
-require 'ns-options/assert_macros'
require 'dassets/cache'
require 'dassets/file_store'
class Dassets::Config
class UnitTests < Assert::Context
- include NsOptions::AssertMacros
-
desc "Dassets::Config"
setup do
@config = Dassets::Config.new
end
subject{ @config }
- should have_options :file_store
should have_readers :combinations
should have_imeths :base_url, :set_base_url
- should have_imeths :content_cache, :fingerprint_cache
+ should have_imeths :file_store, :content_cache, :fingerprint_cache
should have_imeths :source, :combination, :combination?
should "have no base url by default" do
assert_nil subject.base_url
end
@@ -46,15 +42,28 @@
should "default the file store option to a null file store" do
assert_kind_of Dassets::FileStore::NullStore, subject.file_store
end
+ should "configure non-nil file stores" do
+ store_root = Factory.path
+ subject.file_store(store_root)
+ assert_equal store_root, subject.file_store.root
+
+ store = Dassets::FileStore.new(Factory.path)
+ subject.file_store(store)
+ assert_equal store, subject.file_store
+
+ subject.content_cache(nil)
+ assert_equal store, subject.file_store
+ end
+
should "default its content cache" do
assert_instance_of Dassets::Cache::NoCache, subject.content_cache
end
- should "allow configuring non-nil content caches" do
+ should "configure non-nil content caches" do
cache = Dassets::Cache::MemCache.new
subject.content_cache(cache)
assert_equal cache, subject.content_cache
subject.content_cache(nil)
@@ -63,10 +72,10 @@
should "default its fingerprint cache" do
assert_instance_of Dassets::Cache::NoCache, subject.fingerprint_cache
end
- should "allow configuring non-nil fingerprint caches" do
+ should "configure non-nil fingerprint caches" do
cache = Dassets::Cache::MemCache.new
subject.fingerprint_cache(cache)
assert_equal cache, subject.fingerprint_cache
subject.fingerprint_cache(nil)