Sha256: c8161458b2138006cbf7ea3ab6d6a600f242b58dd55e6606a7a650532bb489b0

Contents?: true

Size: 1.61 KB

Versions: 13

Compression:

Stored size: 1.61 KB

Contents

require 'helper'

class TestCheckins < Test::Unit::TestCase

  context "When using the foursquare API and working with checkins" do
    setup do
      @client = foursquare_test_client
    end

    should "fetch info for a single checkin" do
      stub_get("https://api.foursquare.com/v2/checkins/4d572bcc9e508cfab975189b?oauth_token=#{@client.oauth_token}", "checkins/checkin.json")
      checkin = @client.checkin('4d572bcc9e508cfab975189b')
      checkin.venue.name.should == 'Bridgestone Arena'
      checkin.user.firstName.should == 'Matt'
    end

    should "fetch recent checkins from friends"do
      stub_get("https://api.foursquare.com/v2/checkins/recent?oauth_token=#{@client.oauth_token}&limit=2", "checkins/friend_checkins.json")
      checkins = @client.recent_checkins(:limit => 2)
      checkins.count.should == 2
      checkins.first.venue.name.should == 'Buffalo Billiards'
      checkins.last.user.firstName.should == 'David'
    end

    should "add a post to an existing checkin" do
      stub_post("https://api.foursquare.com/v2/checkins/5041335de4b08d95c1591453/addpost?oauth_token=#{@client.oauth_token}&text=Test", "checkins/post_created.json")
      post = @client.add_checkin_post('5041335de4b08d95c1591453', :text => "Test")
      post.text.should == "Test"
    end

    should "add a reply to an existing checkin" do
      stub_post("https://api.foursquare.com/v2/checkins/5041eda9e4b0133020c2292c/reply?oauth_token=#{@client.oauth_token}&text=Test", "checkins/checkin_reply.json")
      reply = @client.add_checkin_reply('5041eda9e4b0133020c2292c', :text => "Test")
      reply.text.should == "Test"
    end
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
foursquare2-2.0.2 test/test_checkins.rb
foursquare2-2.0.1 test/test_checkins.rb
foursquare2-2.0.0 test/test_checkins.rb
foursquare2-1.9.8 test/test_checkins.rb
foursquare2-1.9.7 test/test_checkins.rb
foursquare2-1.9.6 test/test_checkins.rb
foursquare2-1.9.5 test/test_checkins.rb
foursquare2-1.9.4 test/test_checkins.rb
foursquare2-1.9.3 test/test_checkins.rb
foursquare2-1.9.2 test/test_checkins.rb
foursquare2-1.9.1 test/test_checkins.rb
foursquare2-1.9.0 test/test_checkins.rb
foursquare2-1.8.2 test/test_checkins.rb