Sha256: 6c5c7b89dd163fd3ca3a14e0972bed44cab1792dedc7f1eaf527681ec39fa8ae
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
require 'test/unit' require 'pathname' require 'rubygems' gem 'thoughtbot-shoulda', '>= 2.10.1' gem 'jnunemaker-matchy', '0.4.0' gem 'mocha', '0.9.4' gem 'fakeweb', '>= 1.2.5' require 'shoulda' require 'matchy' require 'mocha' require 'fakeweb' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'topsy' 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 topsy_url(url) url =~ /^http/ ? url : "http://otter.topsy.com#{url}" end def stub_get(url, filename, options={}) opts = {:body => fixture_file(filename)}.merge(options) headers = { 'x-ratelimit-remaining' => '9998', 'x-ratelimit-limit' => '10000', 'x-ratelimit-reset' => '1262707200' } FakeWeb.register_uri(:get, topsy_url(url), headers.merge(opts)) end def stub_post(url, filename) FakeWeb.register_uri(:post, topsy_url(url), :body => fixture_file(filename)) end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
topsy-0.2.1 | test/helper.rb |
topsy-0.3.0 | test/helper.rb |
topsy-0.2.0 | test/helper.rb |