<commit_before>require File.join( File.dirname(__FILE__), '..', "spec_helper" )
describe Report do
  before(:all) do 
    @date = Date.new(2009, 6, 29)
    @weekdays = [:monday,:tuesday,:wednesday,:thursday,:friday,:saturday,:sunday]
    @user = User.new(:login => 'Joe', :password => 'password', :password_confirmation => 'password', :role => :admin)
    @user.save
    @user.should be_valid
    @manager = StaffMember.new(:name => "<NAME>")
    @manager.should be_valid
    @manager.save
    @funder = Funder.new(:name => "FWWB")
    @funder.save
    @funder.should be_valid
    
    @funding_line = FundingLine.new(:amount => 10_000_000, :interest_rate => 0.15, :purpose => "for women", :disbursal_date => "2006-02-02", 
                                    :first_payment_date => "2007-05-05", :last_payment_date => "2009-03-03")
    @funding_line.funder = @funder
    @funding_line.save
    @funding_line.should be_valid
    @num_clients = []
    @loans = []
    @loan_product = LoanProduct.new
    @loan_product.name = "LP1"
    @loan_product.max_amount = 10000
    @loan_product.min_amount = 1000
    @loan_product.max_interest_rate = 100
    @loan_product.min_interest_rate = 0.1
    @loan_product.installment_frequency = :weekly
    @loan_product.max_number_of_installments = 50
    @loan_product.min_number_of_installments = 25
    @loan_product.loan_type = "DefaultLoan"
    @loan_product.valid_from = Date.parse('2000-01-01')
    @loan_product.valid_upto = Date.parse('2012-01-01')
    @loan_product.save
    @loan_product.errors.each {|e| puts e}
    @loan_product.should be_valid

    @target_for_number = Target.new(:attached_to => :staff_member, :type => :client_registration, :attached_id => @manager.id, :start_value => 100,
                         :target_value => 1000, :created_at => Date.today, :deadline => Date.new(Date.today.year, Date.today.month, -1))
    @target_for_number.save
    @target_for_number.errors.each {|e| puts e}
    @target_for_number.should be_valid

    @target_for_amount = Target.new(:attached_to => :staff_member, :type => :loan_disbursement_by_amount, :attached_id => @manager.id,
                                    :target_value => 10_00_000, :created_at => Date.today, :start_value => 10_000,
                                    :deadline => Date.new(Date.today.year, Date.today.month, -1))
    @target_for_amount.save!
    @target_for_amount.errors.each {|e| puts e}
    @target_for_amount.should be_valid

    @region = Region.new(:id => 1, :name => "Region 1", :manager_id => @manager.id, :creation_date => Date.today)
    @region.save
    @region.errors.each {|e| puts e}
    @region.should be_valid

    @area = Area.new(:name => "Area 1", :region_id => @region.id, :manager_id => @manager.id, :creation_date => Date.today)
    @area.save
    @area.errors.each {|e| puts e}
    @area.should be_valid
    
      # generate a couple of branches<commit_msg>fixed a minor bug in report spec. now passing<commit_after>require File.join( File.dirname(__FILE__), '..', "spec_helper" )
describe Report do
  before(:all) do 
    @date = Date.new(2009, 6, 29)
    @weekdays = [:monday,:tuesday,:wednesday,:thursday,:friday,:saturday,:sunday]
    @user = User.new(:login => 'Joe', :password => 'password', :password_confirmation => 'password', :role => :admin)
    @user.save
    @user.should be_valid
    @manager = StaffMember.new(:name => "<NAME>")
    @manager.should be_valid
    @manager.save
    @funder = Funder.new(:name => "FWWB")
    @funder.save
    @funder.should be_valid
    
    @funding_line = FundingLine.new(:amount => 10_000_000, :interest_rate => 0.15, :purpose => "for women", :disbursal_date => "2006-02-02", 
                                    :first_payment_date => "2007-05-05", :last_payment_date => "2009-03-03")
    @funding_line.funder = @funder
    @funding_line.save
    @funding_line.should be_valid
    @num_clients = []
    @loans = []
    @loan_product = LoanProduct.new
    @loan_product.name = "LP1"
    @loan_product.max_amount = 10000
    @loan_product.min_amount = 1000
    @loan_product.max_interest_rate = 100
    @loan_product.min_interest_rate = 0.1
    @loan_product.installment_frequency = :weekly
    @loan_product.max_number_of_installments = 50
    @loan_product.min_number_of_installments = 25
    @loan_product.loan_type = "DefaultLoan"
    @loan_product.valid_from = Date.parse('2000-01-01')
    @loan_product.valid_upto = Date.parse('2012-01-01')
    @loan_product.save
    @loan_product.errors.each {|e| puts e}
    @loan_product.should be_valid

    @target_for_number = Target.new(:attached_to => :staff_member, :type => :client_registration, :attached_id => @manager.id, :start_value => 100,
                                    :target_value => 1000, :created_at => Date.today, :start_date => Date.new(Date.today.year, Date.today.month, 01),
                                    :deadline => Date.new(Date.today.year, Date.today.month, -1))
    @target_for_number.save
    @target_for_number.errors.each {|e| puts e}
    @target_for_number.should be_valid

    @target_for_amount = Target.new(:attached_to => :staff_member, :type => :loan_disbursement_by_amount, :attached_id => @manager.id,
                                    :target_value => 10_00_000, :created_at => Date.today, :start_value => 10_000,
                                    :start_date => Date.new(Date.today.year, Date.today.month, 01),
                                    :deadline => Date.new(Date.today.year, Date.today.month, -1))
    @target_for_amount.save!
    @target_for_amount.errors.each {|e| puts e}
    @target_for_amount.should be_valid

    @region = Region.new(:id => 1, :name => "Region 1", :manager_id => @manager.id, :creation_date => Date.today)
    @region.save
    @region.errors.each {|e| puts e}
    @region.should be_valid

    @area = Area.new(:name => "Area 1", :region_id => @region.id, :manager_id => @manager.id, :creation_date => Date.today)
    @area.save
    @area.errors.each {|e| puts e}
    @area.should be_valid
    
      # generate a couple of branches
{'fraction_non_alphanumeric': 0.1439406430338005, 'fraction_numerical': 0.03396537510305029, 'mean_word_length': 3.123725356900068, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 75, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3713714', 'n_tokens_mistral': 2307, 'n_tokens_neox': 2058, 'n_words': 371}