Skip to content
Browse files

run coverage during tests

  • Loading branch information...
1 parent ccfb1cc commit 6871d86be7e0671e92a5e3a17836550d94b0d2a2 Aaron Bedra committed Apr 25, 2009
Showing with 25 additions and 2 deletions.
  1. +2 −1 .gitignore
  2. +1 −1 Rakefile
  3. +22 −0 examples/safe_erb_example.rb
View
3 .gitignore
@@ -1 +1,2 @@
-rdoc
+rdoc
+coverage
View
2 Rakefile
@@ -32,7 +32,7 @@ end
if ENV["RUN_CODE_RUN"]
task :default => "examples:multi_rails"
else
- task :default => "examples"
+ task :default => "examples:coverage"
end
desc 'Generate documentation for the safe_erb plugin.'
View
22 examples/safe_erb_example.rb
@@ -1,7 +1,29 @@
require File.expand_path(File.join(File.dirname(__FILE__), "example_helper.rb"))
describe "Safe ERB" do
+
+ describe "ERB" do
+
+ describe "Util" do
+ it "html_escape renders an untainted string" do
+ src = "<script>alert('hi');</script>"
+ out = ERB::Util.html_escape(src)
+ out.should == "&lt;script&gt;alert('hi');&lt;/script&gt;"
+ out.should_not be_tainted
+ end
+ end
+ end
+
+ describe "ActionView::Helpers::SanitizeHelper" do
+ pending "strip_tags_with_untaint renders an untainted string" do
+ src = "<script>alert('hi');</script>"
+ out = ActionView::Helpers::SanitizeHelper.strip_tags_with_untaint(src)
+ out.should == "&lt;script&gt;alert('hi');&lt;/script&gt;"
+ out.should_not be_tainted
+ end
+ end
+
describe "render_with_checking_tainted" do
it "test checking" do
ERB.with_checking_tainted do

0 comments on commit 6871d86

Please sign in to comment.
Something went wrong with that request. Please try again.