require 'rails_helper'

RSpec.describe Time do #epoch_week
  expectations = {
    '2017-01-01' => 2452, # year 2016, week 52
    '2020-12-24' => 2660, # year 2020, week 52
    '2021-01-01' => 2661, # year 2020, week 53
    '2021-01-03' => 2661, # year 2020, week 53
    '2021-01-04' => 2662, # year 2021, week 1
    '2021-01-07' => 2662, # year 2021, week 1
    '2021-01-12' => 2663, # year 2021, week 2
  }
  expectations.each do |time, expected_epoch_week|
    it "has the proper epoch_week for #{time}" do
      time.to_time.epoch_week.should eq expected_epoch_week
    end
  end
end
