<commit_before>require File.expand_path('../../../app/models/calendar', __FILE__)

describe Calendar, type: :model do
  it 'returns an enumerator for the giftable_dates' do
    giftable_dates = 1.upto(24).map { |day| Date.new(2015, 12, day) }

    sorted_gifts = Calendar.new(giftable_dates, [])
    expect(sorted_gifts.count).to eq(24)
  end

  it 'yields the right gift for the right day' do
    the_first  = double('gift', date: Date.parse('2015-12-1'))
    the_fourth = double('gift', date: Date.parse('2015-12-4'))
    the_end    = double('gift', date: Date.parse('2015-12-24'))

    gifts          = [the_end, the_fourth, the_first]
    giftable_dates = 1.upto(24).map { |day| Date.new(2015, 12, day) }

    sorted_gifts = Calendar.new(giftable_dates, gifts)
    sorted_gifts = sorted_gifts.map { |_day, gift| gift }

    expect(sorted_gifts[0]).to eq(the_first)
    expect(sorted_gifts[1]).to be_nil
    expect(sorted_gifts[2]).to be_nil
    expect(sorted_gifts[3]).to eq(the_fourth)
    expect(sorted_gifts[23]).to eq(the_end)
  end

  it 'knows the week day padding for the first date in the sequence' do
    giftable_dates = [Date.new(2015, 12, 1)]

    calendar = Calendar.new(giftable_dates, [])
#FIXME:    expect(calendar.start_padding).to eq(0)
  end
end<commit_msg>Changed start_padding from 0 to 1<commit_after>require File.expand_path('../../../app/models/calendar', __FILE__)
require 'date'

describe Calendar, type: :model do
  it 'returns an enumerator for the giftable_dates' do
    giftable_dates = 1.upto(24).map { |day| Date.new(2015, 12, day) }

    sorted_gifts = Calendar.new(giftable_dates, [])
    expect(sorted_gifts.count).to eq(24)
  end

  it 'yields the right gift for the right day' do
    the_first  = double('gift', date: Date.parse('2015-12-1'))
    the_fourth = double('gift', date: Date.parse('2015-12-4'))
    the_end    = double('gift', date: Date.parse('2015-12-24'))

    gifts          = [the_end, the_fourth, the_first]
    giftable_dates = 1.upto(24).map { |day| Date.new(2015, 12, day) }

    sorted_gifts = Calendar.new(giftable_dates, gifts)
    sorted_gifts = sorted_gifts.map { |_day, gift| gift }

    expect(sorted_gifts[0]).to eq(the_first)
    expect(sorted_gifts[1]).to be_nil
    expect(sorted_gifts[2]).to be_nil
    expect(sorted_gifts[3]).to eq(the_fourth)
    expect(sorted_gifts[23]).to eq(the_end)
  end

  it 'knows the week day padding for the first date in the sequence' do
    giftable_dates = [Date.new(2015, 12, 1)]

    calendar = Calendar.new(giftable_dates, [])
    expect(calendar.start_padding).to eq(1)
  end
end
{'fraction_non_alphanumeric': 0.14142194744976816, 'fraction_numerical': 0.04404945904173107, 'mean_word_length': 3.7944444444444443, 'pattern_counts': {'":': 0, '<': 3, '<?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': '638680', 'n_tokens_mistral': 1043, 'n_tokens_neox': 952, 'n_words': 211}