Sha256: 91b813f8f5a389a2b5b038f34b1de3cf164ef1059a588c8c4fc73a8dda9d694a
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
require 'rubygems' require 'test/unit' require 'shoulda' require 'fakeweb' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'madmimi' 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 madmimi_url(url, https = false) if https url =~ /^https/ ? url : "https://api.madmimi.com#{url}" else url =~ /^http/ ? url : "http://api.madmimi.com#{url}" end end def stub_get(url, options = {}) https = options.delete(:https) filename = options.delete(:filename) options = { :body => fixture_file(filename) } if filename FakeWeb.register_uri(:get, madmimi_url(url, https), options) end def stub_post(url, filename = nil, status = nil) https = options.delete(:https) filename = options.delete(:filename) options = { :body => fixture_file(filename) } if filename FakeWeb.register_uri(:post, madmimi_url(url, https), options) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
madmimi-1.0.14 | test/helper.rb |