<commit_before>require "koyomi_helper"

describe Koyomi::MonthCycle do
  let(:month_cycle) { described_class.new(*given) }

  describe "#new" do
    it("initialized with Koyomi::Month") do
      month = Koyomi::Month.new
      expect { described_class.new(month) }.not_to raise_error
    end
  end

  describe "#dates" do
    subject { month_cycle.dates }
    let(:given) { Koyomi::Month.new }
    it { is_expected.to be_kind_of(Array) }
  end

  context "2015-11" do
    let(:given) { Koyomi::Month.new(11, 2015) }
    describe "#add" do
      subject { month_cycle.dates }

      context "[[1, 3], :fri]" do
        before { month_cycle.add([[1, 3], :fri]) }
        let(:cycle) { [[1, 3], :fri] }
        let(:expected) { [Date.new(2015, 11, 6), Date.new(2015, 11, 20)] }
        it { is_expected.to eq expected }
      end

      context "Date given" do
        before { month_cycle.add(date) }
        let(:date) { Date.new(2015, 11, 1) }
        it { is_expected.to include(date) }
      end

      context "invalid date given" do
        let(:date) { Date.new(2015, 12, 1) }
        it { expect { month_cycle.add(date) }.to raise_error(Koyomi::WrongRangeError) }
      end

      context "add some times" do
        before do
          month_cycle.add(Date.new(2015, 11, 6)) # first friday
          month_cycle.add([[1, 3], :fri]) # 2015-11-06, 2015-11-20
          month_cycle.add(Date.new(2015, 11, 1))
        end

        describe "uniqed" do
          its("size") { is_expected.to eq 3 }
        end

        describe "sorted" do
          its("first") { is_expected.to eq Date.new(2015, 11, 1)}
        end
      end

      context "add sequencial" do
        subject { month_cycle.add(Date.new(2015, 11, 1), [[1, 3], :fri]) }
        it { expect { subject }.not_to raise_error }
        it { expect(subject.dates.size).to eq 3 }
      end
    end<commit_msg>Change Koyomi::MonthCycle#add spec > different from intention corrected<commit_after>require "koyomi_helper"

describe Koyomi::MonthCycle do
  let(:month_cycle) { described_class.new(*given) }

  describe "#new" do
    it("initialized with Koyomi::Month") do
      month = Koyomi::Month.new
      expect { described_class.new(month) }.not_to raise_error
    end
  end

  describe "#dates" do
    subject { month_cycle.dates }
    let(:given) { Koyomi::Month.new }
    it { is_expected.to be_kind_of(Array) }
  end

  context "2015-11" do
    let(:given) { Koyomi::Month.new(11, 2015) }
    describe "#add" do
      subject { month_cycle.dates }

      context "[[1, 3], :fri]" do
        before { month_cycle.add([[1, 3], :fri]) }
        let(:cycle) { [[1, 3], :fri] }
        let(:expected) { [Date.new(2015, 11, 6), Date.new(2015, 11, 20)] }
        it { is_expected.to eq expected }
      end

      context "Date given" do
        before { month_cycle.add(date) }
        let(:date) { Date.new(2015, 11, 1) }
        it { is_expected.to include(date) }
      end

      context "invalid date given" do
        let(:date) { Date.new(2015, 12, 1) }
        it { expect { month_cycle.add(date) }.to raise_error(Koyomi::WrongRangeError) }
      end

      context "add some times" do
        before do
          month_cycle.add(Date.new(2015, 11, 6)) # first friday
          month_cycle.add([[1, 3], :fri]) # 2015-11-06, 2015-11-20
          month_cycle.add(Date.new(2015, 11, 1))
        end

        describe "uniqed" do
          its("size") { is_expected.to eq 3 }
        end

        describe "sorted" do
          its("first") { is_expected.to eq Date.new(2015, 11, 1)}
        end
      end

      context "add sequencial" do
        subject { month_cycle.add(Date.new(2015, 11, 1)).add([[1, 3], :fri]) }
        it { expect { subject }.not_to raise_error }
        it { expect(subject.dates.size).to eq 3 }
      end
    end
{'fraction_non_alphanumeric': 0.1402310924369748, 'fraction_numerical': 0.050945378151260504, 'mean_word_length': 2.323734729493892, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '6628262', 'n_tokens_mistral': 1480, 'n_tokens_neox': 1297, 'n_words': 324}