spec/models/yml_content_spec.rb in milksteak-0.0.11 vs spec/models/yml_content_spec.rb in milksteak-0.0.12
- old
+ new
@@ -13,11 +13,11 @@
end
it "should get list of objs from milk_root/objs" do
TestYmlObject.list.should be_an Array
end
-
+
# this utility method is used by the read and write methods as a consistent
# way to access yml obj documents.
it "should load a obj into params" do
f = File.open(File.join(File.dirname(__FILE__), "../fixtures/objs/sample_obj.yml"), "r")
f.stub(:save).and_return true
@@ -55,9 +55,16 @@
f = File.open(File.join(File.dirname(__FILE__), "../fixtures/objs/sample_obj.yml"), "r")
File.should_receive(:new).with("/tmp/milk_site/objs/home.yml", "r").and_return f
obj = TestYmlObject.load("home")
obj.data["format"] = "markdown"
obj.render.should == "<p>This is a Test Object</p>\n"
+ end
+
+ it "should respect allow_html variable in yaml frontmatter" do
+ f = File.open(File.join(File.dirname(__FILE__), "../fixtures/objs/sample_obj_no_html.yml"), "r")
+ File.should_receive(:new).with("/tmp/milk_site/objs/home.yml", "r").and_return f
+ obj = TestYmlObject.load("home")
+ obj.render.should == "<p><strong>This is</strong> <em>a</em> Test Object</p>\n"
end
it "should return empty string if trying to render a obj that doesn't exist" do
FileUtils.stub(:mkdir).and_return true
empty = TestYmlObject.render("home")