<commit_before>require "koyomi_helper"

describe Koyomi::Year do
  let(:year) { described_class.new(*given) }

  describe ".of" do
    let(:year) { described_class.of(*given) }
    let!(:today) { Date.today }

    context "nothing given" do
      subject { year }
      let(:given) { }
      it { expect(subject.year).to eq today.year }
    end
  end

  describe "#first" do
    subject { year.first }

    context "given year 2015" do
      let(:given) { 2015 }
      it { is_expected.to eq Date.new(2015, 1, 1) }
    end
  end

  describe "#last" do
    subject { year.last }

    context "given year 2015" do
      let(:given) { 2015 }
      it { is_expected.to eq Date.new(2015, 12, 31) }
    end
  end
end<commit_msg>Add Koyomi::Year spec #first, #last<commit_after>require "koyomi_helper"

describe Koyomi::Year do
  let(:year) { described_class.new(*given) }

  describe ".of" do
    subject { year }
    let(:year) { described_class.of(*given) }
    let!(:today) { Date.today }

    context "given nothing" do
      let(:given) { }
      it { expect(subject.year).to eq today.year }
    end

    context "given today" do
      let(:given) { today }
      it { expect(subject.year).to eq today.year }
    end

    context "given next year's first" do
      let(:given) { Date.new(today.year + 1, 1, 1) }
      it { expect(subject.year).to eq (today.year + 1)}
    end

    context "given prev year's first" do
      let(:given) { Date.new(today.year - 1, 1, 1) }
      it { expect(subject.year).to eq (today.year - 1)}
    end
  end

  describe "#first" do
    subject { year.first }

    context "given year 2015" do
      let(:given) { 2015 }
      it { is_expected.to eq Date.new(2015, 1, 1) }
    end
  end

  describe "#last" do
    subject { year.last }

    context "given year 2015" do
      let(:given) { 2015 }
      it { is_expected.to eq Date.new(2015, 12, 31) }
    end
  end
end
{'fraction_non_alphanumeric': 0.13428120063191154, 'fraction_numerical': 0.03580832016850974, 'mean_word_length': 2.4296028880866425, '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': '215839', 'n_tokens_mistral': 755, 'n_tokens_neox': 641, 'n_words': 184}