Sha256: 414d001ac3b41e17469adc3c7752fcadb2f7c3c74217778a29f9747a6486312c

Contents?: true

Size: 881 Bytes

Versions: 3

Compression:

Stored size: 881 Bytes

Contents

require 'test/unit'
require 'pathname'
require 'rubygems'


require 'shoulda'
require 'matchy'
require 'fakeweb'

begin require 'redgreen'; rescue LoadError; end

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

FakeWeb.allow_net_connect = false

class Test::Unit::TestCase
end

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

def gowalla_url(url)
  url =~ /^http/ ? url : "http://api.gowalla.com#{url}"
end

def stub_get(url, filename, options={})
  opts = {:body => fixture_file(filename)}.merge(options)
  
  FakeWeb.register_uri(:get, gowalla_url(url), opts)
end

def stub_post(url, filename)
  FakeWeb.register_uri(:post, gowalla_url(url), :body => fixture_file(filename))
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gowalla-0.3.0 test/helper.rb
gowalla-0.2.1 test/helper.rb
gowalla-0.2.0 test/helper.rb