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.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/parser_spec.rb b/spec/parser_spec.rb
index 8dd13a4..3fe9029 100644
--- a/spec/parser_spec.rb
+++ b/spec/parser_spec.rb
@@ -110,6 +110,10 @@ describe "Parser" do
"ID:#{id}"
end
+ def data(id)
+ "@#{id}"
+ end
+
def path(*parts)
"PATH:#{parts.join("/")}"
end
@@ -119,6 +123,10 @@ describe "Parser" do
ast_for("{{foo}}").should == root { mustache id("foo") }
end
+ it "parses simple mustaches with data" do
+ ast_for("{{@foo}}").should == root { mustache data("foo") }
+ end
+
it "parses mustaches with paths" do
ast_for("{{foo/bar}}").should == root { mustache path("foo", "bar") }
end
@@ -152,6 +160,10 @@ describe "Parser" do
mustache id("foo"), [], hash(["bar", boolean("false")])
end
+ ast_for("{{foo bar=@baz}}").should == root do
+ mustache id("foo"), [], hash(["bar", data("baz")])
+ end
+
ast_for("{{foo bar=baz bat=bam}}").should == root do
mustache id("foo"), [], hash(["bar", "ID:baz"], ["bat", "ID:bam"])
end
@@ -190,6 +202,10 @@ describe "Parser" do
ast_for("{{foo false}}").should == root { mustache id("foo"), [boolean("false")] }
end
+ it "parses mutaches with DATA parameters" do
+ ast_for("{{foo @bar}}").should == root { mustache id("foo"), [data("bar")] }
+ end
+
it "parses contents followed by a mustache" do
ast_for("foo bar {{baz}}").should == root do
content "foo bar "