$:.unshift File.join(File.dirname(__FILE__), "..", "lib") require 'upcoming' require 'test/unit' # Incomplete tests at the moment, sorry. It would take ages to run a full suite # anyway and we can't test the add methods because it will fill up upcoming with # dud records. class UpcomingTest < Test::Unit::TestCase include Upcoming def setup Upcoming.authenticate_with_frob('597608edc3', '4d448557fb951dc4752dea2c4d8377075c07d858') @test_event = Event.get_info 44343 @test_metro = @test_event.metro end def test_category_get_list cats = Category.get_list assert(cats.size > 0) assert_kind_of(Category, cats.first) end def test_event_get_info assert_kind_of(Event, @test_event) assert_equal('Oconomowoc Memorial Tree Lighting', @test_event.name) end def test_event_search results = Event.search 'london' assert(results.size > 0) assert_kind_of(Event, results.first) end def test_link assert_kind_of(Metro, @test_event.metro) end def test_event_watchlist assert_kind_of(Array, @test_event.watchlist) end def test_metro_get_info metro = Metro.get_info @test_metro.id assert_kind_of(Metro, metro) end def test_metro_get_list list = Metro.get_list 76 assert_kind_of(Array, list) end end