Sha256: 42a8276748bf3697a4ea6e66996a6ccb18fef51d88c9f4988bd0f34954339cd4

Contents?: true

Size: 1.84 KB

Versions: 24

Compression:

Stored size: 1.84 KB

Contents

#- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license

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

# RFC 2445 Section 4.3.9 pp 39-40
describe RiCal::PropertyValue::Period do
  
  before(:each) do
    @start_dt = RiCal::PropertyValue::DateTime.new(nil, :value => "19970101T180000Z")
    @end_dt = RiCal::PropertyValue::DateTime.new(nil, :value => "19970102T070000Z")
    @duration = RiCal::PropertyValue::Duration.from_datetimes(nil, @start_dt.to_datetime, @end_dt.to_datetime)
  end
  
  describe "with an explicit period" do
    before(:each) do
      @value_string = "#{@start_dt.value}/#{@end_dt.value}"
      @it = RiCal::PropertyValue::Period.new(nil, :value => @value_string)
    end
    
    it "should have the correct dtstart value" do
      @it.dtstart.should == @start_dt
    end
    
    it "should have the correct dtend value" do
      @it.dtend.should == @end_dt
    end
    
    it "should have the correct duration value" do
      @it.duration.should == @duration
    end
    
    it "should have the correct string value" do
      @it.to_s.should == ":#{@value_string}"
    end
    
    it "should be its own ruby_value" do
      @it.ruby_value.should == @it      
    end
  end
  
  describe "with a start time and period" do
    before(:each) do
      @value_string = "#{@start_dt.value}/#{@duration.value}"
      @it = RiCal::PropertyValue::Period.new(nil, :value => @value_string)
    end
    
    it "should have the correct dtstart value" do
      @it.dtstart.should == @start_dt
    end
    
    it "should have the correct dtend value" do
      @it.dtend.should == @end_dt
    end
    
    it "should have the correct duration value" do
      @it.duration.should == @duration
    end
    
    it "should have the correct string value" do
      @it.to_s.should == ":#{@value_string}"
    end
  end
end

Version data entries

24 entries across 24 versions & 8 rubygems

Version Path
demingfactor-ri_cal-0.10.0 spec/ri_cal/property_value/period_spec.rb
demingfactor-ri_cal-0.9.0 spec/ri_cal/property_value/period_spec.rb
ebeigarts-ri_cal-0.8.1 spec/ri_cal/property_value/period_spec.rb
rubyredrick-ri_cal-0.7.7 spec/ri_cal/property_value/period_spec.rb
rubyredrick-ri_cal-0.8.0 spec/ri_cal/property_value/period_spec.rb
rubyredrick-ri_cal-0.8.1 spec/ri_cal/property_value/period_spec.rb
rubyredrick-ri_cal-0.8.2 spec/ri_cal/property_value/period_spec.rb
rubyredrick-ri_cal-0.8.4 spec/ri_cal/property_value/period_spec.rb
awallis-ri_cal-0.8.8 spec/ri_cal/property_value/period_spec.rb
justinsoong-ri_cal-0.8.9 spec/ri_cal/property_value/period_spec.rb
justinsoong-ri_cal-0.8.8 spec/ri_cal/property_value/period_spec.rb
micahwedemeyer-ri_cal-0.8.10 spec/ri_cal/property_value/period_spec.rb
micahwedemeyer-ri_cal-0.8.9 spec/ri_cal/property_value/period_spec.rb
ri_cal-0.8.8 spec/ri_cal/property_value/period_spec.rb
ri_cal-0.8.7 spec/ri_cal/property_value/period_spec.rb
ri_cal-0.8.6 spec/ri_cal/property_value/period_spec.rb
miguelbaldi-ri_cal-0.1 spec/ri_cal/property_value/period_spec.rb
ri_cal-0.8.5 spec/ri_cal/property_value/period_spec.rb
ri_cal-0.8.4 spec/ri_cal/property_value/period_spec.rb
ri_cal-0.8.2 spec/ri_cal/property_value/period_spec.rb