spec/timespan/mongoid/mongoid_timespan_spec.rb in timespan-0.4.3 vs spec/timespan/mongoid/mongoid_timespan_spec.rb in timespan-0.4.4

- old
+ new

@@ -42,17 +42,38 @@ describe '.start_date' do it 'should default to today' do DateTime.parse(subject.period.start_date.to_s).strftime('%d %b %Y').should == Date.today.strftime('%d %b %Y') end end + end + context 'Setters and delegates' do + let(:account) do + Account.create_it! 2.days + end + describe 'set new start_date' do before :each do subject.period_start = tomorrow + subject.period_end = tomorrow + 5.days + + subject.end_date = tomorrow + 3.days end specify do + Date.parse(subject.time_period.end_date.to_s).should == tomorrow + 3.days + end + + specify do + subject.period.should be_a Timespan + end + + specify do subject.start_date.should == subject.period.start_date + end + + specify do + subject.end_date.should == subject.period.end_date end specify do Date.parse(subject.start_date.to_s).should == tomorrow end \ No newline at end of file