Skip to content

Commit

Permalink
Merge pull request #943 from DavyJonesLocker/chore/use-simpler-field-…
Browse files Browse the repository at this point in the history
…in-tests

Use textarea in textarea specs only
  • Loading branch information
tagliala authored Aug 8, 2024
2 parents 6321a72 + 659633c commit fddbdba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/action_view/cases/test_form_for_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ def test_not_embed_authenticity_token_in_remote_forms
::ActionView::Helpers::FormTagHelper.embed_authenticity_token_in_remote_forms = false

form_for(@post, validate: true, remote: true) do |f|
concat f.text_area(:cost)
concat f.text_field(:cost)
end

validators = { 'post[cost]' => { presence: [{ message: I18n.t('errors.messages.blank') }] } }
expected = whole_form_for('/posts', 'new_post', 'new_post', validators: validators, remote: true) do
form_field('textarea', id: 'post_cost', name: 'post[cost]', tag_content: "\n")
form_field('input', id: 'post_cost', name: 'post[cost]', type: 'text')
end

assert_dom_equal expected, output_buffer
Expand All @@ -45,13 +45,13 @@ def test_not_embed_authenticity_token_in_remote_forms

def test_http_method
form_for(@post, validate: true, method: :patch) do |f|
concat f.text_area(:cost)
concat f.text_field(:cost)
end

validators = { 'post[cost]' => { presence: [{ message: I18n.t('errors.messages.blank') }] } }
expected = whole_form_for('/posts', 'new_post', 'new_post', validators: validators) do
form_field('input', name: '_method', type: 'hidden', value: 'patch') +
form_field('textarea', id: 'post_cost', name: 'post[cost]', tag_content: "\n")
form_field('input', id: 'post_cost', name: 'post[cost]', type: 'text')
end

assert_dom_equal expected, output_buffer
Expand Down

0 comments on commit fddbdba

Please sign in to comment.