Fix tests that are broken after nokogiri 1.8.4

I'm not sure why it have happened, but after nokogiri 1.8.4 these tests
started to break.

I'm updating the match syntax to let it green again. See more about it
in the link below:

https://edgeguides.rubyonrails.org/4_2_release_notes.html#assert-select
This commit is contained in:
Felipe Renan 2018-08-03 21:09:43 -03:00
parent 36672bf5f4
commit 71a95b95fa
2 changed files with 6 additions and 6 deletions

View File

@ -79,13 +79,13 @@ class InputFieldTest < ActionView::TestCase
test 'builder input_field infers pattern from attributes' do
with_input_field_for @other_validating_user, :country, as: :string, pattern: true
assert_select 'input[pattern="\w+"]'
assert_select "input:match('pattern', ?)", /\w+/
end
test 'builder input_field accepts custom pattern' do
with_input_field_for @other_validating_user, :country, as: :string, pattern: '\d+'
assert_select 'input[pattern="\d+"]'
assert_select "input:match('pattern', ?)", /\\d+/
end
test 'builder input_field uses readonly component' do
@ -132,7 +132,7 @@ class InputFieldTest < ActionView::TestCase
swap_wrapper :default, custom_wrapper_with_html5_components do
with_input_field_for @user, :name, pattern: '\w+'
assert_select 'input[pattern="\w+"]'
assert_select "input:match('pattern', ?)", /\w+/
end
end

View File

@ -88,12 +88,12 @@ class StringInputTest < ActionView::TestCase
test 'input infers pattern from attributes' do
with_input_for @other_validating_user, :country, :string, pattern: true
assert_select 'input[pattern="\w+"]'
assert_select "input:match('pattern', ?)", /\w+/
end
test 'input infers pattern from attributes using proc' do
with_input_for @other_validating_user, :name, :string, pattern: true
assert_select 'input[pattern="\w+"]'
assert_select "input:match('pattern', ?)", /\w+/
end
test 'input does not infer pattern from attributes if root default is false' do
@ -105,7 +105,7 @@ class StringInputTest < ActionView::TestCase
test 'input uses given pattern from attributes' do
with_input_for @other_validating_user, :country, :string, input_html: { pattern: "\\d+" }
assert_select 'input[pattern="\d+"]'
assert_select "input:match('pattern', ?)", /\\d+/
end
test 'input does not use pattern if model has :without validation option' do