timecop 0.5.7 → 0.5.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,15 +51,14 @@ class Timecop
51
51
  end
52
52
 
53
53
  def time(time_klass = Time) #:nodoc:
54
- actual_time = time_klass.at(@time)
55
- calculated_time = time_klass.at(@time.to_f)
54
+ begin
55
+ time = time_klass.at(@time)
56
+ rescue
57
+ time = time_klass.at(@time.to_f)
58
+ end
56
59
 
57
60
  if travel_offset.nil?
58
- if times_are_equal_within_epsilon(actual_time, calculated_time, 1)
59
- actual_time
60
- else
61
- calculated_time
62
- end
61
+ time
63
62
  elsif scaling_factor.nil?
64
63
  time_klass.at(Time.now_without_mock_time + travel_offset)
65
64
  else
@@ -1,3 +1,3 @@
1
1
  class Timecop
2
- VERSION = "0.5.7"
2
+ VERSION = "0.5.8"
3
3
  end
@@ -242,6 +242,6 @@ class TestTimeStackItem < Test::Unit::TestCase
242
242
  time = Time.now
243
243
  Timecop.freeze time
244
244
  assert_equal time, Time.now
245
- assert_equal time.nsec, Time.now.nsec
245
+ assert_equal time.nsec, Time.now.nsec if (Time.now.respond_to?(:nsec))
246
246
  end
247
247
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timecop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
5
- prerelease:
4
+ prerelease:
5
+ version: 0.5.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - Travis Jeffery
9
9
  - John Trupiano
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-27 00:00:00.000000000 Z
13
+ date: 2013-01-08 00:00:00.000000000 Z
14
14
  dependencies: []
15
- description: A gem providing "time travel" and "time freezing" capabilities, making
16
- it dead simple to test time-dependent code. It provides a unified method to mock
17
- Time.now, Date.today, and DateTime.now in a single call.
15
+ description: 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.
18
16
  email: travisjeffery@gmail.com
19
17
  executables: []
20
18
  extensions: []
@@ -39,31 +37,31 @@ files:
39
37
  - test/timecop_without_date_but_with_time_test.rb
40
38
  homepage: https://github.com/travisjeffery/timecop
41
39
  licenses: []
42
- post_install_message:
40
+ post_install_message:
43
41
  rdoc_options:
44
- - --charset=UTF-8
42
+ - "--charset=UTF-8"
45
43
  require_paths:
46
44
  - lib
47
45
  required_ruby_version: !ruby/object:Gem::Requirement
48
- none: false
49
46
  requirements:
50
- - - ! '>='
47
+ - - ">="
51
48
  - !ruby/object:Gem::Version
52
- version: '0'
53
- required_rubygems_version: !ruby/object:Gem::Requirement
49
+ version: !binary |-
50
+ MA==
54
51
  none: false
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
53
  requirements:
56
- - - ! '>='
54
+ - - ">="
57
55
  - !ruby/object:Gem::Version
58
- version: '0'
56
+ version: !binary |-
57
+ MA==
58
+ none: false
59
59
  requirements: []
60
60
  rubyforge_project: timecop
61
- rubygems_version: 1.8.23
62
- signing_key:
61
+ rubygems_version: 1.8.24
62
+ signing_key:
63
63
  specification_version: 3
64
- summary: A gem providing "time travel" and "time freezing" capabilities, making it
65
- dead simple to test time-dependent code. It provides a unified method to mock Time.now,
66
- Date.today, and DateTime.now in a single call.
64
+ summary: 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.
67
65
  test_files:
68
66
  - test/test_helper.rb
69
67
  - test/time_stack_item_test.rb