Dates and Times
Date and time logic has a well-deserved reputation as some of the most complex and irritating logic in any application. Testing calendar logicâincluding time-based reports, automatic logouts, and â1 day agoâ text displaysâcan be a particular headache, but you can do a couple of things to simplify the time-logic beast.
Part of the Problem
We have a YAML file with some projects:
â | runway:⨠name: Project Runway |
â | start_date: â2015-01-20â |
â | |
â | greenlight:⨠name: Project Greenlight |
â | start_date: â2015-02-04â |
â | |
â | gutenberg:⨠name: Project Gutenberg |
â | start_date: â2015-01-31â |
Weâd like to test some time-based code that might be used in a search or report result; this goes in test/unit/project_test.rb ...
Get Rails 4 Test Prescriptions now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.