Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added geo.get* with stubbed acceptance tests. Some methods definitely…

… broken
  • Loading branch information...
commit ec6494822505efe51741d3d74ffee3a885f90320 1 parent 554761d
@gingerhendrix authored
View
1  lib/scrobbler2.rb
@@ -12,6 +12,7 @@ module Scrobbler2
require 'scrobbler2/album.rb'
require 'scrobbler2/artist.rb'
require 'scrobbler2/event.rb'
+require 'scrobbler2/geo.rb'
require 'scrobbler2/group.rb'
require 'scrobbler2/library.rb'
require 'scrobbler2/playlist.rb'
View
15 lib/scrobbler2/geo.rb
@@ -0,0 +1,15 @@
+module Scrobbler2
+ class Geo < Base
+
+ def initialize()
+ @query = {}#TODO eg. {:artist => artist, :track => track}
+ end
+
+ get_resource :events, :root => "events"
+
+ get_resource :top_artists, :root => "topartists"
+
+ get_resource :top_tracks, :root => "toptracks"
+
+ end
+end
View
14 test/acceptance/geo/events_test.rb
@@ -0,0 +1,14 @@
+require File.dirname(__FILE__) + '/../test_helper.rb'
+
+describe "events for geo location=belfast" do
+
+ before(:all) do #We only want to hit the webservice once.
+ @geo = Scrobbler2::Geo.new
+ @events = @geo.events :location => "belfast"
+ end
+
+ it "should be hash" do
+ @events.should be_kind_of Hash
+ end
+
+end
View
16 test/acceptance/geo/top_artists_test.rb
@@ -0,0 +1,16 @@
+require File.dirname(__FILE__) + '/../test_helper.rb'
+
+describe "top_artists for geo country=ireland" do
+
+ before(:all) do #We only want to hit the webservice once.
+ @geo = Scrobbler2::Geo.new
+ @top_artists = @geo.top_artists :country => "ireland"
+ end
+
+ it "should be hash" do
+ pending "broken" do
+ @top_artists.should be_kind_of Hash
+ end
+ end
+
+end
View
16 test/acceptance/geo/top_tracks_test.rb
@@ -0,0 +1,16 @@
+require File.dirname(__FILE__) + '/../test_helper.rb'
+
+describe "top_tracks for geo country=ireland" do
+
+ before(:all) do #We only want to hit the webservice once.
+ @geo = Scrobbler2::Geo.new
+ @top_tracks = @geo.top_tracks :country => "ireland"
+ end
+
+ it "should be hash" do
+ pending "broken" do
+ @top_tracks.should be_kind_of Hash
+ end
+ end
+
+end
View
36 test/unit/geo_spec.rb
@@ -0,0 +1,36 @@
+require File.dirname(__FILE__) + "/spec_helper.rb"
+
+describe "Geo" do
+ before(:each) do
+ @geo = Scrobbler2::Geo.new
+ @geo.class.stub!(:get).and_return Hash.new
+ end
+
+ it "should have no default query" do
+ @geo.instance_variable_get(:@query).should == {}
+ end
+
+
+
+ it "events should call get with 'geo.getevents'" do
+ @geo.class.should_receive(:get).with('geo.getevents', anything(), anything()).and_return Hash.new
+ @geo.events
+ end
+
+
+
+ it "top_artists should call get with 'geo.gettop_artists'" do
+ @geo.class.should_receive(:get).with('geo.gettopartists', anything(), anything()).and_return Hash.new
+ @geo.top_artists
+ end
+
+
+
+ it "top_tracks should call get with 'geo.gettop_tracks'" do
+ @geo.class.should_receive(:get).with('geo.gettoptracks', anything(), anything()).and_return Hash.new
+ @geo.top_tracks
+ end
+
+
+
+end
Please sign in to comment.
Something went wrong with that request. Please try again.