Sha256: bafe7ffa818244aa8eccb08a88704755620a22b7434b03406fd60b8dfb4070a4

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

require 'helper'

require 'helper'

class TestCampaigns < Test::Unit::TestCase

  context "When using the foursquare API and working with campaigns" do
    setup do
      @client = foursquare_test_client
    end
    
    should "add a campaign" do
      stub_post("https://api.foursquare.com/v2/campaigns/add?oauth_token=#{@client.oauth_token}&specialId=4bd876f886ba62b58a6e88b3", "campaigns/campaign_created.json")
      campaign = @client.add_campaign(:specialId => '4bd876f886ba62b58a6e88b3')
      campaign.special.id == "4bd876f886ba62b58a6e88b3"
    end

    should "list all campaigns" do
      stub_get("https://api.foursquare.com/v2/campaigns/list?oauth_token=#{@client.oauth_token}&status=active", "campaigns/campaigns_list.json")
      campaigns = @client.list_campaigns(:status => 'active')
      campaigns.first.id.should == "4e0deba2922e6f94b1410b79"
    end

    should "list campaigns of specialId" do
      stub_get("https://api.foursquare.com/v2/campaigns/list?oauth_token=#{@client.oauth_token}&specialId=4e0debea922e6f94b1410bb7", "campaigns/campaigns_list.json")
      campaigns = @client.list_campaigns(:specialId => '4e0debea922e6f94b1410bb7')
      campaigns.first['specialId'].should == "4e0debea922e6f94b1410bb7"
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foursquare2-1.9.5 test/test_campaigns.rb
foursquare2-1.9.4 test/test_campaigns.rb