Sha256: 34ab691224f0cda0814cbe7504c56e9db8590ca449d26bb6077eb2d09239633a

Contents?: true

Size: 1.57 KB

Versions: 3

Compression:

Stored size: 1.57 KB

Contents

require 'helper'

class FlagsTest < Test::Unit::TestCase

  context "When using the Gowalla API and working with flags" do
    setup do
      @client = gowalla_test_client
    end

    should "retrieve a list of flags" do
      stub_get("http://pengwynn:0U812@api.gowalla.com/flags", "flags.json")
      flags = @client.list_flags
      flags.first.spot.name.should == 'Wild Gowallaby #1'
      flags.first.user.url.should == '/users/340897'
      flags.first[:type].should == 'invalid'
      flags.first.status.should == 'open'
    end

    should "retrieve information about a specific flag" do
      stub_get("http://pengwynn:0U812@api.gowalla.com/flags/1", "flag.json")
      flag = @client.flag(1)
      flag.spot.name.should == 'Wild Gowallaby #1'
      flag.user.url.should == '/users/340897'
      flag[:type].should == 'invalid'
      flag.status.should == 'open'
    end


    should "retrieve flags associated with that spot" do
      stub_get("http://pengwynn:0U812@api.gowalla.com/spots/1/flags", "flags.json")
      flags = @client.spot_flags(1)
      flags.first.spot.name.should == 'Wild Gowallaby #1'
      flags.first.user.url.should == '/users/340897'
      flags.first[:type].should == 'invalid'
      flags.first.status.should == 'open'
    end

    should "set a flag on a specific spot" do
      url = "http://pengwynn:0U812@api.gowalla.com/spots/1/flags/invalid"
      FakeWeb.register_uri(:post, url, :body => '{"result": "flag created"}')
      response = @client.flag_spot(1, 'invalid', 'my problem description')
      response.result.should == 'flag created'
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gowalla-0.4.2 test/flags_test.rb
gowalla-0.4.1 test/flags_test.rb
gowalla-0.4.0 test/flags_test.rb