Assert the absent of tags not the escaped text

Nokogiri doesn't escape the output
This commit is contained in:
Rafael Mendonça França 2014-11-17 17:27:13 -02:00
parent 1f17d5768d
commit 914b58cb9d
5 changed files with 8 additions and 8 deletions

View File

@ -82,7 +82,7 @@ class ErrorTest < ActionView::TestCase
test 'error escapes error prefix text' do
with_error_for @user, :name, error_prefix: '<b>Name</b>'
assert_select 'span.error', "&lt;b&gt;Name&lt;/b&gt; can't be blank"
assert_no_select 'span.error b'
end
test 'error generates an error message with raw HTML tags' do

View File

@ -50,7 +50,7 @@ class HintTest < ActionView::TestCase
test 'builder escapes hint text' do
with_hint_for @user, :name, hint: '<script>alert(1337)</script>'
assert_select 'span.hint', "&lt;script&gt;alert(1337)&lt;/script&gt;"
assert_no_select 'span.hint script'
end
# Without attribute name
@ -137,8 +137,8 @@ class HintTest < ActionView::TestCase
test 'hint with custom wrappers works' do
swap_wrapper do
with_hint_for @user, :name, hint: "can't be blank"
assert_select 'div.omg_hint', "can&#39;t be blank"
with_hint_for @user, :name, hint: "cannot be blank"
assert_select 'div.omg_hint', "cannot be blank"
end
end
end

View File

@ -31,7 +31,7 @@ class LabelTest < ActionView::TestCase
test 'builder escapes label text' do
with_label_for @user, :name, label: '<script>alert(1337)</script>', required: false
assert_select 'label.string', "&lt;script&gt;alert(1337)&lt;/script&gt;"
assert_no_select 'label.string script'
end
test 'builder does not escape label text if it is safe' do

View File

@ -270,8 +270,8 @@ class WrapperTest < ActionView::TestCase
test 'inline wrapper displays when there is content' do
swap_wrapper :default, self.custom_wrapper_with_wrapped_optional_component do
with_form_for @user, :name, hint: "can't be blank"
assert_select 'section.custom_wrapper div.no_output_wrapper p.omg_hint', "can&#39;t be blank"
with_form_for @user, :name, hint: "cannot be blank"
assert_select 'section.custom_wrapper div.no_output_wrapper p.omg_hint', "cannot be blank"
assert_select 'p.omg_hint'
end
end

View File

@ -57,7 +57,7 @@ class BooleanInputTest < ActionView::TestCase
test 'input boolean with nested escapes :inline_label with HTML' do
swap SimpleForm, boolean_style: :nested do
with_input_for @user, :active, :boolean, inline_label: '<b>I am so inline.</b>'
assert_select 'label.checkbox', text: ' &lt;b&gt;I am so inline.&lt;/b&gt;'
assert_no_select 'label.checkbox b'
end
end