Sha256: 7478c765612cf394a38312493fd5e7be1e59a3089db03b7785b17862425b17cf
Contents?: true
Size: 1.24 KB
Versions: 8
Compression:
Stored size: 1.24 KB
Contents
require 'spec_helper' describe Infoblox::Connection do ["localhost", "127.0.0.1", "http://localhost:3000", "https://localhost", "http://localhost:3000/"].each do |host| it "should build URL #{host} without failure" do conn_params = { :username => "billy", :password => "boi", :host => host } uri = "/wapi/v1.0/record:host" ic = Infoblox::Connection.new(conn_params) ic.adapter = :test ic.adapter_block = stub_get(uri) # execute the request. There should be no "URI::BadURIError: both URI are relative" error ic.get(uri) end end it "should raise Infobloxon invalid response" do host = 'localhost' conn_params = { :username => "billy", :password => "boi", :host => host } uri = "/wapi/v1.0/record:host" ic = Infoblox::Connection.new(conn_params) ic.adapter = :test ic.adapter_block = stub_get(uri, 404) # execute the request. There should be no "URI::BadURIError: both URI are relative" error expect { ic.get(uri) }.to raise_error(Infoblox::Error) end def stub_get(uri, status=200) Proc.new do |stub| stub.get(uri) { [ status, {}, 'Yay!'] } end end end
Version data entries
8 entries across 8 versions & 1 rubygems