From d4d42d6f684e9591a1c6869eaa54d7a1b1c40e09 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Mon, 19 Jul 2010 10:08:24 +0300 Subject: [PATCH] updated specs to test to_redistat method on Time and Date objects --- spec/date_spec.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/spec/date_spec.rb b/spec/date_spec.rb index 3091004..d33c877 100644 --- a/spec/date_spec.rb +++ b/spec/date_spec.rb @@ -4,15 +4,17 @@ describe Redistat::Date do it "should initialize from Time object" do now = Time.now - rdate = Redistat::Date.new(now) - [:year, :month, :day, :hour, :min, :sec].each { |k| rdate.send(k).should == now.send(k) } + [Redistat::Date.new(now), now.to_redistat].each do |rdate| + [:year, :month, :day, :hour, :min, :sec].each { |k| rdate.send(k).should == now.send(k) } + end end it "should initialize from Date object" do today = Date.today - rdate = Redistat::Date.new(today) - [:year, :month, :day].each { |k| rdate.send(k).should == today.send(k) } - [:hour, :min, :sec].each { |k| rdate.send(k).should == nil } + [Redistat::Date.new(today), today.to_redistat].each do |rdate| + [:year, :month, :day].each { |k| rdate.send(k).should == today.send(k) } + [:hour, :min, :sec].each { |k| rdate.send(k).should == nil } + end end it "should initialize from String object" do