<commit_before>require 'test_helper'

class UsersHelperTest < ActionView::TestCase
  include UserAuthKuma::UsersHelper

  def test_attribute_value
    user_mock = Object.new
    value = true
    user_mock.instance_variable_set(:@name, value)
    def user_mock.attributes
      return {'name' => @name}
    end

    expected = UserAuthKuma::UsersHelper::YES_DISPLAY
    actual   = attribute_value(user_mock, :name)
    assert_equal(expected, actual, "for value of true")
  end
end
<commit_msg>Extracted a helper from UsersHelperTest#test_attribute_value()<commit_after>require 'test_helper'

class UsersHelperTest < ActionView::TestCase
  include UserAuthKuma::UsersHelper

  def test_attribute_value
    user_mock = make_user_mock_to_test_attribute_value(:name, true)

    expected = UserAuthKuma::UsersHelper::YES_DISPLAY
    actual   = attribute_value(user_mock, :name)
    assert_equal(expected, actual, "for value of true")
  end

    def make_user_mock_to_test_attribute_value(attr_name, attr_value)
      user_mock = Object.new
      user_mock.instance_variable_set(:@name , attr_name )
      user_mock.instance_variable_set(:@value, attr_value)
      def user_mock.attributes
        {@name.to_s => @value}
      end

      return user_mock
    end
end

{'fraction_non_alphanumeric': 0.08095238095238096, 'fraction_numerical': 0.0, 'mean_word_length': 4.412017167381975, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6406367', 'n_tokens_mistral': 397, 'n_tokens_neox': 389, 'n_words': 80}