Sha256: 0e3c276ce5c62a1067bb3ba7c8f96db4a72df99ac00c4f783e686704fa895528
Contents?: true
Size: 1012 Bytes
Versions: 1
Compression:
Stored size: 1012 Bytes
Contents
require 'rubygems' require 'test/unit' require 'redgreen' $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'squall' require 'fakeweb' class Test::Unit::TestCase def setup FakeWeb.allow_net_connect = false FakeWeb.clean_registry Squall.config('user', 'stupidpass', 'http://example.com/onapp') end def uri_with_login "http://#{Squall.api_user}:#{Squall.api_password}@#{Squall.api_endpoint.host}#{Squall.api_endpoint.path}" end def stub_json_request(meth, uri, content = nil, code = 200) content = File.read(File.join(File.dirname(__FILE__), "fixtures/#{uri.gsub('/', '_')}.json")) if content.nil? fake_response = Net::HTTPOK.new('1.1', code, 'OK') fake_response['Content-Type'] = 'application/json' fake_response.instance_variable_set('@body', content) FakeWeb.register_uri(meth, "#{uri_with_login}/#{uri}.json", :content_type => 'application/json', :response => fake_response) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
squall-0.0.3 | test/helper.rb |