Sha256: c8e89023d60ff1bd66e7eb6e35a3987a39a50790c221bd44aeba44d0f747b08f
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
require_relative "../lib/jstgenerator" describe JstGenerator::Handlebars do jst_path = "spec/fixtures/handlebars/jst.js" after(:each) do File.delete(jst_path) if File.exist?(jst_path) end it "creates the JST file with the correct content" do hb = JstGenerator::Handlebars.new({ :dir_glob => "spec/fixtures/handlebars/*.hb", :jst_path => jst_path }).generate content = IO.read(jst_path) expect(content).to eq(<<EOS) window.JST = {}; window.JST["temp"] = Handlebars.compile("{{title}}"); EOS end it "works for multiple files" do hb = JstGenerator::Handlebars.new({ :dir_glob => "spec/fixtures/handlebars/multiple/*.hb", :jst_path => jst_path }).generate content = IO.read(jst_path) expect(content).to eq(<<EOS) window.JST = {}; window.JST["one"] = Handlebars.compile("{{title}}"); window.JST["two"] = Handlebars.compile("<p>{{desc}}</p>"); EOS end it "handles nested files" do hb = JstGenerator::Handlebars.new({ :dir_glob => "spec/fixtures/handlebars/nested/**/*.hb", :jst_path => jst_path }).generate content = IO.read(jst_path) expect(content).to eq(<<EOS) window.JST = {}; window.JST["test/one"] = Handlebars.compile("{{title}}"); window.JST["two"] = Handlebars.compile("<p>{{desc}}</p>"); EOS end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jstgenerator-0.1.0 | spec/handlebars_spec.rb |
jstgenerator-0.0.1 | spec/handlebars_spec.rb |