Sha256: 78768c9171f1d1df0b0e951d2bf2f24ef560b598afec987189c27f00885ceb51

Contents?: true

Size: 1.62 KB

Versions: 1

Compression:

Stored size: 1.62 KB

Contents

require 'helper'

class TestCalendar < Test::Unit::TestCase
  should 'be able to get current events' do
    calendar = LotusNotesCalendar::Calendar.new('https://harmony.mooresvilleschools.org/centraloffice.nsf/school+calendar')
    results = calendar.all
    assert results.count > 0
    # assert_equal '7th Gr. First Football Practice - 9-11am', results[0].text
    # assert_equal 'Monday, Aug  1', results[0].at.strftime('%A, %b %e')
  end

  should 'be able to get a single event' do
    calendar = LotusNotesCalendar::Calendar.new('https://harmony.mooresvilleschools.org/madison.nsf/school+calendar')
    result = calendar.find('5F217BE1172632A8852578D90050CFB8')
    assert_equal '5F217BE1172632A8852578D90050CFB8', result.id
    assert_equal 'Backe to School Night Grades 3 & 4 (6:00-7:30)', result.text
    assert_equal Date.new(2011, 8, 11), result.at
    assert_equal 'Thursday, Aug 11', result.at.strftime('%A, %b %e')
  end

  should 'be able to build url to get events by month' do
    calendar = LotusNotesCalendar::Calendar.new('https://harmony.mooresvilleschools.org/madison.nsf/school+calendar')
    options = { :start => '20120101', :end => '20120131' }
    assert_equal 'https://harmony.mooresvilleschools.org/madison.nsf/school+calendar?ReadViewEntries&PreFormat&KeyType=time&StartKey=20120101&UntilKey=20120131&Count=999', calendar.send(:build_url, options)
  end

  should 'be able to get events by month' do
    calendar = LotusNotesCalendar::Calendar.new('https://harmony.mooresvilleschools.org/madison.nsf/school+calendar')
    results = calendar.where(:start => '20120101', :end => '20120131')
    assert results.count > 0
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lotus_notes_calendar-0.0.2 test/test_calendar.rb