spec/musterb/musterbifier_spec.rb in musterb-0.0.3 vs spec/musterb/musterbifier_spec.rb in musterb-0.0.4

- old
+ new

@@ -14,16 +14,24 @@ 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 %>" + Musterb::Musterbifier.new("{{#cond}}foo{{/cond}}").to_erb.should eq "<% musterb.block_if musterb['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 %>" + Musterb::Musterbifier.new("{{^cond}}foo{{/cond}}").to_erb.should eq "<% musterb.block_unless musterb['cond'] do %>foo<% end %>" end it "replaces comments with nothing" do Musterb::Musterbifier.new("{{! foo\n bar}}").to_erb.should eq "" + end + + it "replaces . with current value" do + Musterb::Musterbifier.new("{{.}}").to_erb.should eq "<%== musterb.current %>" + end + + it "replaces foo.bar with a chain" do + Musterb::Musterbifier.new("{{foo.bar}}").to_erb.should eq "<%== musterb.chain('foo')['bar'] %>" end end \ No newline at end of file