Permalink
Browse files

Is not nessesary to have @_rails_html_safe instance var when the stri…

…ng is unsafe, also it breaks to_yaml [#3535 state:committed]
  • Loading branch information...
1 parent d891754 commit c401102a2702f9b945803e66d3a25b77d882ee13 Sam Elliott and Santiago Pastorino committed with NZKoz Apr 22, 2010
@@ -123,7 +123,7 @@ def html_safe
end
def html_safe?
- defined?(@_rails_html_safe) && @_rails_html_safe
+ defined?(@_rails_html_safe)
end
def html_safe!
@@ -145,7 +145,7 @@ def add_with_safety(other)
def concat_with_safety(other_or_fixnum)
result = concat_without_safety(other_or_fixnum)
unless html_safe? && also_html_safe?(other_or_fixnum)
- @_rails_html_safe = false
+ remove_instance_variable(:@_rails_html_safe) if defined?(@_rails_html_safe)
end
result
end
@@ -505,4 +505,12 @@ def to_s
test 'emits normal string yaml' do
assert_equal 'foo'.to_yaml, 'foo'.html_safe.to_yaml(:foo => 1)
end
+
+ test 'yaml output using +' do
+ assert_equal "--- foobar\n", ('foo' + 'bar').to_yaml
+ end
+
+ test 'yaml output using <<' do
+ assert_equal "--- foobar\n", ('foo' << 'bar').to_yaml
+ end
end

0 comments on commit c401102

Please sign in to comment.