instiki/vendor/plugins/rails_xss/test/content_for_test.rb
Jacques Distler 9e909d5be3 Update Rails, rails_xss and Bundler
Update Bundler to 1.0.15.
Update Rails to 2.3.12.
Update rails_xss plugin.

The latter two were the
source of a considerable
amount of grief, as rails_xss
is now MUCH stricter about what
string methods can be used.

Also made it possible to use
rake 0.9.x with Instiki. But
you probably REALLY want to use

 ruby bundle exec rake ...

instead of just saying

 rake ....
2011-06-15 00:43:38 -05:00

40 lines
1.3 KiB
Ruby

require 'test_helper'
class ContentForTest < ActionView::TestCase
def test_content_for_should_yield_html_safe_string
content_for(:testing, "Some <p>html</p>")
content = instance_variable_get(:"@content_for_testing")
assert content.html_safe?
end
def test_content_for_should_escape_content
content_for(:testing, "Some <p>html</p>")
content = instance_variable_get(:"@content_for_testing")
expected = %{Some &lt;p&gt;html&lt;/p&gt;}
assert_dom_equal expected, content
end
def test_content_for_should_not_escape_html_safe_content
content_for(:testing, "Some <p>html</p>".html_safe)
content = instance_variable_get(:"@content_for_testing")
expected = %{Some <p>html</p>}
assert_dom_equal expected, content
end
def test_content_for_should_escape_content_from_block
content_for(:testing){ "Some <p>html</p>" }
content = instance_variable_get(:"@content_for_testing")
expected = %{Some &lt;p&gt;html&lt;/p&gt;}
assert_dom_equal expected, content
end
def test_content_for_should_not_escape_html_safe_content_from_block
content_for(:testing){ "Some <p>html</p>".html_safe }
content = instance_variable_get(:"@content_for_testing")
expected = %{Some <p>html</p>}
assert_dom_equal expected, content
end
end