Sha256: f76d6937b447571e2010dcf644450296795ca5dfd4091901b247f45007f82a80

Contents?: true

Size: 1.28 KB

Versions: 8

Compression:

Stored size: 1.28 KB

Contents

require 'rubygems'
require 'bundler'
begin
  Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
  $stderr.puts e.message
  $stderr.puts "Run `bundle install` to install missing gems"
  exit e.status_code
end
require 'test/unit'
require 'shoulda'
require 'matchy'
require 'fakeweb'

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'foursquare2'
require 'config'

FakeWeb.allow_net_connect = false

def foursquare_test_client
  Foursquare2::Client.new(:oauth_token => 'yeehaw')
end

def foursquare_url(url)
  url =~ /^http/ ? url : "http://api.foursquare.com/v2#{url}"
end

def fixture_file(filename)
  return '' if filename == ''
  file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
  File.read(file_path)
end

def stub_get(url, filename, options={})
  opts = {
    :body => fixture_file(filename),
    :content_type => 'application/json; charset=utf-8'
  }.merge(options)
  FakeWeb.register_uri(:get, foursquare_url(url), opts)
end

def stub_post(url, filename, options={})
  opts = {
    :body => fixture_file(filename),
    :content_type => 'application/json; charset=utf-8'
  }.merge(options)
  FakeWeb.register_uri(:post, foursquare_url(url), opts)
end

class Test::Unit::TestCase
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
foursquare2-1.1.2 test/helper.rb
foursquare2-1.1.1 test/helper.rb
foursquare2-1.1.0 test/helper.rb
foursquare2-1.0.0 test/helper.rb
foursquare2-0.9.9 test/helper.rb
foursquare2-0.9.8 test/helper.rb
foursquare2-0.9.6 test/helper.rb
foursquare2-0.9.5 test/helper.rb