Ruby
Rails

Rails consoleで時間をずらしたい

TimeクラスをOverrideして解決

$ bundle exec rails console
irb(main)> Time.current
=> Tue, 03 Oct 2017 12:00:00 JST +09:00
irb(main)> class Time
irb(main)>   def self.current
irb(main)>     Time.zone.local(2017, 10, 5)
irb(main)>   end
irb(main)> end
=> :current
irb(main)> Time.current
=> Thu, 05 Oct 2017 00:00:00 JST +09:00

コピペ用

class Time
def self.current
Time.zone.local(2017, 10, 5)
end
end