Sha256: e4913ed0854b27ee711718a600bab825736f77bbc48fae6c026495d429cb857f

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

require 'helper'

class TestPages < Test::Unit::TestCase

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

    should "fetch info for a single page" do
      stub_get("https://api.foursquare.com/v2/pages/14046309?oauth_token=#{@client.oauth_token}", "page.json")
      page = @client.page('14046309')
      page.firstName.should == "Nashville Geeks"
      page.type.should == "page"
    end

    should "fetch results when searching for a page" do
      stub_get("https://api.foursquare.com/v2/pages/search?name=NashvilleGeeks&oauth_token=#{@client.oauth_token}", "search_pages.json")
      pages = @client.search_pages(:name => 'NashvilleGeeks')
      pages.results.first.firstName.should == "Nashville Geeks"
    end

    should "fetch venues for a given page" do
      stub_get("https://api.foursquare.com/v2/pages/1070527/venues?limit=2&oauth_token=#{@client.oauth_token}", "page_venues.json")
      venues = @client.page_venues(1070527, :limit => 2)
      venues['count'].should == 11051
      venues.items.length.should == 2
      venues.items.first.name.should == "Starbucks"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foursquare2-1.8.1 test/test_pages.rb
foursquare2-1.8.0 test/test_pages.rb
foursquare2-1.7.0 test/test_pages.rb
foursquare2-1.6.0 test/test_pages.rb