require "rails_helper"

RSpec.describe DateTimeHelper, type: :helper do
  let(:start_time) { DateTime.new(2019, 1, 1, 5, 5).to_time }

  describe "#time_to_next_quarter_hour" do
    it "returns the DateTime object that maps to the most upcoming quarter hour of a given time" do
      expect(DateTimeHelper.time_to_next_quarter_hour(start_time)).to eq DateTime.new(2019, 1, 1, 5, 15).to_time
    end
  end

  describe "#time_to_next_half_hour" do
    it "returns the DateTime object that maps to the most upcoming half hour of a given time" do
      expect(DateTimeHelper.time_to_next_half_hour(start_time)).to eq DateTime.new(2019, 1, 1, 5, 30).to_time
    end
  end

  describe "#time_to_next_hour" do
    it "returns the DateTime object that maps to the most upcoming hour of a given time" do
      expect(DateTimeHelper.time_to_next_hour(start_time)).to eq DateTime.new(2019, 1, 1, 6, 0).to_time
    end
  end

end
