spec/musterb/musterbifier_spec.rb in musterb-0.0.7 vs spec/musterb/musterbifier_spec.rb in musterb-0.1.0

- old
+ new

@@ -17,10 +17,14 @@ it "replaces blocks correctly" do Musterb::Musterbifier.new("{{#cond}}foo{{/cond}}").to_erb.should eq "<% musterb.block_if musterb['cond'] do %>foo<% end %>" end + it "can do #." do + Musterb::Musterbifier.new("{{#.}}foo{{/.}}").to_erb.should eq "<% musterb.block_if musterb.current do %>foo<% end %>" + end + it "replaces carrot correctly" do 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 @@ -34,13 +38,8 @@ it "replaces foo.bar with a chain" do Musterb::Musterbifier.new("{{foo.bar}}").to_erb.should eq "<%== musterb.chain('foo')['bar'] %>" end it "replaces calls for partials with an exception by default" do - Musterb::Musterbifier.new("{{> foo}}").to_erb.should eq "<%= raise NotImplementedError, 'Don't know how to render partial: foo' %>" - end - - it "can be injected with an algorithm for creating partials" do - render_partial_template = lambda { |p| "render :partial => '#{p}', :current_context => musterb.context" } - Musterb::Musterbifier.new("{{> foo}}", render_partial_template).to_erb.should eq "<%= render :partial => 'foo', :current_context => musterb.context %>" + lambda { Musterb::Musterbifier.new("{{> foo}}").to_erb }.should raise_error NotImplementedError end end \ No newline at end of file