From 3357667e2a0f3ef2094bcf24a4bc8171e84ddaf1 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Mon, 19 Jul 2010 02:29:05 +0300 Subject: [PATCH] specs for Redistat::Date.to_time/to_date --- spec/date_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/date_spec.rb b/spec/date_spec.rb index b1457ae..3091004 100644 --- a/spec/date_spec.rb +++ b/spec/date_spec.rb @@ -21,6 +21,18 @@ describe Redistat::Date do [:year, :month, :day, :hour, :min, :sec].each { |k| rdate.send(k).should == now.send(k) } end + it "should convert to Time object" do + now = Time.now + rdate = Redistat::Date.new(now) + rdate.to_time.to_s.should == now.to_s + end + + it "should convert to Date object" do + today = Date.today + rdate = Redistat::Date.new(today) + rdate.to_date.to_s.should == today.to_s + end + it "should convert to string with correct depths" do today = Date.today rdate = Redistat::Date.new(today)