require 'test/unit' require 'pathname' require 'shoulda' require 'matchy' require 'mocha' require 'fakeweb' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'octopussy' 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 github_url(url) url =~ /^http/ ? url : "http://github.com/api/v2/json#{url}" end def stub_request(method, url, filename, status=nil) options = {:body => ""} options.merge!({:body => fixture_file(filename)}) if filename options.merge!({:body => status.last}) if status options.merge!({:status => status}) if status FakeWeb.register_uri(method, github_url(url), options) end def stub_get(*args); stub_request(:get, *args) end def stub_post(*args); stub_request(:post, *args) end