Sha256: 8119034a5469270d44261a796c33e7d40c3ec02894a4a0e6f41085aa14fca65e

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

require "base_unit"

class TestCalendar1 < Test::Unit::TestCase
  include GoogleCalendar
  include CalendarTest

  def test_create_from_feed
    assert_instance_of(GoogleCalendar::Calendar, @cal)
  end

  def test_create_from_calendar_list
    list = GoogleCalendar::Calendar.calendars(@srv)
    assert_instance_of(Hash, list)
    list.each do |feed, cal| 
      assert_equal(cal.feed, feed)
      assert_instance_of(GoogleCalendar::Calendar, cal)
    end
  end

  #
  # THESE ACTUAL VALUES COULD BE DIFFERENT.
  #
  def test_calendar_attributes
    assert_equal("Calendar Test", @cal.title)
    assert_equal("Calendar Test Description", @cal.subtitle)
    assert_not_nil(@cal.name)
    assert_not_nil(@cal.updated)
    assert_equal(MAIL, @cal.email)
    assert_equal("Europe/London", @cal.timezone)
    assert_equal("Calendar Test Location", @cal.where)
  end

  def test_calendar_events_list
    st = Time.now
    en = st + 3600
    @srv.insert(FEED, event("t1", "e1", st, en))
    @srv.insert(FEED, event("t2", "e2", en, en + 3600))
    @cal.events.each do |event|
      assert_instance_of(GoogleCalendar::Event, event)
    end
  end

  def test_create_event
    ev = @cal.create_event
    assert_instance_of(GoogleCalendar::Event, ev)
  end

  def setup
    @srv = get_service
    @cal = GoogleCalendar::Calendar.new(@srv, FEED)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gcalapi-0.1.0 test/01_calendar_test.rb
gcalapi-0.1.1 test/01_calendar_test.rb
gcalapi-0.1.2 test/01_calendar_test.rb