I have a test/fixtures/users.yml like so:
created_at: <%=Time.now.strftime("%Y-%m-%d %H:%M:%S")%>
updated_at: <%=Time.now.strftime("%Y-%m-%d %H:%M:%S")%>
I don’t like how I’m repeating myself with the strftime bit.
Is there some shorter Time method to format time for a (MySQL) datetime
field that I’ve missed? The magic of created_at/updated_at does not seem
to work with fixtures.
Assuming I want to avoid repeating myself, in what file would I add a
helper method for this, or extend the Time class with a method?
Apparently not test_helper - “undefined local variable or method”.