Created
September 23, 2011 03:19
-
-
Save rwilcox/1236668 to your computer and use it in GitHub Desktop.
Implement the s presenter helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 <BAD TAG>" | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment