test/unit/dassets_tests.rb in romo-0.14.1 vs test/unit/dassets_tests.rb in romo-0.14.2

- old
+ new

@@ -9,10 +9,12 @@ class UnitTests < Assert::Context desc "Romo::Dassets" subject{ Romo::Dassets } + should have_imeths :configure!, :reset! + should "configure Romo with Dassets" do subject.configure! source = Dassets.config.sources.detect do |source| source.path == Romo.gem_assets_path.to_s @@ -59,9 +61,27 @@ 'js/romo/tooltip.js', 'js/romo/indicator.js', 'js/romo/sortable.js' ] assert_equal exp_js_sources, Dassets.config.combinations['js/romo.js'] + end + + should "only configure itself once unless reset" do + subject.configure! + # modify the romo css so we can see that it isn't altered by calling + # configure again unless we call reset + Dassets.configure do |c| + c.combination "css/romo.css", [] + end + assert_equal [], Dassets.config.combinations['css/romo.css'] + subject.configure! + assert_equal [], Dassets.config.combinations['css/romo.css'] + + subject.reset! + + assert_equal [], Dassets.config.combinations['css/romo.css'] + subject.configure! + assert_not_equal [], Dassets.config.combinations['css/romo.css'] end end end