Sha256: bd763465955ca2dbc04647c5fd216e36f4ca3da939c896359e07f0a170469bef

Contents?: true

Size: 674 Bytes

Versions: 3

Compression:

Stored size: 674 Bytes

Contents

require 'spec_helper'

describe Stache::Mustache::CachedTemplate do
  before do
    @source   = "{{hello}} mustache"
    @template = Stache::Mustache::CachedTemplate.new(@source)
  end

  it "can be dumped when compiled" do
    @template.compile
    dump = Marshal.dump(@template)
    dump.should =~ /ctx\[:hello\]/
    dump.should =~ /mustache/
  end

  it "can be loaded from valid dump" do
    @template.compile
    obj = Marshal.load(Marshal.dump(@template))
    obj.compile.should eq(@template.compile)
  end

  it "should ignore source if already compiled" do
    res   = @template.compile
    res2 =  @template.compile("{{foo}} bar")
    res.should eq(res2)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stache-1.2.0 spec/stache/mustache/cached_template_spec.rb
stache-1.1.1 spec/stache/mustache/cached_template_spec.rb
stache-1.1.0 spec/stache/mustache/cached_template_spec.rb