couchrest 2.0.0.beta1 → 2.0.0.beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14f12656b8e131a2aaea47e2556e4a6baa80122f
4
- data.tar.gz: a2cc1b7c8d35eb35ffd0b9ef10083678c3c186f8
3
+ metadata.gz: 56c6ad538f2b4fce792fe1e86f397af9c9fd02e1
4
+ data.tar.gz: 5fc268898ee98554d7810dc0ce1bae37ee9953aa
5
5
  SHA512:
6
- metadata.gz: 7cada5e2ef0dc7d6f362bacc12a89c02c0d96494ee86dc2eebf443dc02a8967443e296b3759f797a1dffad5bc9d4c1efe0fdfd7c8ad01f8a3a413a0fe01aee8b
7
- data.tar.gz: 4dc2fee7d91c8927a008a91aa41ec561127ee681221489953627edec08f6bc1d120135e87d6f933dc6f8201aebadafc45df26a92aecf95a6ffda4e7188e1d158
6
+ metadata.gz: a04bacd2673fa3782fc91218dff8e54fd777b086a1aea409210b16756c0fd4904a045fc792f10101568df92f243bea717ead2719671ae3f1de9991d374718a11
7
+ data.tar.gz: 52fc7bb62a48eaff3f848eea5b13fe8c9d79be1a68c74603e55d24d3c7972354c8a9d390f2544eeb02576f622047386b9d96127779fdb662e2180b2a77fac447
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0.beta1
1
+ 2.0.0.beta2
@@ -110,6 +110,11 @@ module CouchRest
110
110
  def prepare_http_connection(opts)
111
111
  @http = HTTPClient.new(opts[:proxy] || self.class.proxy)
112
112
 
113
+ # Authentication
114
+ unless uri.user.to_s.empty?
115
+ http.set_auth(uri.to_s, uri.user, uri.password)
116
+ end
117
+
113
118
  # SSL Certificate option mapping
114
119
  if opts.include?(:verify_ssl)
115
120
  http.ssl_config.verify_mode = opts[:verify_ssl] ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
@@ -37,6 +37,7 @@ describe CouchRest::Connection do
37
37
  it "should have instantiated an HTTP connection" do
38
38
  conn = CouchRest::Connection.new(URI "http://localhost:5984")
39
39
  expect(conn.http).to be_a(HTTPClient)
40
+ expect(conn.http.www_auth.basic_auth.set?).to be_false
40
41
  end
41
42
 
42
43
  it "should use the proxy if defined in parameters" do
@@ -58,6 +59,11 @@ describe CouchRest::Connection do
58
59
  expect(conn.http.proxy.to_s).to eql('http://proxy2')
59
60
  CouchRest::Connection.proxy = nil
60
61
  end
62
+
63
+ it "should pass through authentication details" do
64
+ conn = CouchRest::Connection.new(URI "http://user:pass@mock")
65
+ expect(conn.http.www_auth.basic_auth.set?).to be_true
66
+ end
61
67
 
62
68
  describe "with SSL options" do
63
69
  it "should leave the default if nothing set" do
@@ -196,6 +202,13 @@ describe CouchRest::Connection do
196
202
  mock_conn.get("db/test", :quirks_mode => true)
197
203
  end
198
204
 
205
+ it "should forward user and password details" do
206
+ stub_request(:get, "http://user:pass@mock/db/test")
207
+ .to_return(:body => doc.to_json)
208
+ conn = CouchRest::Connection.new(URI "http://user:pass@mock")
209
+ conn.get("db/test")
210
+ end
211
+
199
212
  context 'when decode_json_objects is true' do
200
213
  class TestObject
201
214
  def self.json_create(args)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couchrest
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta1
4
+ version: 2.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - J. Chris Anderson
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-07-09 00:00:00.000000000 Z
15
+ date: 2015-07-10 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: httpclient