Sha256: e340e1ce438180c77ee02db913377a0281be46bfe22d057ab40a10e84a969a24

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::Calendar do

  context ".entity_name" do
    it "should be VCALENDAR" do
      RiCal::Component::Calendar.entity_name.should == "VCALENDAR"
    end
  end
  
  context "a new instance" do
    before(:each) do
      @it = RiCal.Calendar
    end
    
    it "should have a tz_source of 'TZ_INFO" do
      @it.tz_source.should == "TZINFO"
    end
    
    it "should export a product id with an X-RICAL-TZSOURCE parameter of TZINFO" do
      @it.export.should match(%r{\nPRODID;X-RICAL-TZSOURCE=TZINFO:-//com.denhaven2/NONSGML ri_cal gem//EN\n})
    end
  end
  
  context "an imported instance with a tzinfo source" do
    before(:each) do
      @it = RiCal.parse_string("BEGIN:VCALENDAR\nPRODID;X-RICAL-TZSOURCE=TZINFO:-\/\/com.denhaven2\/NONSGML ri_cal gem\/\/EN\nCALSCALE:GREGORIAN\nVERSION:2.0\nEND:VCALENDAR\n").first
    end
    
    it "should have a tz_source of 'TZ_INFO" do
      @it.tz_source.should == "TZINFO"
    end
    
    it "should export a product id with an X-RICAL-TZSOURCE parameter of TZINFO" do
      @it.export.should match(%r{\nPRODID;X-RICAL-TZSOURCE=TZINFO:-//com.denhaven2/NONSGML ri_cal gem//EN\n})
    end
  end
  
  context "an imported instance without a tzinfo source" do
    before(:each) do
      @it = RiCal.parse_string("BEGIN:VCALENDAR\nPRODID:-//Apple Inc.//iCal 3.0//EN\nEND:VCALENDAR\n").first
    end
    
    it "should have a tz_source of nil" do
      @it.tz_source.should be_nil
    end
    
    it "should export not export a product id with an X-RICAL-TZSOURCE parameter of TZINFO" do
      @it.export.should_not match(%r{X-RICAL-TZSOURCE=TZINFO:})
    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/calendar_spec.rb