|
|
|
|
@ -95,16 +95,9 @@ module CollectionTimeHelper
|
|
|
|
|
available_dates.empty? ? nil : available_dates.sample |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
# will time travel forwards only if needed. |
|
|
|
|
# useful for writing future tests that will also test the current time if it can. |
|
|
|
|
# useful for writing future tests that will also test the current time if it can or a future year if needed. |
|
|
|
|
# stops tests being frozen on a specific year. |
|
|
|
|
def collection_start_date_for_year_or_later(year) |
|
|
|
|
Timecop.return do |
|
|
|
|
if current_collection_start_year < year |
|
|
|
|
collection_start_date_for_year(year) |
|
|
|
|
else |
|
|
|
|
current_collection_start_date |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
collection_start_date_for_year([current_collection_start_year, year].max) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|