Sha256: cebe0e3c0946d40b8239e04339c034e8004a657b80c9a0be50e21dc243beaafb

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

describe Musterb::Musterbifier do
  it "does not change vanilla strings" do
    Musterb::Musterbifier.new("Hello, world!").to_erb.should eq "Hello, world!"
  end

  it "replaces mustaches correctly" do
    Musterb::Musterbifier.new("Hello, {{world}}!").to_erb.should eq "Hello, <%== musterb['world'] %>!"
  end

  it "replaces triple staches correctly" do
    Musterb::Musterbifier.new("Hello, {{{world}}}!").to_erb.should eq "Hello, <%= musterb['world'] %>!"
  end

  it "does not escape if it starts with &" do
    Musterb::Musterbifier.new("Hello, {{& world}}!").to_erb.should eq "Hello, <%= musterb['world'] %>!"
  end

  it "replaces blocks correctly" do
    Musterb::Musterbifier.new("{{#cond}}foo{{/cond}}").to_erb.should eq "<% musterb.block 'cond' do %>foo<% end %>"
  end

  it "replaces carrot correctly" do
    Musterb::Musterbifier.new("{{^cond}}foo{{/cond}}").to_erb.should eq "<% musterb.block_unless 'cond' do %>foo<% end %>"
  end

  it "replaces comments with nothing" do
    Musterb::Musterbifier.new("{{! foo\n bar}}").to_erb.should eq ""
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
musterb-0.0.3 spec/musterb/musterbifier_spec.rb
musterb-0.0.2 spec/musterb/musterbifier_spec.rb