Sha256: dc3460af5224239f0f0d061d7a1d98131e14835303fff7e042c2e12b15c2d48c

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

require "assert"
require "dassets-erubi"

require "dassets/engine"

module Dassets::Erubi
  class UnitTests < Assert::Context
    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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dassets-erubi-0.1.0 test/unit/dassets-erubi_tests.rb