test/test_venue.rb in firstfm-0.7.0 vs test/test_venue.rb in firstfm-0.8.0
- old
+ new
@@ -1,71 +1,50 @@
require 'helper'
-
+
class TestVenue < Test::Unit::TestCase
-
+
def test_should_search_venues
- FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/venues.xml"))
+ FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/venues.json"))
venues = Firstfm::Venue.search("arena")
assert_equal 2, venues.size
venue = venues.first
assert_equal "Arena", venue.name
assert_equal "Baumgasse 80", venue.location.street
venue = venues.last
- assert_equal "8781374", venue.id
- assert_equal "41.056222", venue.location.lat
+ assert_equal "10319137", venue.id
+ assert_equal "-23.515061", venue.location.lat
end
-
- def test_should_search_venues_with_one_venue_as_result
- FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/venue.xml"))
- venues = Firstfm::Venue.search("arena")
- assert_equal 1, venues.size
- venue = venues.first
- assert_equal "Arena", venue.name
- assert_equal "8778545", venue.id
- assert_equal "Baumgasse 80", venue.location.street
- end
-
+
def test_should_get_events
- FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/events.xml"))
+ FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/events.json"))
events = Firstfm::Venue.get_events(8908030)
assert_equal 2, events.size
-
+
event = events.first
- assert_equal "U.S. Girls", event.title
- assert_equal "1313175", event.id
+ assert_equal "Sun Ra Arkestra", event.title
+ assert_equal "4167492", event.id
assert_equal "Cafe OTO", event.venue.name
-
+
event = events.last
- assert_equal "Shogun Kunitoki", event.title
- assert_equal "1372916", event.id
+ assert_equal "Alessandro Cortini", event.title
+ assert_equal "4175250", event.id
assert_equal "Cafe OTO", event.venue.name
end
-
- def test_should_get_events_with_one_event_as_result
- FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/event.xml"))
- events = Firstfm::Venue.get_events(8908030)
- assert_equal 1, events.size
-
- event = events.first
- assert_equal "U.S. Girls", event.title
- assert_equal "1313175", event.id
- assert_equal "Cafe OTO", event.venue.name
- end
-
+
def test_should_get_events_from_single_venue
- FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/venue.xml"))
+ FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/venues.json"))
venues = Firstfm::Venue.search("arena")
venue = venues.first
venue.id = 8908030
-
- FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/event.xml"))
-
+
+ FakeWeb.register_uri(:get, %r|http://ws.audioscrobbler.com/|, :body => File.read(File.dirname(__FILE__) + "/fixtures/events.json"))
+
events = venue.get_events
- assert_equal 1, events.size
-
+ assert_equal 2, events.size
+
event = events.first
- assert_equal "U.S. Girls", event.title
- assert_equal "1313175", event.id
+ assert_equal "Sun Ra Arkestra", event.title
+ assert_equal "4167492", event.id
assert_equal "Cafe OTO", event.venue.name
end
-
+
end
\ No newline at end of file