Sha256: d44c5908bd5d9f5db33d087e57c17f250c43b18bd42d86317c1d61436d004fa1
Contents?: true
Size: 986 Bytes
Versions: 2
Compression:
Stored size: 986 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) content = File.read(File.join(File.dirname(__FILE__), "fixtures/#{uri}.json")) if content.nil? fake_response = Net::HTTPOK.new('1.1', '200', '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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
squall-0.0.2 | test/helper.rb |
squall-0.0.1 | test/helper.rb |