Skip to content

Commit

Permalink
add documentation for Timescop#scale (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Jeffery committed Sep 21, 2012
1 parent 3854a84 commit 6881a53
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
5 changes: 5 additions & 0 deletions History.rdoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
=== 0.5.2 / 2012-09-20

* Feature
* Timecop#scale, ability to accelerate time by a given scaling factor

=== 0.5.0 / 2012-09-12

* Maintenance
Expand Down
18 changes: 18 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ A gem providing "time travel" and "time freezing" capabilities, making it dead s

- Freeze time to a specific point.
- Travel back to a specific point in time, but allow time to continue moving forward from there.
- Scale time by a given scaling factor that will cause time to move at an accelerated pace.
- No dependencies, can be used with _any_ ruby project
- Timecop api allows arguments to be passed into #freeze and #travel as one of the following:
- Time instance
Expand Down Expand Up @@ -75,6 +76,23 @@ sleep(10)
new_time == Time.now # ==> false
```

### Timecop.scale

Let's say you want to test a "live" integration wherein entire days could pass by
in minutes while you're able to simulate "real" activity. For example, one such use case
is being able to test reports and invoices that run in 30 day cycles in very little time, while also
being able to simulate activity via subsequent calls to your application.

```ruby
# seconds will now seem like hours
Timecop.lens(3600)
Time.now
# => 2012-09-20 21:23:25 -0500
# seconds later, hours have past it's gone from 9pm at night to 6am in the morning
Time.now
# => 2012-09-21 06:22:59 -0500
```

## REFERENCES

* {0.3.4 release}[http://blog.smartlogicsolutions.com/2009/12/07/timecop-0-3-4-released/]
Expand Down
2 changes: 1 addition & 1 deletion lib/timecop/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class Timecop
VERSION = "0.5.1"
VERSION = "0.5.2"
end
2 changes: 1 addition & 1 deletion timecop.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Travis Jeffery", "John Trupiano"]
s.date = %q{2012-09-05}
s.date = %q{2012-09-20}
s.description = %q{A gem providing "time travel" and "time freezing" capabilities, making it dead simple to test time-dependent code. It provides a unified method to mock Time.now, Date.today, and DateTime.now in a single call.}
s.email = %q{[email protected]}
s.extra_rdoc_files = [
Expand Down

0 comments on commit 6881a53

Please sign in to comment.