Sha256: 82ddbce1c72c06de7ded7329f96cac5572d684964be2bf2002a3efd872759c4c

Contents?: true

Size: 497 Bytes

Versions: 2

Compression:

Stored size: 497 Bytes

Contents

require 'spec_helper'

module Prosperity
  describe Periods do
    subject { Periods::DAY }

    describe "#each_period" do
      it "iterates until the end time" do
        times = []
        start_time = DateTime.new(2012, 01, 01)
        end_time = DateTime.new(2012, 01, 05)

        subject.each_period(start_time, end_time) do |start_time|
          times << start_time
        end

        expect(times).to eq(Array.new(7) { |i| DateTime.new(2012, 01, i + 1) })
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
prosperity-0.0.11 spec/lib/prosperity/periods_spec.rb
prosperity-0.0.10 spec/lib/prosperity/periods_spec.rb