<commit_before>require 'test_helper'

class PluckAllTest < Minitest::Test
  def setup
    
  end
  def test_that_it_has_a_version_number
    refute_nil ::PluckAll::VERSION
  end
  def test_pluck_one_column
    assert_equal([{'name' => 'John'}, {'name' => 'Pearl'}, {'name' => 'Kathenrie'}], User.pluck_all(:name))
  end
  def test_pluck_multiple_columns
    assert_equal([
      {'name' => 'John', 'email' => '<EMAIL>'}, 
      {'name' => 'Pearl', 'email' => '<EMAIL>'}, 
      {'name' => 'Kathenrie', 'email' => '<EMAIL>'},
    ], User.pluck_all(:name, :email))
  end
  def test_pluck_serialized_attribute
    assert_equal([
      {'serialized_attribute' => {}}, 
      {'serialized_attribute' => {:testing => true, :deep => {:deep => :deep}}},
    ], User.where(:name => %w(John Pearl)).pluck_all(:serialized_attribute))
  end
  def test_join
    assert_equal([
      {'name' => 'John', 'title' => "John's post1"},
      {'name' => 'John', 'title' => "John's post2"},
      {'name' => 'John', 'title' => "John's post3"},
    ], User.joins(:posts).where(:name => 'John').pluck_all(:name, :title))<commit_msg>add test pluck_all with join<commit_after>require 'test_helper'

class PluckAllTest < Minitest::Test
  def setup
    
  end
  def test_that_it_has_a_version_number
    refute_nil ::PluckAll::VERSION
  end
  def test_pluck_one_column
    assert_equal([{'name' => 'John'}, {'name' => 'Pearl'}, {'name' => 'Kathenrie'}], User.pluck_all(:name))
  end
  def test_pluck_multiple_columns
    assert_equal([
      {'name' => 'John', 'email' => '<EMAIL>'}, 
      {'name' => 'Pearl', 'email' => '<EMAIL>'}, 
      {'name' => 'Kathenrie', 'email' => '<EMAIL>'},
    ], User.pluck_all(:name, :email))
  end
  def test_pluck_with_join
    assert_equal([
      {'name' => 'John', 'title' => "John's post1"},
      {'name' => 'John', 'title' => "John's post2"},
      {'name' => 'John', 'title' => "John's post3"},
    ], User.where('title LIKE ?', "John's %").joins(:posts).pluck_all(:name, :title))
  end
  def test_pluck_serialized_attribute
    assert_equal([
      {'serialized_attribute' => {}}, 
      {'serialized_attribute' => {:testing => true, :deep => {:deep => :deep}}},
    ], User.where(:name => %w(<NAME>)).pluck_all(:serialized_attribute))
  end
  def test_join
    assert_equal([
      {'name' => 'John', 'title' => "John's post1"},
      {'name' => 'John', 'title' => "John's post2"},
      {'name' => 'John', 'title' => "John's post3"},
    ], User.joins(:posts).where(:name => 'John').pluck_all(:name, :title))
{'fraction_non_alphanumeric': 0.2173396674584323, 'fraction_numerical': 0.0035629453681710215, 'mean_word_length': 3.9646365422396856, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 60, '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': '5751020', 'n_tokens_mistral': 926, 'n_tokens_neox': 893, 'n_words': 178}