Skip to content
Browse files

Added venue.get* with stubbed acceptance tests

  • Loading branch information...
1 parent 6590115 commit 554761d2e23a3507293f0c82aed262ba5bf10e0d @gingerhendrix committed Apr 22, 2009
View
4 TODO
@@ -17,7 +17,7 @@
Implementation +done
Track.getTopFans +done
Track.getTopTags +done
- User.get*
+ User.get* +done
Venue.get*
Geo.get*
Post Requests
@@ -31,4 +31,4 @@
{album|artist|tag|track|venue}.search
Add README
Simple website
- Release
+ Release
View
2 lib/scrobbler2.rb
@@ -18,5 +18,5 @@ module Scrobbler2
require 'scrobbler2/tag.rb'
require 'scrobbler2/track.rb'
require 'scrobbler2/user.rb'
-
+require 'scrobbler2/venue.rb'
View
12 lib/scrobbler2/venue.rb
@@ -0,0 +1,12 @@
+module Scrobbler2
+ class Venue < Base
+
+ def initialize(id)
+ @query = {:venue => id}
+ end
+
+ get_resource :events, :root => "events"
+ get_resource :past_events, :root => "events"
+
+ end
+end
View
14 test/acceptance/venue/events_test.rb
@@ -0,0 +1,14 @@
+require File.dirname(__FILE__) + '/../test_helper.rb'
+
+describe "events for venue 8929268 (The Menagerie)" do
+
+ before(:all) do #We only want to hit the webservice once.
+ @venue = Scrobbler2::Venue.new "8929268"
+ @events = @venue.events
+ end
+
+ it "should be hash" do
+ @events.should be_kind_of Hash
+ end
+
+end
View
14 test/acceptance/venue/past_events_test.rb
@@ -0,0 +1,14 @@
+require File.dirname(__FILE__) + '/../test_helper.rb'
+
+describe "past_events for venue 8929268 (The Menagerie)" do
+
+ before(:all) do #We only want to hit the webservice once.
+ @venue = Scrobbler2::Venue.new "8929268"
+ @past_events = @venue.past_events
+ end
+
+ it "should be hash" do
+ @past_events.should be_kind_of Hash
+ end
+
+end
View
29 test/unit/venue_spec.rb
@@ -0,0 +1,29 @@
+require File.dirname(__FILE__) + "/spec_helper.rb"
+
+describe "Venue" do
+ before(:each) do
+ @venue = Scrobbler2::Venue.new "8929268"
+ @venue.class.stub!(:get).and_return Hash.new
+ end
+
+ it "should have a default query {:venue => id}" do
+ @venue.instance_variable_get(:@query).should == {:venue => "8929268"}
+ end
+
+
+
+ it "events should call get with 'venue.getevents'" do
+ @venue.class.should_receive(:get).with('venue.getevents', anything(), anything()).and_return Hash.new
+ @venue.events
+ end
+
+
+
+ it "past_events should call get with 'venue.getpastevents'" do
+ @venue.class.should_receive(:get).with('venue.getpastevents', anything(), anything()).and_return Hash.new
+ @venue.past_events
+ end
+
+
+
+end

0 comments on commit 554761d

Please sign in to comment.
Something went wrong with that request. Please try again.