Sha256: dbe29aa75894949b0b512757dcccd0731635ced2048a26088254c3fd44688a14

Contents?: true

Size: 807 Bytes

Versions: 3

Compression:

Stored size: 807 Bytes

Contents

# encoding: utf-8

require "spec_helper"

module Bunch
  module Compilers
    describe Jade do
      it "compiles a Jade file to JS" do
        tree = FileTree.from_hash(
          "a" => { "my_file.jst.jade" => "h1\n  = hello\n  hr\n" }
        )
        compiler = Jade.new(
          tree.get("a").get("my_file.jst.jade"), tree, "a/my_file.jst.jade")
        output = compiler.content

        compiler.path.must_equal "a/my_file.js"
        output.must_include "JST['a/my_file'] = function"
        output.must_include "<hr/>"
      end

      it "raises if the gem isn't available" do
        Jade.any_instance.stubs(:require).raises(LoadError)
        exception = assert_raises(RuntimeError) { Jade.new(nil, nil, nil) }
        exception.message.must_include "gem install"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bunch-1.0.0pre3 spec/bunch/compilers/jade_spec.rb
bunch-1.0.0pre2 spec/bunch/compilers/jade_spec.rb
bunch-1.0.0pre1 spec/bunch/compilers/jade_spec.rb