test/unit/dassets-erubi_tests.rb in dassets-erubi-0.0.1 vs test/unit/dassets-erubi_tests.rb in dassets-erubi-0.1.0
- old
+ new
@@ -8,6 +8,40 @@
desc "Dassets::Erubi"
subject { unit_class }
let(:unit_class) { Dassets::Erubi }
end
+
+ class EngineTests < UnitTests
+ desc "Engine"
+ subject { engine_class }
+
+ let(:engine_class) { unit_class::Engine }
+
+ should "know its ERB extensions" do
+ assert_that(subject.ERB_EXTENSIONS).equals(["erb", "erubis", "erubi"])
+ end
+ end
+
+ class EngineInitTests < EngineTests
+ desc "when init"
+ subject { engine_class.new }
+
+ should "be a Dassets engine" do
+ assert_that(subject).is_kind_of(Dassets::Engine)
+ assert_that(subject).responds_to("ext")
+ assert_that(subject).responds_to("compile")
+ end
+
+ should "only remove ERB-like input extensions" do
+ assert_that(subject.ext("erb")).equals("")
+ assert_that(subject.ext("erubis")).equals("")
+ assert_that(subject.ext("erubi")).equals("")
+ assert_that(subject.ext("css")).equals("css")
+ assert_that(subject.ext("js")).equals("js")
+ end
+
+ should "compile any input content as ERB" do
+ assert_equal Factory.erb_compiled, subject.compile(Factory.erb)
+ end
+ end
end