Sha256: 4a4a6b01d101b52529bf80bc04b330abf8f1c60695ea06bbcb5dc74fc96e68a6
Contents?: true
Size: 1.15 KB
Versions: 9
Compression:
Stored size: 1.15 KB
Contents
require "test/unit" require "pathname" require "shoulda" require "matchy" require "mocha" require "fakeweb" require "redgreen" FakeWeb.allow_net_connect = false dir = (Pathname(__FILE__).dirname + "../lib").expand_path require dir + "twitter" class Test::Unit::TestCase end def sample_image(filename) File.expand_path(File.dirname(__FILE__) + "/fixtures/" + filename) end def fixture_file(filename) return "" if filename == "" file_path = File.expand_path(File.dirname(__FILE__) + "/fixtures/" + filename) File.read(file_path) end def twitter_url(url) url =~ /^http/ ? url : "http://api.twitter.com:80#{url}" end def stub_get(url, filename, status=nil) options = {:body => fixture_file(filename)} options.merge!({:status => status}) unless status.nil? FakeWeb.register_uri(:get, twitter_url(url), options) end def stub_post(url, filename) FakeWeb.register_uri(:post, twitter_url(url), :body => fixture_file(filename)) end def stub_put(url, filename) FakeWeb.register_uri(:put, twitter_url(url), :body => fixture_file(filename)) end def stub_delete(url, filename) FakeWeb.register_uri(:delete, twitter_url(url), :body => fixture_file(filename)) end
Version data entries
9 entries across 9 versions & 5 rubygems