<commit_before>require File.dirname(__FILE__) + '/test_helper'

describe "Build" do
  Build = Integrity::Build
  
  before(:each) do
    setup_and_reset_database!
  end
  
  specify "fixture is valid and can be saved" do
    lambda do
      Build.generate.tap do |build|
        build.should be_valid
        build.save
      end
    end.should change(Build, :count).by(1)
  end
  
  describe "Properties" do
    before(:each) do
      @build = Build.generate(:commit_identifier => "658ba96cb0235e82ee720510c049883955200fa9")
    end
    
    it "captures the build's STDOUT/STDERR" do
      @build.output.should_not be_blank
    end
    
    it "knows if it failed or not" do
      @build.successful = true
      @build.should be_successful
      @build.successful = false
      @build.should be_failed
    end
    
    it "knows it's status" do
      @build.successful = true
      @build.status.should be(:success)
      @build.successful = false
      @build.status.should be(:failed)
    end
    
    it "has a commit identifier" do
      @build.commit_identifier.should be("658ba96cb0235e82ee720510c049883955200fa9")
    end
  end
end<commit_msg>a bit more tests for build<commit_after>require File.dirname(__FILE__) + '/test_helper'

describe "Build" do
  Build = Integrity::Build
  
  before(:each) do
    setup_and_reset_database!
  end
  
  specify "fixture is valid and can be saved" do
    lambda do
      Build.generate.tap do |build|
        build.should be_valid
        build.save
      end
    end.should change(Build, :count).by(1)
  end
  
  describe "Properties" do
    before(:each) do
      @build = Build.generate(:commit_identifier => "658ba96cb0235e82ee720510c049883955200fa9")
    end
    
    it "captures the build's STDOUT/STDERR" do
      @build.output.should_not be_blank
    end
    
    it "knows if it failed or not" do
      @build.successful = true
      @build.should be_successful
      @build.successful = false
      @build.should be_failed
    end
    
    it "knows it's status" do
      @build.successful = true
      @build.status.should be(:success)
      @build.successful = false
      @build.status.should be(:failed)
    end
    
    it "has an human readable status" do
      Build.gen(:successful => true).human_readable_status.should == "Build Successful"
      Build.gen(:successful => false).human_readable_status.should == "Build Failed"
    end

    it "has a commit identifier" do
      @build.commit_identifier.should be("658ba96cb0235e82ee720510c049883955200fa9")
    end

    it "has a short commit identifier" do
      @build.short_commit_identifier.should == "658ba96"
      Build.gen(:commit_identifier => "402").short_commit_identifier.should == "402"
    end
  end
end
{'fraction_non_alphanumeric': 0.09037687522868643, 'fraction_numerical': 0.048664471276985, 'mean_word_length': 2.771034482758621, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '3993254', 'n_tokens_mistral': 958, 'n_tokens_neox': 882, 'n_words': 221}