Sha256: 4084f1d4141e2ae315a51fcafeb01097fb54931baee1e25fc9452f456073cc11
Contents?: true
Size: 1.59 KB
Versions: 20
Compression:
Stored size: 1.59 KB
Contents
require 'spec_helper' describe ActiveRestClient::ConnectionManager do before(:each) do ActiveRestClient::ConnectionManager.reset! end it "should have a get_connection method" do expect(ActiveRestClient::ConnectionManager).to respond_to("get_connection") end it "should return a connection for a given base url" do connection = ActiveRestClient::ConnectionManager.get_connection("http://www.example.com") expect(connection).to be_kind_of(ActiveRestClient::Connection) end it "should return the same connection for each base url when re-requested" do connection = ActiveRestClient::ConnectionManager.get_connection("http://www.example.com") expect(ActiveRestClient::ConnectionManager.get_connection("http://www.example.com")).to eq(connection) end it "should return different connections for each base url when requested" do base_url = "http://www.example.com" other_base_url = "http://other.example.com" expect(ActiveRestClient::ConnectionManager.get_connection(base_url).base_url).to eq(base_url) expect(ActiveRestClient::ConnectionManager.get_connection(other_base_url).base_url).to eq(other_base_url) expect(Thread.current[:_connections].size).to eq(2) end it "should find a connection if you pass in URLs containing an existing connection's base_url" do base_url = "http://www.example.com" connection = ActiveRestClient::ConnectionManager.get_connection(base_url) found_connection = ActiveRestClient::ConnectionManager.find_connection_for_url("#{base_url}:8080/people/test") expect(found_connection).to eq(connection) end end
Version data entries
20 entries across 20 versions & 1 rubygems