Sha256: c279e7e8d4ed3c6f170462409c9cc1dffc620d94aba9289481047ad2c3d0b5e2

Contents?: true

Size: 858 Bytes

Versions: 15

Compression:

Stored size: 858 Bytes

Contents

require 'test/unit'
require 'shoulda'
require 'matchy'
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

15 entries across 15 versions & 1 rubygems

Version Path
fgraph-0.5.0 test/test_helper.rb
fgraph-0.4.0 test/test_helper.rb
fgraph-0.3.4 test/test_helper.rb
fgraph-0.3.3 test/test_helper.rb
fgraph-0.3.2 test/test_helper.rb
fgraph-0.3.1 test/test_helper.rb
fgraph-0.3.0 test/test_helper.rb
fgraph-0.2.1 test/test_helper.rb
fgraph-0.2.0 test/test_helper.rb
fgraph-0.1.5 test/test_helper.rb
fgraph-0.1.4 test/test_helper.rb
fgraph-0.1.3 test/test_helper.rb
fgraph-0.1.2 test/test_helper.rb
fgraph-0.1.1 test/test_helper.rb
fgraph-0.1.0 test/test_helper.rb