-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Timecop#lens where time can go FASTER #42
Conversation
Any PR referencing TOS is good by me. Why call it Timecop#lens vs. something like Timecop#scale? I'm also interested in your use case for this? |
Would you like me to refactor the method name and resubmit the pull request? The use case: The QA team wants to run a simulation of 3 complete (30-day) billing cycles in a day. While they are happy with unit testing, they want some kind of "live" integration testing where days will pass in hours so they can see billing invoices and reports while simulating "real" activitiy. They want to stand up a "complete" production environment, but not have to wait 3 months. Thus Timecop#scale was born. It works better than expected! We have several rails apps communicating via HTTP/JSON apis and Resque. Anything that depends on a Rails environment can be very simply configured to use the same time scale and presto! ...development.rb...
if ENV['TIME_SCALE']
time_scale = ENV['TIME_SCALE'].to_f
config.after_initialize do
Timecop.lens(time_scale)
end
# the slow query logger things *every* query is slow!
config.active_record.auto_explain_threshold_in_seconds = 0.5 * time_scale
$stderr.puts "TIME_SCALE: #{time_scale} @ #{Time.now.to_s}"
end Besides, it's just so cool :-) Ken Mayer |
Alright awesome. No problem I did the refactoring myself, as much I like the name and its history too, I think Sometime I should make it out to one of your guy's offices, I maintain another project called jasmine-jquery that you guys were obviously quite influential in too. :D |
You're welcome any time. Come over for breakfast or one of our Tuesday tech talks and we'll serve you lunch, too. |
* Paulche/patch-1: Hreffy reference to #42 Conflicts: README.markdown
travisjeffery#42 concerns `#scale` not `#safe_mode`.
Hi, I'm having problems with my database while using scale, I keep getting:
how can I solve this? |
This pull request could also be named the "Scalosian" request (http://en.wikipedia.org/wiki/Wink_of_an_Eye).
Create a new mock_type,
lens
which will let time continue, liketravel
, but the first argument is a scaling factor which will make time move at an accelerated pace.e.g.
David Holcomb, david.holcomb@hp.com
Ken Mayer, ken@pivotallabs.com