Skip to content

Commit

Permalink
Add test cases verifying that SafeERB works
Browse files Browse the repository at this point in the history
If an upgrade to Rails breaks SafeERB, we'd like to find out.
  • Loading branch information
emk committed Dec 18, 2008
1 parent 32efdb5 commit 1f8e9e6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions spec/models/safe_erb_spec.rb
@@ -0,0 +1,20 @@
require File.dirname(__FILE__) + '/../spec_helper'

# Verify that our safe_erb patches are working.
describe "An ERB template" do
before :each do
@template = ERB.new('<%= var %>')
end

it "should not raise an error when untained values are interpolated" do
var = "foo"
assert_equal var, @template.result(binding)
end

it "should raise an error when tained values are interpolated" do
assert_raise RuntimeError do
var = "foo".taint
@template.result(binding)
end
end
end

0 comments on commit 1f8e9e6

Please sign in to comment.