memory reset test

Umar M. Sheikh 11 年之前
父節點
當前提交
5533b3ffcc
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      spec/models/agents/public_transport_agent_spec.rb

+ 6 - 0
spec/models/agents/public_transport_agent_spec.rb

@@ -33,6 +33,12 @@ describe Agents::PublicTransportAgent do
33 33
       lambda { @agent.check }.should change {@agent.events.count}.by(4)
34 34
       lambda { @agent.check }.should_not change {@agent.events.count}
35 35
     end
36
+    it "should reset memory after 2 hours" do
37
+      lambda { @agent.check }.should change {@agent.events.count}.by(4)
38
+      stub(Time).now {"2014-01-14 20:21:30 +0500".to_time + 3.hours}
39
+      @agent.cleanup_old_memory
40
+      lambda { @agent.check }.should change {@agent.events.count}.by(4)
41
+    end
36 42
   end
37 43
   describe "validation" do
38 44
     it "should validate presence of stops" do