Sha256: f5c568db6de84d5d9efbe3bd0576ff73259a57efd893fd865dafed70890149e2

Contents?: true

Size: 841 Bytes

Versions: 5

Compression:

Stored size: 841 Bytes

Contents

require 'test/unit'
require 'shoulda'
require 'mocha'
require 'fakeweb'
require 'pp'

# FakeWeb.allow_net_connect = true
# FakeWeb.allow_net_connect = false

require File.dirname(__FILE__) + '/../lib/fgraph'

def stub_get(url, filename, status=nil)
  options = {:body => read_fixture(filename)}
  options.merge!({:status => status}) unless status.nil?
  FakeWeb.register_uri(:get, graph_url(url), options)
end

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

def stub_put(url, filename)
  FakeWeb.register_uri(:put, graph_url(url), :body => read_fixture(filename))
end

def read_fixture(filename)
  return "" if filename == ""
  File.read(File.dirname(__FILE__) + "/fixtures/" + filename)
end

def graph_url(url)
  url =~ /^http/ ? url : "http://graph.facebook.com#{url}"
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fgraph-0.7.0 test/test_helper.rb
fgraph-0.6.2 test/test_helper.rb
fgraph-0.6.1 test/test_helper.rb
fgraph-0.6.0 test/test_helper.rb
fgraph-0.5.1 test/test_helper.rb