aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-support/puppet/puppet/maint-Change-spec-test-to-pass-on-ruby-2.2.patch
blob: 73e176974cce9abcb37b99d13d4da3c250883767 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From d183826136ca77847da5f3e460f2e460faabc5be Mon Sep 17 00:00:00 2001
From: Kylo Ginsberg <kylo@puppetlabs.com>
Date: Mon, 22 Dec 2014 10:11:38 -0800
Subject: [PATCH] (maint) Change spec test to pass on ruby 2.2

commit d183826136ca77847da5f3e460f2e460faabc5be from
https://github.com/puppetlabs/puppet.git

Prior to this change, this spec test failed on ruby 2.2.0-rc1 with:

     Failure/Error: Time.stubs(:now).returns(Time.parse("2011-01-06 12:00:00 UTC"))
     NoMethodError:
       undefined method `utc_offset' for nil:NilClass

I didn't track down the root cause of this failure, but just
normalized this stub to use Time.utc, which (along with Time.local)
is the more common way of stubbing Time objects in the codebase.
---
 spec/unit/reports/store_spec.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/spec/unit/reports/store_spec.rb b/spec/unit/reports/store_spec.rb
index 7f94f7d..f56eccd 100755
--- a/spec/unit/reports/store_spec.rb
+++ b/spec/unit/reports/store_spec.rb
@@ -24,7 +24,7 @@ describe processor do
     end
 
     it "should write the report to the file in YAML" do
-      Time.stubs(:now).returns(Time.parse("2011-01-06 12:00:00 UTC"))
+      Time.stubs(:now).returns(Time.utc(2011,01,06,12,00,00))
       @report.process
 
       File.read(File.join(Puppet[:reportdir], @report.host, "201101061200.yaml")).should == @report.to_yaml
-- 
2.1.4