Skip to content

Instantly share code, notes, and snippets.

@rwilcox
Created September 23, 2011 03:19
Show Gist options
  • Select an option

  • Save rwilcox/1236668 to your computer and use it in GitHub Desktop.

Select an option

Save rwilcox/1236668 to your computer and use it in GitHub Desktop.
Implement the s presenter helper
def s(*args)
output = "".html_safe
args.each {|current_arg|
output << current_arg.html_safe
}
output
end
# The Specs for said function
it "handles HTML elements that should not be escaped" do
s("<h1>Hi</h1>") == "<h1>Hi</h1>"
end
it "handles an h in the middle to indicate that a particular string actually should be escaped" do
s("<blink>hello</blink>", " world ", h("<BAD TAG>")).should == "<blink>hello</blink> world &lt;BAD TAG&gt;"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment