<commit_before>require File.dirname(__FILE__) + "/helper"

class BobGitTest < Test::Unit::TestCase
  attr_accessor :repo, :commit_id, :buildable

  def setup
    super

    @repo      = GitRepo.new(:test_repo)
    @repo.create
    @repo.add_successful_commit

    @commit_id = repo.commits.first[:identifier]
    @buildable = GitBuildableStub.new(@repo)
  end

  test "with a successful build" do
    Bob.build(buildable, commit_id)

    status, output = buildable.builds[commit_id]
    assert_equal :successful,          status
    assert_equal "Running tests...\n", output

    assert_equal 1, buildable.metadata.length

    commit = buildable.metadata[commit_id]
    assert_equal "This commit will work", commit[:message]
    assert_equal Time.now.min,            commit[:committed_at].min
  end

  test "with a failed build" do
    repo.add_failing_commit
    commit_id = repo.commits.first[:identifier]

    Bob.build(buildable, commit_id)

    status, output = buildable.builds[commit_id]
    assert_equal :failed,              status
    assert_equal "Running tests...\n", output

    assert_equal 1, buildable.metadata.length

    commit = buildable.metadata[commit_id]
    assert_equal "This commit will fail", commit[:message]
    assert_equal Time.now.min,            commit[:committed_at].min
  end

  test "with multiple commits" do
    2.times { repo.add_failing_commit }
    commits = repo.commits.collect { |c| c[:identifier] }
    Bob.build(buildable, commits)

    assert_equal 3, buildable.metadata.length
    assert_equal 3, buildable.builds.length
  end
end<commit_msg>Get rid BobGitTest#commit_id<commit_after>require File.dirname(__FILE__) + "/helper"

class BobGitTest < Test::Unit::TestCase
  attr_reader :repo, :buildable

  def setup
    super

    @repo      = GitRepo.new(:test_repo)
    @repo.create

    @buildable = GitBuildableStub.new(@repo)
  end

  test "with a successful build" do
    repo.add_successful_commit

    commit_id = repo.commits.first[:identifier]

    Bob.build(buildable, commit_id)

    status, output = buildable.builds[commit_id]
    assert_equal :successful,          status
    assert_equal "Running tests...\n", output

    assert_equal 1, buildable.metadata.length

    commit = buildable.metadata[commit_id]
    assert_equal "This commit will work", commit[:message]
    assert_equal Time.now.min,            commit[:committed_at].min
  end

  test "with a failed build" do
    repo.add_failing_commit

    commit_id = repo.commits.first[:identifier]

    Bob.build(buildable, commit_id)

    status, output = buildable.builds[commit_id]
    assert_equal :failed,              status
    assert_equal "Running tests...\n", output

    assert_equal 1, buildable.metadata.length

    commit = buildable.metadata[commit_id]
    assert_equal "This commit will fail", commit[:message]
    assert_equal Time.now.min,            commit[:committed_at].min
  end

  test "with multiple commits" do
    2.times { repo.add_failing_commit }
    commits = repo.commits.collect { |c| c[:identifier] }

    Bob.build(buildable, commits)

    assert_equal 2, commits.length
    assert_equal 2, buildable.metadata.length
    assert_equal 2, buildable.builds.length
  end
end
{'fraction_non_alphanumeric': 0.0966438781852082, 'fraction_numerical': 0.003418272218769422, 'mean_word_length': 3.292, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '2841674', 'n_tokens_mistral': 1028, 'n_tokens_neox': 982, 'n_words': 227}