test/test_repo.rb in vpim-0.695 vs test/test_repo.rb in vpim-13.11.11
- old
+ new
@@ -1,9 +1,10 @@
+# -*- encoding : utf-8 -*-
#!/usr/bin/env ruby
require 'vpim/repo'
-require 'test/common'
+require File.expand_path('../common', __FILE__)
class TestRepo < Test::Unit::TestCase
Apple3 = Vpim::Repo::Apple3
Directory = Vpim::Repo::Directory
Uri = Vpim::Repo::Uri
@@ -48,11 +49,11 @@
assert_equal(@eventsz, repo.count)
_test_each(repo, 1)
end
- def test_uri
+ def test_uri_http
caldata = open('test/calendars/weather.calendar/Events/1205042405-0-0.ics').read
server = data_on_port(caldata, 9876)
begin
c = Uri::Calendar.new("http://localhost:9876")
@@ -65,9 +66,28 @@
_test_each(repo, 1)
ensure
server.kill
end
end
+
+ def test_uri_webcal
+ caldata = open('test/calendars/weather.calendar/Events/1205042405-0-0.ics').read
+
+ server = data_on_port(caldata, 9876)
+ begin
+ c = Uri::Calendar.new("webcal://localhost:9876")
+ assert_equal(caldata, c.encode)
+
+ repo = Uri.new("webcal://localhost:9876")
+
+ assert_equal(1, repo.count)
+
+ _test_each(repo, 1)
+ ensure
+ server.kill
+ end
+ end
+
def test_uri_invalid
assert_raises(ArgumentError) do
Uri.new("url")
end