<commit_before>require 'test_helper'

class FieldsetTest < ActionView::TestCase
  test "create a block" do
    with_form_for(@user) do |form|
      form.block(:red_box, :div, :class => "red_box") do |block|
        block.field(:credit_card) {|f| f.input :credit_card}
      end
    end

    assert_select 'form > div.red_box input.string#user_credit_card'
  end

  test "allow nesting of blocks" do
    with_form_for(@user) do |form|
      form.block(:main, :div, :id => 'main') do |outer|
        outer.fieldset(:payment, :id => "payment") do |inner|
          inner.legend "These are some fields"
          inner.field(:credit_card) {|f| f.input :credit_card}
        end

        outer.field(:name) {|f| f.input :name}
      end
    end

    assert_no_select 'fieldset#main > legend'
    assert_select 'form > div#main > div > input.string#user_name'<commit_msg>Use the correct class name for the test<commit_after>require 'test_helper'

class BlockTest < ActionView::TestCase
  test "create a block" do
    with_form_for(@user) do |form|
      form.block(:red_box, :div, :class => "red_box") do |block|
        block.field(:credit_card) {|f| f.input :credit_card}
      end
    end

    assert_select 'form > div.red_box input.string#user_credit_card'
  end

  test "allow nesting of blocks" do
    with_form_for(@user) do |form|
      form.block(:main, :div, :id => 'main') do |outer|
        outer.fieldset(:payment, :id => "payment") do |inner|
          inner.legend "These are some fields"
          inner.field(:credit_card) {|f| f.input :credit_card}
        end

        outer.field(:name) {|f| f.input :name}
      end
    end

    assert_no_select 'fieldset#main > legend'
    assert_select 'form > div#main > div > input.string#user_name'
{'fraction_non_alphanumeric': 0.1289218482601255, 'fraction_numerical': 0.0, 'mean_word_length': 3.0981308411214954, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1199046', 'n_tokens_mistral': 605, 'n_tokens_neox': 582, 'n_words': 154}