Sha256: 73933089bfadd6be69d9d5ffece0635ede0e1e4173c15fecbaa4b155ccc59c93

Contents?: true

Size: 734 Bytes

Versions: 4

Compression:

Stored size: 734 Bytes

Contents

require 'spec_helper'

describe Petroglyph::Engine do
  specify "#to_hash" do
    engine = Petroglyph::Engine.new('node :whatever => thing')
    engine.to_hash({:thing => 'stuff'}).should eq({:whatever => 'stuff'})
  end

  it "takes a template" do
    engine = Petroglyph::Engine.new('node :whatever => "nevermind"')
    engine.render.should eq({:whatever => "nevermind"}.to_json)
  end

  it "takes a block" do
    Petroglyph::Engine.new.render do
      node :whatever => "nevermind"
    end.should eq({:whatever => "nevermind"}.to_json)
  end

  it "passes the locals" do
    engine = Petroglyph::Engine.new('node :whatever => thing')
    engine.render(nil, {:thing => 'stuff'}).should eq({:whatever => 'stuff'}.to_json)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
petroglyph-0.0.5 spec/engine_spec.rb
petroglyph-0.0.4 spec/engine_spec.rb
petroglyph-0.0.3 spec/engine_spec.rb
petroglyph-0.0.2 spec/engine_spec.rb