test/test_compressible.rb in compressible-0.0.2.3 vs test/test_compressible.rb in compressible-0.0.2.4
- old
+ new
@@ -4,12 +4,12 @@
context "Compressible" do
context "configuration" do
- should "load configuration file and result should be a hash" do
- assert_kind_of Hash, Compressible.configure("test/config.yml")
+ should "load configuration file and result should be a Module" do
+ assert_kind_of Module, Compressible.configure("test/config.yml")
end
should "raise an RuntimeError if pass junk to config" do
assert_raise(RuntimeError) { Compressible.configure([]) }
end
@@ -111,9 +111,20 @@
should "add javascript to the config hash" do
assert_equal [], Compressible.config[:js]
Compressible.js("test/test-a", "test/test-b", :to => "test/result")
assert_equal ["test/test-a", "test/test-b"], Compressible.config[:js][0][:paths]
+ end
+
+ should "be able to add config dynamically" do
+ assert_equal Compressible.defaults, Compressible.config
+ Compressible.configure(:stylesheet_path => "public/stylesheets", :read_only => true)
+ assert_equal "public/stylesheets", Compressible.config[:stylesheet_path]
+ Compressible.stylesheets("test/result" => ["test/test-a", "test/test-b"])
+ assets = Compressible.assets_for(:stylesheet, 'test/result', :environments => "production", :current => "development")
+ assert_equal ["test/test-a", "test/test-b"], assets
+ result = {:js=>[], :javascript_path=>nil, :stylesheet_path=>"public/stylesheets", :read_only=>true, :css=>[{:paths=>["test/test-a", "test/test-b"], :to=>"test/result"}]}
+ assert_equal result, Compressible.config
end
teardown { Compressible.reset }
end
\ No newline at end of file