]> projects.mako.cc - selectricity-live/blob - vendor/plugins/login_engine/test/mocks/time.rb
e253adae9d4422216b4a23c24d61260c811f7901
[selectricity-live] / vendor / plugins / login_engine / test / mocks / time.rb
1 require 'time'
2
3 Time.class_eval { 
4   if !respond_to? :now_old # somehow this is getting defined many times.
5     @@advance_by_days = 0
6     cattr_accessor :advance_by_days
7
8     class << Time
9       alias now_old now
10       def now
11         if Time.advance_by_days != 0
12           return Time.at(now_old.to_i + Time.advance_by_days * 60 * 60 * 24 + 1)
13         else
14           now_old
15         end
16       end
17     end
18   end
19 }

Benjamin Mako Hill || Want to submit a patch?