Sha256: bd07f7599a477cfbeea3fb870d9854bde5df139a0e9a77d6af0f9d447b808640

Contents?: true

Size: 860 Bytes

Versions: 5

Compression:

Stored size: 860 Bytes

Contents

require 'rubygems'
require 'test/unit'
require 'shoulda'
require 'matchy'
require 'mocha'
require 'fakeweb'

FakeWeb.allow_net_connect = false

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'twitter'

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 stub_get(url, filename, status=nil)
  url = url =~ /^http/ ? url : "http://twitter.com:80#{url}"
  
  options = {:string => fixture_file(filename)}
  options.merge!({:status => status}) unless status.nil?
  
  FakeWeb.register_uri(:get, url, options)
end

def stub_post(url, filename)
  FakeWeb.register_uri(:post, "http://twitter.com:80#{url}", :string => fixture_file(filename))
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
jnunemaker-twitter-0.5.0 test/test_helper.rb
jnunemaker-twitter-0.5.1 test/test_helper.rb
jnunemaker-twitter-0.5.2 test/test_helper.rb
jnunemaker-twitter-0.5.3 test/test_helper.rb
rcarver-twitter-0.5.4 test/test_helper.rb