Sha256: 936418f6527e0941a23cf8ecbd54095ba84971c918b86a21f5b01e574cd10712
Contents?: true
Size: 990 Bytes
Versions: 7
Compression:
Stored size: 990 Bytes
Contents
require 'test/unit' require 'pathname' require 'shoulda' require 'matchy' require 'mocha' require 'fakeweb' require 'redgreen' $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
Version data entries
7 entries across 7 versions & 2 rubygems