Sha256: f49cde0981bc924ce9ac057f09740b42f502293df0858b63293cf90ea562ded6
Contents?: true
Size: 1.66 KB
Versions: 1
Compression:
Stored size: 1.66 KB
Contents
require 'rubygems' require 'test/unit' gem 'shoulda', ">= 2.11.1" gem 'fakeweb', ">= 1.2.6" gem 'crack', ">= 0.1.4" gem 'mocha', ">= 0.9.8" require 'shoulda' require 'fakeweb' require 'Crack' require 'mocha' require 'ruby-prof' FakeWeb.allow_net_connect = false $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'vimeo' 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 vimeo_base_url(url = "/") "http://vimeo.com#{url}" end def vimeo_url(url = "") vimeo_base_url("/api/v2#{url}") end def advanced_vimeo_url(url = "") vimeo_base_url("/api/rest/v2#{url}") end def stub_get(url, filename, status=nil) # FIXME: We have to specify content type, otherwise HTTParty will not parse the # body correctly. Is there any way we can get around this? Or is this a limitation # of using FakeWeb? options = { :body => fixture_file(filename), :content_type => 'application/json' } options.merge!({:status => status}) unless status.nil? FakeWeb.register_uri(:get, vimeo_url(url), options) end def stub_post(url, filename) FakeWeb.register_uri(:post, advanced_vimeo_url, :body => fixture_file(filename), :content_type => 'application/json') end def stub_custom_get(url, filename) FakeWeb.register_uri(:get, vimeo_base_url(url), :body => fixture_file(filename), :content_type => 'application/json') end def stub_custom_post(url, filename) FakeWeb.register_uri(:post, vimeo_base_url(url), :body => fixture_file(filename), :content_type => 'application/json') end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vimeo-1.2.0 | test/test_helper.rb |