ã¿ãªããã timecop 使ã£ã¦ã¾ããï¼timecop ã¯ããã¹ãã§æéãæ±ãæã«å¿ é ã¨è¨ããã©ã¤ãã©ãªã§ãããã¹ãä¸ã®æéãæ¢ããã(Timecop.freeze)æéã移åãããã(Timecop.travel)ã§ãã¾ããä¼¼ããããªã©ã¤ãã©ãªã¨ã㦠delorean ãããã¾ããRailsCasts ã§ãç´¹ä»ããã¦ãã¾ãã
ãã¦ãtimecop ã® README ã«ã¯ä¸è¨ã®ãããªã³ã¼ãä¾ãæ¸ãã¦ããã¾ãã
t = Time.local(2008, 9, 1, 10, 5, 0)
Timecop.travel(t)
åã¯ããã¾ã§ä¸è¨ã®ããã«æ¸ãããæ¹æ³ãç¡ãã¨æã£ã¦ããã®ã§ãããä»æ¥ä¸è¨ã®ããã«ãæ¸ãããã¨ã«æ°ã¥ãã¾ããã
Timecop.travel(2008, 9, 1, 10, 5, 0)
ã¾ãããããã¯ã使ããã¨ãã§ãã¾ãã
Timecop.travel(2008, 9, 1, 10, 5, 0) do
Time.now #=> 2008-09-01 10:05:00 +0900
end
Time.now #=> 2013-01-15 22:08:12 +0900
ã¡ãã£ã´ã便å©ã§ãããã¡ãªã¿ã«Timecop.freeze
ãåæ§ã«ä½¿ãã¾ããrdoc ãã¡ããã¨èªãã°æ¸ãã¦ãã話ãªã®ã§ãããREADME èªãã ãã§æ®éã«ä½¿ãã«ã¯ååãªã®ã§ã¿ããªãã£ã¨ãªããªãæ°ã¥ããªãã¯ãâ¦ã