Sha256: 7ef840bf7102c9ffb0d1743866970ab3b521597606a6f21cb57e34b0b8ab4d87
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
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 'octokit' 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) if url =~ /^http/ url elsif @client && @client.authenticated? "https://pengwynn%2Ftoken:OU812@github.com/api/v#{Octokit.version}/#{Octokit.format}/#{url}" else "https://github.com/api/v#{Octokit.version}/#{Octokit.format}/#{url}" end 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_delete(*args) stub_request(:delete, *args) end def stub_get(*args) stub_request(:get, *args) end def stub_post(*args) stub_request(:post, *args) end def stub_put(*args) stub_request(:put, *args) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
octokit-0.4.1 | test/helper.rb |
octokit-0.4.0 | test/helper.rb |