aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/info_request_spec.rb
diff options
context:
space:
mode:
authortony <tony>2009-03-17 11:12:37 +0000
committertony <tony>2009-03-17 11:12:37 +0000
commit8986a977b069d127b5664fc11e4927da4a6f7535 (patch)
treef86f5782edc8e10613357eda80ba86d0dfc50175 /spec/models/info_request_spec.rb
parentcf7999629d497bd076918a5e78a0ad9b173ab3dc (diff)
Can change time much more easily with RSpec's stubbing
Diffstat (limited to 'spec/models/info_request_spec.rb')
-rw-r--r--spec/models/info_request_spec.rb12
1 files changed, 2 insertions, 10 deletions
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb
index 9f258fb7c..c433686cd 100644
--- a/spec/models/info_request_spec.rb
+++ b/spec/models/info_request_spec.rb
@@ -124,21 +124,13 @@ describe InfoRequest, "when calculating status" do
it "isn't overdue on due day" do
ir = send_msg(Time.utc(2009, 03, 16, 12, 0, 0))
- Time.class_eval do
- def self.now
- Time.utc(2009, 04, 16, 14, 0, 0)
- end
- end
+ Time.stub!(:now).and_return(Time.utc(2009, 04, 16, 14, 0, 0))
ir.days_overdue.should == 0
end
it "is overdue a day after due day" do
ir = send_msg(Time.utc(2009, 03, 16, 12, 0, 0))
- Time.class_eval do
- def self.now
- Time.utc(2009, 04, 17, 11, 0, 0)
- end
- end
+ Time.stub!(:now).and_return(Time.utc(2009, 04, 17, 11, 0, 0))
ir.days_overdue.should == 1
end