Sha256: b5d43b43d85bfe6bfe7335e3503e3909dbcdc49487163a184e38f6de05d86f6d

Contents?: true

Size: 752 Bytes

Versions: 2

Compression:

Stored size: 752 Bytes

Contents

require "spec_helper"
require "tempfile"
describe Murdoc::Renderer do
  describe "#initialize" do
    it "should set template from given string" do
      described_class.new("%p Hello").template.should == "%p Hello"
    end

    it "should set template from given filename if that filename exists" do
      Tempfile.open("test") do |f|
        f.puts("%p Hello")
        f.close
        described_class.new(f.path).template.should == "%p Hello\n"
      end
    end
  end

  describe "#render" do
    it "should render with haml" do
      described_class.new("%p Hello").render.should =~ %r{<p>Hello</p>}
    end

    it "should send locals to haml" do
      described_class.new("%p= foo").render(:foo => 123).should =~ %r{<p>123</p>}
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
murdoc-0.2.1 spec/murdoc/renderer_spec.rb
murdoc-0.2.0 spec/murdoc/renderer_spec.rb