summaryrefslogtreecommitdiffstats
path: root/spec/parser_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/parser_spec.rb')
-rw-r--r--spec/parser_spec.rb17
1 files changed, 9 insertions, 8 deletions
diff --git a/spec/parser_spec.rb b/spec/parser_spec.rb
index edcc665..3c6250a 100644
--- a/spec/parser_spec.rb
+++ b/spec/parser_spec.rb
@@ -65,8 +65,9 @@ describe "Parser" do
with_padding { yield }
end
- def mustache(id, *params)
- pad("{{ #{id} [#{params.join(", ")}] }}")
+ def mustache(id, params = [], hash = nil)
+ hash = " #{hash}" if hash
+ pad("{{ #{id} [#{params.join(", ")}]#{hash} }}")
end
def partial(id, context = nil)
@@ -113,29 +114,29 @@ describe "Parser" do
end
it "parses mustaches with parameters" do
- ast_for("{{foo bar}}").should == program { mustache id("foo"), id("bar") }
+ ast_for("{{foo bar}}").should == program { mustache id("foo"), [id("bar")] }
end
it "parses mustaches with hash arguments" do
ast_for("{{foo bar=baz}}").should == program do
- mustache id("foo"), hash(["bar", "ID:baz"])
+ mustache id("foo"), [], hash(["bar", "ID:baz"])
end
ast_for("{{foo bar=baz bat=bam}}").should == program do
- mustache id("foo"), hash(["bar", "ID:baz"], ["bat", "ID:bam"])
+ mustache id("foo"), [], hash(["bar", "ID:baz"], ["bat", "ID:bam"])
end
ast_for("{{foo bar=baz bat=\"bam\"}}").should == program do
- mustache id("foo"), hash(["bar", "ID:baz"], ["bat", "\"bam\""])
+ mustache id("foo"), [], hash(["bar", "ID:baz"], ["bat", "\"bam\""])
end
ast_for("{{foo omg bar=baz bat=\"bam\"}}").should == program do
- mustache id("foo"), id("omg"), hash(["bar", id("baz")], ["bat", string("bam")])
+ mustache id("foo"), [id("omg")], hash(["bar", id("baz")], ["bat", string("bam")])
end
end
it "parses mustaches with string parameters" do
- ast_for("{{foo bar \"baz\" }}").should == program { mustache id("foo"), id("bar"), string("baz")}
+ ast_for("{{foo bar \"baz\" }}").should == program { mustache id("foo"), [id("bar"), string("baz")] }
end
it "parses contents followed by a mustache" do