Sha256: 62f8871242f713557257de64f79b5d3d3738a3dc864d217f68cbe87664b028ed

Contents?: true

Size: 1.71 KB

Versions: 1

Compression:

Stored size: 1.71 KB

Contents

#- ©2009 Rick DeNatale
#- All rights reserved

require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])

describe RiCal::Component::Todo do

  describe "with both due and duration specified" do
    before(:each) do
      @it = RiCal::Component::Todo.parse_string("BEGIN:VTODO\nDUE:19970903T190000Z\nDURATION:H1\nEND:VTODO").first
    end
    
    it "should be invalid" do
      @it.should_not be_valid
    end
  end

  describe "with a duration property" do
    before(:each) do
      @it = RiCal::Component::Todo.parse_string("BEGIN:VTODO\nDURATION:H1\nEND:VTODO").first
    end

    it "should have a duration property" do
      @it.duration_property.should be
    end
    
    it "should have a duration of 1 Hour" do
      @it.duration_property.value.should == "H1"
    end
    
    it "should reset the duration property if the due property is set" do
      @it.due_property = "19970101".to_ri_cal_date_time_value
      @it.duration_property.should be_nil
    end
    
    it "should reset the duration property if the dtend ruby value is set" do
      @it.due = "19970101"
      @it.duration_property.should == nil
    end
  end

  describe "with a due property" do
    before(:each) do
      @it = RiCal::Component::Todo.parse_string("BEGIN:VTODO\nDUE:19970903T190000Z\nEND:VTODO").first
    end

    it "should have a due property" do
      @it.due_property.should be
    end
    
    it "should reset the due property if the duration property is set" do
      @it.duration_property = "H1".to_ri_cal_duration_value
      @it.due_property.should be_nil
    end
    
    it "should reset the duration property if the dtend ruby value is set" do
      @it.duration = "19970101"
      @it.due_property.should == nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubyredrick-ri_cal-0.0.2 spec/ri_cal/component/todo_spec.rb