Module: Greenbar::DateSetup
- Includes:
- ClassMethodSetup, TestSetup
- Defined in:
- lib/greenbar/DateSetup.rb
Instance Method Summary collapse
-
#make_Date_today_return(date) ⇒ Object
Sets the Date to be returned for Date.today Must be called before Date.today if DateSetup is being used.
-
#setup_mixin ⇒ Object
:nodoc:.
-
#teardown_mixin ⇒ Object
:nodoc:.
Methods included from ClassMethodSetup
#define_class_method, #replace_class_method, #replace_new
Methods included from TestSetup
included, #setup, #setup_mixins, #teardown, #teardown_mixins
Instance Method Details
#make_Date_today_return(date) ⇒ Object
Sets the Date to be returned for Date.today Must be called before Date.today if DateSetup is being used.
51 52 53 |
# File 'lib/greenbar/DateSetup.rb', line 51 def make_Date_today_return date Date.instance_variable_set '@today', date end |
#setup_mixin ⇒ Object
:nodoc:
39 40 41 42 43 44 45 |
# File 'lib/greenbar/DateSetup.rb', line 39 def setup_mixin #:nodoc: replace_class_method(Date, :today) { raise "Must use make_Date_today_return() when using DateSetup." unless defined? @today @today } end |