<commit_before>require "spec_helper"

describe ActiveSupport::TimeWithZone do

  let(:time_zone) do
    ActiveSupport::TimeZone.new("Berlin")
  end

  describe ".evolve" do

    context "when provided a time" do

      let(:date) do
        time_zone.local(2010, 1, 1, 12, 0, 0)
      end

      let(:evolved) do
        described_class.evolve(date)
      end

      let(:expected) do
        Time.new(2010, 1, 1, 12, 0, 0).utc
      end

      it "returns the same time" do
        evolved.should eq(expected)
      end

      it "returns the time in utc" do
        evolved.utc_offset.should eq(0)
      end
    end

    context "when provided an array" do

      context "when the array is composed of times" do

        let(:date) do
          time_zone.local(2010, 1, 1, 12, 0, 0)
        end

        let(:evolved) do
          described_class.evolve([ date ])
        end

        let(:expected) do
          Time.new(2010, 1, 1, 12, 0, 0).utc
        end

        it "returns the array with evolved times" do
          evolved.should eq([ expected ])
        end

        it "returns utc times" do
          evolved.first.utc_offset.should eq(0)
        end
      end

      context "when the array is composed of strings" do

        let(:date) do
          time_zone.parse("1st Jan 2010 12:00:00+01:00")
        end

        let(:evolved) do
          described_class.evolve([ date.to_s ])
        end

        it "returns the strings as a times" do
          evolved.should eq([ date.to_time ])
        end

        it "returns the times in utc" do
          evolved.first.utc_offset.should eq(0)
        end
      end

      context "when the array is composed of integers" do

        let(:integer) do
          1331890719
        end

        let(:evolved) do
          described_class.evolve([ integer ])
        end

        let(:expected) do
          Time.at(integer).utc
        end

        it "returns the integers as times" do
          evolved.should eq([ expected ])
        end

        it "returns the times in utc" do
          evolved.first.utc_offset.should eq(0)
        end
      end

      context "when the array is composed of floats" do

        let(:float) do
          1331890719.413
        end

        let(:evolved) do
          described_class.evolve([ float ])
        end

        let(:expected) do
          Time.at(float).utc
        end

        it "returns the floats as times" do
          evolved.should eq([ expected ])
        end

        it "returns the times in utc" do
          evolved.first.utc_offset.should eq(0)
        end
      end
    end

    context "when provided a range" do

      context "when the range are dates" do

        let(:min) do
          time_zone.local(2010, 1, 1, 12, 0, 0)
        end

        let(:max) do
          time_zone.local(2010, 1, 3, 12, 0, 0)
        end

        let(:evolved) do
          described_class.evolve(min..max)
        end

        let(:expected_min) do
          Time.new(2010, 1, 1, 12, 0, 0).utc
        end

        let(:expected_max) do
          Time.new(2010, 1, 3, 12, 0, 0).utc
        end

        it "returns a selection of times" do
          evolved.should eq(
            { "$gte" => expected_min, "$lte" => expected_max }
          )
        end

        it "returns the times in utc" do
          evolved["$gte"].utc_offset.should eq(0)
        end
      end
<commit_msg>Change specs to use time zone other than berlin<commit_after>require "spec_helper"

describe ActiveSupport::TimeWithZone do

  let(:time_zone) do
    ActiveSupport::TimeZone.new("Eastern Time (US & Canada)")
  end

  describe ".evolve" do

    context "when provided a time" do

      let(:date) do
        time_zone.local(2010, 1, 1, 12, 0, 0)
      end

      let(:evolved) do
        described_class.evolve(date)
      end

      let(:expected) do
        Time.utc(2010, 1, 1, 17, 0, 0)
      end

      it "returns the same time" do
        evolved.should eq(expected)
      end

      it "returns the time in utc" do
        evolved.utc_offset.should eq(0)
      end
    end

    context "when provided an array" do

      context "when the array is composed of times" do

        let(:date) do
          time_zone.local(2010, 1, 1, 12, 0, 0)
        end

        let(:evolved) do
          described_class.evolve([ date ])
        end

        let(:expected) do
          Time.utc(2010, 1, 1, 17, 0, 0)
        end

        it "returns the array with evolved times" do
          evolved.should eq([ expected ])
        end

        it "returns utc times" do
          evolved.first.utc_offset.should eq(0)
        end
      end

      context "when the array is composed of strings" do

        let(:date) do
          time_zone.parse("1st Jan 2010 12:00:00+01:00")
        end

        let(:evolved) do
          described_class.evolve([ date.to_s ])
        end

        it "returns the strings as a times" do
          evolved.should eq([ date.to_time ])
        end

        it "returns the times in utc" do
          evolved.first.utc_offset.should eq(0)
        end
      end

      context "when the array is composed of integers" do

        let(:integer) do
          1331890719
        end

        let(:evolved) do
          described_class.evolve([ integer ])
        end

        let(:expected) do
          Time.at(integer).utc
        end

        it "returns the integers as times" do
          evolved.should eq([ expected ])
        end

        it "returns the times in utc" do
          evolved.first.utc_offset.should eq(0)
        end
      end

      context "when the array is composed of floats" do

        let(:float) do
          1331890719.413
        end

        let(:evolved) do
          described_class.evolve([ float ])
        end

        let(:expected) do
          Time.at(float).utc
        end

        it "returns the floats as times" do
          evolved.should eq([ expected ])
        end

        it "returns the times in utc" do
          evolved.first.utc_offset.should eq(0)
        end
      end
    end

    context "when provided a range" do

      context "when the range are dates" do

        let(:min) do
          time_zone.local(2010, 1, 1, 12, 0, 0)
        end

        let(:max) do
          time_zone.local(2010, 1, 3, 12, 0, 0)
        end

        let(:evolved) do
          described_class.evolve(min..max)
        end

        let(:expected_min) do
          Time.utc(2010, 1, 1, 17, 0, 0)
        end

        let(:expected_max) do
          Time.utc(2010, 1, 3, 17, 0, 0)
        end

        it "returns a selection of times" do
          evolved.should eq(
            { "$gte" => expected_min, "$lte" => expected_max }
          )
        end

        it "returns the times in utc" do
          evolved["$gte"].utc_offset.should eq(0)
        end
      end

{'fraction_non_alphanumeric': 0.08916544655929722, 'fraction_numerical': 0.0363103953147877, 'mean_word_length': 1.569010906355773, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5316333', 'n_tokens_mistral': 2329, 'n_tokens_neox': 2069, 'n_words': 671}