Skip to content

Commit

Permalink
Run tests that were skipped by mistake
Browse files Browse the repository at this point in the history
Fix Minitest/NonExecutableTestMethod
  • Loading branch information
tagliala committed Dec 16, 2023
1 parent 4e48688 commit d99d926
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 84 deletions.
86 changes: 44 additions & 42 deletions test/action_view/cases/test_form_for_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -647,61 +647,63 @@ def test_number_format_with_locale

assert_dom_equal expected, output_buffer
end
end

def test_field_with_format_a
assert_field_with_format_has_source(:a, 'a')
end
def test_field_with_format_a
assert_field_with_format_has_source(:a, 'a')
end

def test_field_with_format_backslash
assert_field_with_format_has_source(:backslash, '\\\\')
end
def test_field_with_format_backslash
assert_field_with_format_has_source(:backslash, '\\\\')
end

def test_field_with_format_space
# regression test for issue #460
assert_field_with_format_has_source(:space, ' ')
end
def test_field_with_format_space
# regression test for issue #460
assert_field_with_format_has_source(:space, ' ')
end

def test_field_with_format_escaped_space
assert_field_with_format_has_source(:escaped_space, '\\ ')
end
def test_field_with_format_escaped_space
assert_field_with_format_has_source(:escaped_space, '\\ ')
end

def test_field_with_format_ascii_escape
assert_field_with_format_has_source(:ascii_escape, '\\x41')
end
def test_field_with_format_ascii_escape
assert_field_with_format_has_source(:ascii_escape, '\\x41')
end

def test_field_with_format_unicode_escape
assert_field_with_format_has_source(:unicode_escape, '\\u263A')
end
def test_field_with_format_unicode_escape
assert_field_with_format_has_source(:unicode_escape, '\\u263A')
end

def test_field_with_format_unicode_literal
assert_field_with_format_has_source(:unicode_literal, '☺')
end
def test_field_with_format_unicode_literal
assert_field_with_format_has_source(:unicode_literal, '☺')
end

def test_field_with_format_newline_escape
assert_field_with_format_has_source(:newline_escape, '\\n')
end
def test_field_with_format_newline_escape
assert_field_with_format_has_source(:newline_escape, '\\n')
end

def test_field_with_format_newline_literal
assert_field_with_format_has_source(:newline_literal, '\\n')
end
def test_field_with_format_newline_literal
assert_field_with_format_has_source(:newline_literal, '\\n')
end

def test_field_with_format_devise_email
assert_field_with_format_has_source(:devise_email, '^[^@\\s]+@([^@\\s]+\\.)+[^@\\W]+$')
end
def test_field_with_format_devise_email
assert_field_with_format_has_source(:devise_email, '^[^@\\s]+@([^@\\s]+\\.)+[^@\\W]+$')
end

def assert_field_with_format_has_source(field, expected_source)
form_for(@format_thing, validate: true) { |f| concat(f.text_field(field)) }
private

validators = {
"format_thing[#{field}]" => { format: [{ message: 'is invalid', with:
{ source: expected_source, options: '' } }] }
}
def assert_field_with_format_has_source(field, expected_source)
form_for(@format_thing, validate: true) { |f| concat(f.text_field(field)) }

expected = whole_form_for('/format_things', 'new_format_thing', 'new_format_thing', validators: validators) do
form_field('input', "format_thing_#{field}", "format_thing[#{field}]", 'text')
end
validators = {
"format_thing[#{field}]" => { format: [{ message: 'is invalid', with:
{ source: expected_source, options: '' } }] }
}

assert_dom_equal expected, output_buffer
expected = whole_form_for('/format_things', 'new_format_thing', 'new_format_thing', validators: validators) do
form_field('input', id: "format_thing_#{field}", name: "format_thing[#{field}]", type: 'text')
end

assert_dom_equal expected, output_buffer
end
end
end
86 changes: 44 additions & 42 deletions test/action_view/cases/test_form_with_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -646,62 +646,64 @@ def test_form_with_number_format_with_locale

assert_dom_equal expected, output_buffer
end
end

def test_form_with_field_with_format_a
assert_field_with_format_has_source(:a, 'a')
end
def test_form_with_field_with_format_a
assert_field_with_format_has_source(:a, 'a')
end

def test_form_with_field_with_format_backslash
assert_field_with_format_has_source(:backslash, '\\\\')
end
def test_form_with_field_with_format_backslash
assert_field_with_format_has_source(:backslash, '\\\\')
end

def test_form_with_field_with_format_space
# regression test for issue #460
assert_field_with_format_has_source(:space, ' ')
end
def test_form_with_field_with_format_space
# regression test for issue #460
assert_field_with_format_has_source(:space, ' ')
end

def test_form_with_field_with_format_escaped_space
assert_field_with_format_has_source(:escaped_space, '\\ ')
end
def test_form_with_field_with_format_escaped_space
assert_field_with_format_has_source(:escaped_space, '\\ ')
end

def test_form_with_field_with_format_ascii_escape
assert_field_with_format_has_source(:ascii_escape, '\\x41')
end
def test_form_with_field_with_format_ascii_escape
assert_field_with_format_has_source(:ascii_escape, '\\x41')
end

def test_form_with_field_with_format_unicode_escape
assert_field_with_format_has_source(:unicode_escape, '\\u263A')
end
def test_form_with_field_with_format_unicode_escape
assert_field_with_format_has_source(:unicode_escape, '\\u263A')
end

def test_form_with_field_with_format_unicode_literal
assert_field_with_format_has_source(:unicode_literal, '☺')
end
def test_form_with_field_with_format_unicode_literal
assert_field_with_format_has_source(:unicode_literal, '☺')
end

def test_form_with_field_with_format_newline_escape
assert_field_with_format_has_source(:newline_escape, '\\n')
end
def test_form_with_field_with_format_newline_escape
assert_field_with_format_has_source(:newline_escape, '\\n')
end

def test_form_with_field_with_format_newline_literal
assert_field_with_format_has_source(:newline_literal, '\\n')
end
def test_form_with_field_with_format_newline_literal
assert_field_with_format_has_source(:newline_literal, '\\n')
end

def test_form_with_field_with_format_devise_email
assert_field_with_format_has_source(:devise_email, '^[^@\\s]+@([^@\\s]+\\.)+[^@\\W]+$')
end
def test_form_with_field_with_format_devise_email
assert_field_with_format_has_source(:devise_email, '^[^@\\s]+@([^@\\s]+\\.)+[^@\\W]+$')
end

def assert_field_with_format_has_source(field, expected_source)
form_with(model: @format_thing, validate: true) { |f| concat(f.text_field(field)) }
private

validators = {
"format_thing[#{field}]" => { format: [{ message: 'is invalid', with:
{ source: expected_source, options: '' } }] }
}
def assert_field_with_format_has_source(field, expected_source)
form_with(model: @format_thing, validate: true) { |f| concat(f.text_field(field)) }

expected = whole_form_with('/format_things', validators: validators) do
form_field('input', "format_thing_#{field}", "format_thing[#{field}]", 'text')
end
validators = {
"format_thing[#{field}]" => { format: [{ message: 'is invalid', with:
{ source: expected_source, options: '' } }] }
}

expected = whole_form_with('/format_things', validators: validators) do
form_field('input', id: "format_thing_#{field}", name: "format_thing[#{field}]", type: 'text')
end

assert_dom_equal expected, output_buffer
assert_dom_equal expected, output_buffer
end
end
end
end

0 comments on commit d99d926

Please sign in to comment.