date_ranger 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/date_ranger/bootstrapper.rb +2 -0
- data/lib/date_ranger/version.rb +1 -1
- data/spec/date_ranger_spec.rb +8 -0
- metadata +1 -1
@@ -3,6 +3,8 @@ module DateRanger::Bootstrapper
|
|
3
3
|
def has_date_range(options={})
|
4
4
|
class_attribute :date_ranger_options
|
5
5
|
self.date_ranger_options = options
|
6
|
+
self.date_ranger_options[:default_start_date] ||= lambda { Date.today }
|
7
|
+
self.date_ranger_options[:default_end_date] ||= lambda { Date.today }
|
6
8
|
self.date_ranger_options[:timestep] ||= :daily
|
7
9
|
if self.date_ranger_options[:class]
|
8
10
|
extend DateRanger
|
data/lib/date_ranger/version.rb
CHANGED
data/spec/date_ranger_spec.rb
CHANGED
@@ -73,6 +73,14 @@ describe DateRanger do
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
+
context 'when default dates are not overridden' do
|
77
|
+
it 'should both be today' do
|
78
|
+
something = Something.new
|
79
|
+
something.start_date.should == Date.today
|
80
|
+
something.end_date.should == Date.today
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
76
84
|
describe "#end_date" do
|
77
85
|
it 'should return date given a string' do
|
78
86
|
Something.has_date_range
|