memory reset test

Umar M. Sheikh %!s(int64=11) %!d(string=hace) años
padre
commit
5533b3ffcc
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  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