Sha256: 95a86571d750aacf62d8d3a11067ea48a928177fdc58e62ede837d17b13c0667

Contents?: true

Size: 781 Bytes

Versions: 1

Compression:

Stored size: 781 Bytes

Contents

require 'musterb/template_handler'

describe Musterb::TemplateHandler do
  def evaluate(template, binding)
    compiled = "output_buffer = nil; " + Musterb::TemplateHandler::compile_mustache(template)
    binding.eval compiled
  end

  it "is wired up correctly" do
    foo = "hi"
    evaluate("{{foo}}", binding).should eq "hi"
  end

  it "renders partials corrects" do
    Musterb::TemplateHandler::compile_mustache("{{>foo}}").should include "render :partial => 'foo', :locals => {:initial_context => musterb.context}"
  end

  it "escapes things by default" do
    foo = "<br>"
    evaluate("{{foo}}", binding).should eq "&lt;br&gt;"  
  end

  it "does not escape things in triple staches" do    
    foo = "<br>"
    evaluate("{{{foo}}}", binding).should eq "<br>"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
musterb-0.1.0 spec/musterb/template_handler_spec.rb