diff options
Diffstat (limited to 'test/unit')
| -rw-r--r-- | test/unit/event_test.rb | 77 | ||||
| -rw-r--r-- | test/unit/helpers/events_helper_test.rb | 4 |
2 files changed, 0 insertions, 81 deletions
diff --git a/test/unit/event_test.rb b/test/unit/event_test.rb deleted file mode 100644 index c8ee335..0000000 --- a/test/unit/event_test.rb +++ /dev/null | |||
| @@ -1,77 +0,0 @@ | |||
| 1 | require 'test_helper' | ||
| 2 | |||
| 3 | class EventTest < ActiveSupport::TestCase | ||
| 4 | |||
| 5 | def setup | ||
| 6 | @cal = <<-EOT | ||
| 7 | BEGIN:VCALENDAR | ||
| 8 | VERSION:2.0 | ||
| 9 | PRODID:-//Ensemble Independent//vPim 0.658//EN | ||
| 10 | CALSCALE:Gregorian | ||
| 11 | BEGIN:VEVENT | ||
| 12 | SUMMARY:Chaosradio | ||
| 13 | DTSTART:20080505T220000 | ||
| 14 | LOCATION:FM 102,60 MHz | ||
| 15 | URL:http://www.fritz.de/frequenzen | ||
| 16 | RRULE:FREQ=MONTHLY;BYMONTH=1,2,3,4,5,6,7,8,9,10,11;BYDAY=-1WE;UNTIL=20091105T220000 | ||
| 17 | CREATED:20021020T220000 | ||
| 18 | DURATION:PT3H | ||
| 19 | END:VEVENT | ||
| 20 | END:VCALENDAR | ||
| 21 | EOT | ||
| 22 | |||
| 23 | @first_child = Node.find(2) | ||
| 24 | end | ||
| 25 | |||
| 26 | test 'saving serialized event' do | ||
| 27 | assert event = Event.create!( :serialized_event => @cal ) | ||
| 28 | end | ||
| 29 | |||
| 30 | test 'parsing calendar data' do | ||
| 31 | event = Event.create!( :serialized_event => @cal ) | ||
| 32 | assert calendar = ChaosCalendar.new | ||
| 33 | assert calendar.push( event.serialized_event, @first_child.id ) | ||
| 34 | assert_equal 1, calendar.calendar.length | ||
| 35 | assert_equal "Chaosradio", calendar.calendar.to_a.first.first.summary | ||
| 36 | end | ||
| 37 | |||
| 38 | test 'checking occurrences logic' do | ||
| 39 | event = Event.create!( :serialized_event => @cal ) | ||
| 40 | calendar = ChaosCalendar.new | ||
| 41 | calendar.push( event.serialized_event, @first_child.id ) | ||
| 42 | |||
| 43 | all_occurrences = calendar.occurrences( "2009-03-22".to_datetime, "2010-01-10".to_datetime ) | ||
| 44 | assert_equal 8, all_occurrences.length | ||
| 45 | |||
| 46 | assert_equal "2009-03-25".to_date, all_occurrences.first.dtstart.to_date | ||
| 47 | assert_equal "2009-10-28".to_date, all_occurrences.last.dtstart.to_date | ||
| 48 | end | ||
| 49 | |||
| 50 | end | ||
| 51 | |||
| 52 | __END__ | ||
| 53 | |||
| 54 | opt_days = 7 | ||
| 55 | |||
| 56 | calendar = ChaosCalendar.new | ||
| 57 | |||
| 58 | |||
| 59 | calendar.push( cal, 25 ) | ||
| 60 | t0 = Time.today | ||
| 61 | t1 = t0 + opt_days.days | ||
| 62 | |||
| 63 | all_occurrences = calendar.occurrences( t0, t1 ) | ||
| 64 | |||
| 65 | all_occurrences.each do |o| | ||
| 66 | e = o.event | ||
| 67 | puts o.dtstart | ||
| 68 | puts "#{e.summary}:" | ||
| 69 | |||
| 70 | puts " description=#{e.description}" if e.description | ||
| 71 | puts " comment=#{e.comments.first}" if e.comments | ||
| 72 | puts " location=#{e.location}" if e.location | ||
| 73 | puts " status=#{e.status}" if e.status | ||
| 74 | puts " dtstart=#{e.dtstart}" if e.dtstart | ||
| 75 | puts " duration=#{Vpim::Duration.new(e.duration).to_s}" if e.duration | ||
| 76 | end | ||
| 77 | |||
diff --git a/test/unit/helpers/events_helper_test.rb b/test/unit/helpers/events_helper_test.rb deleted file mode 100644 index 2e7567e..0000000 --- a/test/unit/helpers/events_helper_test.rb +++ /dev/null | |||
| @@ -1,4 +0,0 @@ | |||
| 1 | require 'test_helper' | ||
| 2 | |||
| 3 | class EventsHelperTest < ActionView::TestCase | ||
| 4 | end | ||
