httpi 4.0.3 → 4.0.4

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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/lib/httpi/version.rb +1 -1
  4. metadata +2 -50
  5. data/.devcontainer/devcontainer.json +0 -22
  6. data/.github/workflows/development.yml +0 -49
  7. data/.gitignore +0 -11
  8. data/.rspec +0 -1
  9. data/Gemfile +0 -22
  10. data/Rakefile +0 -18
  11. data/httpi.gemspec +0 -40
  12. data/spec/fixtures/attachment.gif +0 -0
  13. data/spec/fixtures/client_cert.pem +0 -20
  14. data/spec/fixtures/client_key.pem +0 -27
  15. data/spec/fixtures/xml.gz +0 -0
  16. data/spec/fixtures/xml.xml +0 -10
  17. data/spec/fixtures/xml_dime.dime +0 -0
  18. data/spec/fixtures/xml_dime.xml +0 -1
  19. data/spec/httpi/adapter/base_spec.rb +0 -23
  20. data/spec/httpi/adapter/curb_spec.rb +0 -351
  21. data/spec/httpi/adapter/em_http_spec.rb +0 -180
  22. data/spec/httpi/adapter/excon_spec.rb +0 -34
  23. data/spec/httpi/adapter/http_spec.rb +0 -28
  24. data/spec/httpi/adapter/httpclient_spec.rb +0 -238
  25. data/spec/httpi/adapter/net_http_persistent_spec.rb +0 -46
  26. data/spec/httpi/adapter/net_http_spec.rb +0 -54
  27. data/spec/httpi/adapter/rack_spec.rb +0 -109
  28. data/spec/httpi/adapter_spec.rb +0 -68
  29. data/spec/httpi/auth/config_spec.rb +0 -163
  30. data/spec/httpi/auth/ssl_spec.rb +0 -216
  31. data/spec/httpi/cookie_spec.rb +0 -36
  32. data/spec/httpi/cookie_store_spec.rb +0 -26
  33. data/spec/httpi/error_spec.rb +0 -43
  34. data/spec/httpi/httpi_spec.rb +0 -382
  35. data/spec/httpi/request_spec.rb +0 -290
  36. data/spec/httpi/response_spec.rb +0 -146
  37. data/spec/integration/curb_spec.rb +0 -140
  38. data/spec/integration/em_http_spec.rb +0 -108
  39. data/spec/integration/excon_spec.rb +0 -174
  40. data/spec/integration/fixtures/ca_all.pem +0 -19
  41. data/spec/integration/fixtures/server.cert +0 -19
  42. data/spec/integration/fixtures/server.key +0 -27
  43. data/spec/integration/http_spec.rb +0 -156
  44. data/spec/integration/httpclient_spec.rb +0 -137
  45. data/spec/integration/net_http_persistent_spec.rb +0 -171
  46. data/spec/integration/net_http_spec.rb +0 -282
  47. data/spec/integration/support/application.rb +0 -88
  48. data/spec/integration/support/server.rb +0 -83
  49. data/spec/spec_helper.rb +0 -23
  50. data/spec/support/error_helper.rb +0 -26
  51. data/spec/support/fixture.rb +0 -27
  52. data/spec/support/matchers.rb +0 -19
@@ -1,238 +0,0 @@
1
- require "spec_helper"
2
- require "httpi/adapter/httpclient"
3
- require "httpi/request"
4
- require "integration/support/server"
5
-
6
- HTTPI::Adapter.load_adapter(:httpclient)
7
-
8
- describe HTTPI::Adapter::HTTPClient do
9
- let(:adapter) { HTTPI::Adapter::HTTPClient.new(request) }
10
- let(:httpclient) { HTTPClient.any_instance }
11
- let(:ssl_config) { HTTPClient::SSLConfig.any_instance }
12
- let(:request) { HTTPI::Request.new("http://example.com") }
13
-
14
- before :all do
15
- @server = IntegrationServer.run
16
- end
17
-
18
- after :all do
19
- @server.stop
20
- end
21
-
22
- describe "#request(:get)" do
23
- it "returns a valid HTTPI::Response" do
24
- httpclient_expects(:get)
25
- expect(adapter.request(:get)).to match_response(:body => Fixture.xml)
26
- end
27
- end
28
-
29
- describe "#request(:post)" do
30
- it "returns a valid HTTPI::Response" do
31
- request.body = Fixture.xml
32
- httpclient_expects(:post)
33
-
34
- expect(adapter.request(:post)).to match_response(:body => Fixture.xml)
35
- end
36
- end
37
-
38
- describe "#request(:head)" do
39
- it "returns a valid HTTPI::Response" do
40
- httpclient_expects(:head)
41
- expect(adapter.request(:head)).to match_response(:body => Fixture.xml)
42
- end
43
- end
44
-
45
- describe "#request(:put)" do
46
- it "returns a valid HTTPI::Response" do
47
- request.body = Fixture.xml
48
- httpclient_expects(:put)
49
-
50
- expect(adapter.request(:put)).to match_response(:body => Fixture.xml)
51
- end
52
- end
53
-
54
- describe "#request(:delete)" do
55
- it "returns a valid HTTPI::Response" do
56
- httpclient_expects(:delete)
57
- expect(adapter.request(:delete)).to match_response(:body => Fixture.xml)
58
- end
59
- end
60
-
61
- describe "#request(:custom)" do
62
- it "returns a valid HTTPI::Response" do
63
- httpclient_expects(:custom)
64
- expect(adapter.request(:custom)).to match_response(:body => Fixture.xml)
65
- end
66
- end
67
-
68
- describe "settings:" do
69
- before { httpclient.stubs(:request).returns(http_message) }
70
-
71
- describe "proxy" do
72
- it "have should specs"
73
- end
74
-
75
- describe "connect_timeout" do
76
- it "is not set unless specified" do
77
- httpclient.expects(:connect_timeout=).never
78
- adapter.request(:get)
79
- end
80
-
81
- it "is set if specified" do
82
- request.open_timeout = 30
83
-
84
- httpclient.expects(:connect_timeout=).with(30)
85
- adapter.request(:get)
86
- end
87
- end
88
-
89
- describe "receive_timeout" do
90
- it "is not set unless specified" do
91
- httpclient.expects(:receive_timeout=).never
92
- adapter.request(:get)
93
- end
94
-
95
- it "is set if specified" do
96
- request.read_timeout = 30
97
-
98
- httpclient.expects(:receive_timeout=).with(30)
99
- adapter.request(:get)
100
- end
101
- end
102
-
103
- describe "send_timeout" do
104
- it "is not set unless specified" do
105
- httpclient.expects(:send_timeout=).never
106
- adapter.request(:get)
107
- end
108
-
109
- it "is set if specified" do
110
- request.write_timeout = 30
111
-
112
- httpclient.expects(:send_timeout=).with(30)
113
- adapter.request(:get)
114
- end
115
- end
116
-
117
- describe "set_auth" do
118
- it "is set for HTTP basic auth" do
119
- request.auth.basic "username", "password"
120
-
121
- httpclient.expects(:set_auth).with(request.url, *request.auth.credentials)
122
- adapter.request(:get)
123
- end
124
-
125
- it "is set for HTTP digest auth" do
126
- request.auth.digest "username", "password"
127
-
128
- httpclient.expects(:set_auth).with(request.url, *request.auth.credentials)
129
- adapter.request(:get)
130
- end
131
- end
132
-
133
- context "(for SSL without auth)" do
134
- before do
135
- request.ssl = true
136
- end
137
-
138
- it 'should set the ssl_version if specified' do
139
- request.auth.ssl.ssl_version = :SSLv3
140
- ssl_config.expects(:ssl_version=).with('SSLv3')
141
-
142
- adapter.request(:get)
143
- end
144
-
145
- it 'should set the ciphers if specified' do
146
- request.auth.ssl.ciphers = OpenSSL::SSL::SSLContext.new.ciphers
147
- ssl_config.expects(:ciphers=).with(request.auth.ssl.ciphers)
148
-
149
- adapter.request(:get)
150
- end
151
- end
152
-
153
- context "(for SSL client auth)" do
154
- before do
155
- request.auth.ssl.cert_key_file = "spec/fixtures/client_key.pem"
156
- request.auth.ssl.cert_file = "spec/fixtures/client_cert.pem"
157
- end
158
-
159
- it "send certificate regardless of state of SSL verify mode" do
160
- request.auth.ssl.verify_mode = :none
161
- ssl_config.expects(:client_cert=).with(request.auth.ssl.cert)
162
- ssl_config.expects(:client_key=).with(request.auth.ssl.cert_key)
163
-
164
- adapter.request(:get)
165
- end
166
-
167
- it "client_cert, client_key and verify_mode should be set" do
168
- ssl_config.expects(:client_cert=).with(request.auth.ssl.cert)
169
- ssl_config.expects(:client_key=).with(request.auth.ssl.cert_key)
170
- ssl_config.expects(:verify_mode=).with(request.auth.ssl.openssl_verify_mode)
171
-
172
- adapter.request(:get)
173
- end
174
-
175
- it "sets the client_ca if specified" do
176
- request.auth.ssl.ca_cert_file = "spec/fixtures/client_cert.pem"
177
- ssl_config.expects(:add_trust_ca).with(request.auth.ssl.ca_cert_file)
178
-
179
- adapter.request(:get)
180
- end
181
-
182
- it 'should set the ssl_version if specified' do
183
- request.auth.ssl.ssl_version = :SSLv3
184
- ssl_config.expects(:ssl_version=).with('SSLv3')
185
-
186
- adapter.request(:get)
187
- end
188
-
189
- it 'raises error when min_version not nil' do
190
- request.auth.ssl.min_version = :TLS1_2
191
- expect{ adapter.request(:get) }.
192
- to raise_error(HTTPI::NotSupportedError, 'Httpclient adapter does not support #min_version or #max_version. Please, use #ssl_version instead')
193
- end
194
- it 'raises error when max_version not nil' do
195
- request.auth.ssl.max_version = :TLS1_2
196
- expect{ adapter.request(:get) }.
197
- to raise_error(HTTPI::NotSupportedError, 'Httpclient adapter does not support #min_version or #max_version. Please, use #ssl_version instead')
198
- end
199
- end
200
-
201
- context "(for SSL client auth with a verify mode of :none with no certs provided)" do
202
- before do
203
- request.auth.ssl.verify_mode = :none
204
- end
205
-
206
- it "verify_mode should be set" do
207
- ssl_config.expects(:verify_mode=).with(request.auth.ssl.openssl_verify_mode)
208
-
209
- adapter.request(:get)
210
- end
211
-
212
- it "does not raise an exception" do
213
- expect { adapter.request(:get) }.to_not raise_error
214
- end
215
- end
216
- end
217
-
218
- it "supports NTLM authentication" do
219
- request = HTTPI::Request.new(@server.url + "ntlm-auth")
220
-
221
- request.auth.ntlm("tester", "vReqSoafRe5O")
222
- response = HTTPI.get(request, :httpclient)
223
- expect(response.body).to eq("ntlm-auth")
224
- end
225
-
226
- def httpclient_expects(method)
227
- httpclient.expects(:request).
228
- with(method, request.url, nil, request.body, request.headers).
229
- returns(http_message)
230
- end
231
-
232
- def http_message(body = Fixture.xml)
233
- message = HTTP::Message.new_response body
234
- message.header.set "Accept-encoding", "utf-8"
235
- message
236
- end
237
-
238
- end
@@ -1,46 +0,0 @@
1
- require "spec_helper"
2
- require "httpi/adapter/net_http_persistent"
3
- require "httpi/request"
4
-
5
- begin
6
- HTTPI::Adapter.load_adapter(:net_http_persistent)
7
-
8
- describe HTTPI::Adapter::NetHTTPPersistent do
9
- let(:adapter) { HTTPI::Adapter::NetHTTPPersistent.new(request) }
10
- let(:request) { HTTPI::Request.new("http://example.com") }
11
-
12
- let(:response) {
13
- Object.new.tap do |r|
14
- r.stubs(:code).returns(200)
15
- r.stubs(:body).returns("abc")
16
- r.stubs(:to_hash).returns({"Content-Length" => "3"})
17
- end
18
- }
19
-
20
- before do
21
- Net::HTTP::Persistent.any_instance.stubs(:start).returns(response)
22
- end
23
-
24
- describe "settings" do
25
- describe "open_timeout, read_timeout" do
26
- it "are being set on the client" do
27
- request.open_timeout = 30
28
- request.read_timeout = 40
29
-
30
- adapter.client.expects(:open_timeout=).with(30)
31
- adapter.client.expects(:read_timeout=).with(40)
32
-
33
- adapter.request(:get)
34
- end
35
- end
36
-
37
- describe "write_timeout" do
38
- it "is not supported" do
39
- request.write_timeout = 50
40
- expect { adapter.request(:get) }
41
- .to raise_error(HTTPI::NotSupportedError, /write_timeout/)
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,54 +0,0 @@
1
- require "spec_helper"
2
- require "httpi/adapter/net_http"
3
- require "httpi/request"
4
-
5
- begin
6
- HTTPI::Adapter.load_adapter(:net_http)
7
-
8
- describe HTTPI::Adapter::NetHTTP do
9
- let(:adapter) { HTTPI::Adapter::NetHTTP.new(request) }
10
- let(:request) { HTTPI::Request.new("http://example.com") }
11
-
12
- let(:response) {
13
- Object.new.tap do |r|
14
- r.stubs(:code).returns(200)
15
- r.stubs(:body).returns("abc")
16
- r.stubs(:to_hash).returns({"Content-Length" => "3"})
17
- end
18
- }
19
-
20
- before do
21
- Net::HTTP.any_instance.stubs(:start).returns(response)
22
- end
23
-
24
- describe "settings" do
25
- describe "open_timeout, read_timeout" do
26
- it "are being set on the client" do
27
- request.open_timeout = 30
28
- request.read_timeout = 40
29
-
30
- adapter.client.expects(:open_timeout=).with(30)
31
- adapter.client.expects(:read_timeout=).with(40)
32
-
33
- adapter.request(:get)
34
- end
35
- end
36
-
37
- describe "write_timeout" do
38
- if Net::HTTP.method_defined?(:write_timeout=)
39
- it "is being set on the client" do
40
- request.write_timeout = 50
41
- adapter.client.expects(:write_timeout=).with(50)
42
- adapter.request(:get)
43
- end
44
- else
45
- it "can not be set on the client" do
46
- request.write_timeout = 50
47
- expect { adapter.request(:get) }
48
- .to raise_error(HTTPI::NotSupportedError, /write_timeout/)
49
- end
50
- end
51
- end
52
- end
53
- end
54
- end
@@ -1,109 +0,0 @@
1
- require "spec_helper"
2
- require "integration/support/application"
3
-
4
- describe HTTPI::Adapter::NetHTTP do
5
-
6
- subject(:adapter) { :rack }
7
-
8
- context "http requests" do
9
- before :all do
10
- @app = 'app'
11
- @url = "http://#{@app}/"
12
-
13
- HTTPI::Adapter::Rack.mount @app, IntegrationServer::Application
14
- end
15
-
16
- it "sends and receives HTTP headers" do
17
- request = HTTPI::Request.new(@url + "x-header")
18
- request.headers["X-Header"] = "HTTPI"
19
-
20
- response = HTTPI.get(request, adapter)
21
- expect(response.body).to include("HTTPI")
22
- end
23
-
24
- it "executes GET requests" do
25
- response = HTTPI.get(@url, adapter)
26
- expect(response.body).to eq("get")
27
- expect(response.headers["Content-Type"]).to eq("text/plain")
28
- end
29
-
30
- it "executes POST requests" do
31
- response = HTTPI.post(@url, "<some>xml</some>", adapter)
32
- expect(response.body).to eq("post")
33
- expect(response.headers["Content-Type"]).to eq("text/plain")
34
- end
35
-
36
- it "executes HEAD requests" do
37
- response = HTTPI.head(@url, adapter)
38
- expect(response.code).to eq(200)
39
- expect(response.headers["Content-Type"]).to eq("text/plain")
40
- end
41
-
42
- it "executes PUT requests" do
43
- response = HTTPI.put(@url, "<some>xml</some>", adapter)
44
- expect(response.body).to eq("put")
45
- expect(response.headers["Content-Type"]).to eq("text/plain")
46
- end
47
-
48
- it "executes DELETE requests" do
49
- response = HTTPI.delete(@url, adapter)
50
- expect(response.body).to eq("delete")
51
- expect(response.headers["Content-Type"]).to eq("text/plain")
52
- end
53
-
54
- describe "settings:" do
55
-
56
- let(:request) { HTTPI::Request.new("http://#{@app}") }
57
- let(:client) { HTTPI::Adapter::Rack.new(request) }
58
-
59
- describe "proxy" do
60
- before do
61
- request.proxy = "http://proxy-host.com:443"
62
- request.proxy.user = "username"
63
- request.proxy.password = "password"
64
- end
65
-
66
- it "is not supported" do
67
- expect { client.request(:get) }.
68
- to raise_error(HTTPI::NotSupportedError, "Rack adapter does not support proxying")
69
- end
70
- end
71
-
72
- describe "on_body" do
73
- before do
74
- request.on_body do
75
- # ola-la!
76
- end
77
- end
78
-
79
- it "is not supported" do
80
- expect { client.request(:get) }.
81
- to raise_error(HTTPI::NotSupportedError, "Rack adapter does not support response streaming")
82
- end
83
- end
84
-
85
- describe "basic auth" do
86
- it "is supported" do
87
- request = HTTPI::Request.new(@url + "basic-auth")
88
- request.auth.basic("admin", "secret")
89
- response = HTTPI.get(request, adapter)
90
- expect(response.body).to eq("basic-auth")
91
- end
92
- end
93
-
94
- context "(for SSL client auth)" do
95
- before do
96
- request.auth.ssl.cert_key_file = "spec/fixtures/client_key.pem"
97
- request.auth.ssl.cert_file = "spec/fixtures/client_cert.pem"
98
- end
99
-
100
- it "is not supported" do
101
- expect { client.request(:get) }.
102
- to raise_error(HTTPI::NotSupportedError, "Rack adapter does not support SSL client auth")
103
- end
104
- end
105
- end
106
-
107
- end
108
-
109
- end
@@ -1,68 +0,0 @@
1
- require "spec_helper"
2
- require "httpi/adapter"
3
-
4
- describe HTTPI::Adapter do
5
- let(:adapter) { HTTPI::Adapter }
6
-
7
- describe ".register" do
8
- it "registers a new adapter" do
9
- name = :custom
10
- klass = Class.new
11
- deps = %w(some_dependency)
12
-
13
- adapter.register(name, klass, deps)
14
-
15
- expect(HTTPI::Adapter::ADAPTERS[:custom]).to include(:class => klass, :deps => deps)
16
- expect(HTTPI::Adapter::ADAPTER_CLASS_MAP[klass]).to be(name)
17
- end
18
- end
19
-
20
- describe ".use" do
21
- around do |example|
22
- adapter.use = nil
23
- example.run
24
- adapter.use = nil
25
- end
26
-
27
- it "sets the adapter to use" do
28
- expect(adapter.use).not_to eq(:net_http)
29
-
30
- adapter.use = :net_http
31
- expect(adapter.use).to eq(:net_http)
32
- end
33
-
34
- it "defaults to use the HTTPClient adapter" do
35
- expect(adapter.use).to eq(:httpclient)
36
- end
37
-
38
- it "loads the adapter's client library" do
39
- adapter.expects(:require).with("httpclient")
40
- adapter.use = :httpclient
41
- end
42
-
43
- it "raises an ArgumentError in case of an invalid adapter" do
44
- expect { adapter.use = :unknown }.to raise_error(ArgumentError)
45
- end
46
- end
47
-
48
- describe ".load" do
49
- context "called with a valid adapter" do
50
- it "returns the adapter's name and class" do
51
- expect(adapter.load(:net_http)).to eq(HTTPI::Adapter::NetHTTP)
52
- end
53
- end
54
-
55
- context "called with nil" do
56
- it "returns the default adapter's name and class" do
57
- expect(adapter.load(nil)).to eq(HTTPI::Adapter::HTTPClient)
58
- end
59
- end
60
-
61
- context "called with an invalid adapter" do
62
- it "raises an ArgumentError" do
63
- expect { adapter.use = :unknown }.to raise_error(ArgumentError)
64
- end
65
- end
66
- end
67
-
68
- end
@@ -1,163 +0,0 @@
1
- require "spec_helper"
2
- require "httpi/auth/config"
3
-
4
- describe HTTPI::Auth::Config do
5
- let(:auth) { HTTPI::Auth::Config.new }
6
-
7
- describe "#basic" do
8
- it "lets you specify the basic auth credentials" do
9
- auth.basic "username", "password"
10
- expect(auth.basic).to eq(["username", "password"])
11
- end
12
-
13
- it "also accepts an Array of credentials" do
14
- auth.basic ["username", "password"]
15
- expect(auth.basic).to eq(["username", "password"])
16
- end
17
-
18
- it "sets the authentication type to :basic" do
19
- auth.basic "username", "password"
20
- expect(auth.type).to eq(:basic)
21
- end
22
- end
23
-
24
- describe "#basic?" do
25
- it "defaults to return false" do
26
- expect(auth).not_to be_basic
27
- end
28
-
29
- it "returns true for HTTP basic auth" do
30
- auth.basic "username", "password"
31
- expect(auth).to be_basic
32
- end
33
- end
34
-
35
- describe "#digest" do
36
- it "lets you specify the digest auth credentials" do
37
- auth.digest "username", "password"
38
- expect(auth.digest).to eq(["username", "password"])
39
- end
40
-
41
- it "also accepts an Array of credentials" do
42
- auth.digest ["username", "password"]
43
- expect(auth.digest).to eq(["username", "password"])
44
- end
45
-
46
- it "sets the authentication type to :digest" do
47
- auth.digest "username", "password"
48
- expect(auth.type).to eq(:digest)
49
- end
50
- end
51
-
52
- describe "#digest?" do
53
- it "defaults to return false" do
54
- expect(auth).not_to be_digest
55
- end
56
-
57
- it "returns true for HTTP digest auth" do
58
- auth.digest "username", "password"
59
- expect(auth).to be_digest
60
- end
61
- end
62
-
63
- describe "#gssnegotiate" do
64
- it "sets the authentication type to :gssnegotiate" do
65
- auth.gssnegotiate
66
- expect(auth.type).to eq(:gssnegotiate)
67
- end
68
- end
69
-
70
- describe "#gssnegotiate?" do
71
- it "defaults to return false" do
72
- expect(auth).not_to be_gssnegotiate
73
- end
74
-
75
- it "returns true for HTTP Negotiate auth" do
76
- auth.gssnegotiate
77
- expect(auth).to be_gssnegotiate
78
- end
79
- end
80
-
81
- describe "#http?" do
82
- it "defaults to return false" do
83
- expect(auth).not_to be_http
84
- end
85
-
86
- it "returns true for HTTP basic auth" do
87
- auth.basic "username", "password"
88
- expect(auth).to be_http
89
- end
90
-
91
- it "returns true for HTTP digest auth" do
92
- auth.digest "username", "password"
93
- expect(auth).to be_http
94
- end
95
- end
96
-
97
- describe "#ssl" do
98
- it "returns the HTTPI::Auth::SSL object" do
99
- expect(auth.ssl).to be_a(HTTPI::Auth::SSL)
100
- end
101
- end
102
-
103
- describe "#ssl?" do
104
- it "defaults to return false" do
105
- expect(auth).not_to be_ssl
106
- end
107
-
108
- it "returns true for SSL client auth" do
109
- auth.ssl.cert_key_file = "spec/fixtures/client_key.pem"
110
- auth.ssl.cert_file = "spec/fixtures/client_cert.pem"
111
-
112
- expect(auth).to be_ssl
113
- end
114
- end
115
-
116
- describe "#type" do
117
- it "returns the authentication type" do
118
- auth.basic "username", "password"
119
- expect(auth.type).to eq(:basic)
120
- end
121
- end
122
-
123
- describe "#credentials" do
124
- it "returns the credentials for HTTP basic auth" do
125
- auth.basic "username", "basic"
126
- expect(auth.credentials).to eq(["username", "basic"])
127
- end
128
-
129
- it "returns the credentials for HTTP digest auth" do
130
- auth.digest "username", "digest"
131
- expect(auth.credentials).to eq(["username", "digest"])
132
- end
133
- end
134
-
135
- describe "#ntlm" do
136
- it "lets you specify the ntlm auth credentials" do
137
- auth.ntlm "username", "password"
138
- expect(auth.ntlm).to eq(["username", "password"])
139
- end
140
-
141
- it "also accepts an Array of credentials" do
142
- auth.ntlm ["username", "password"]
143
- expect(auth.ntlm).to eq(["username", "password"])
144
- end
145
-
146
- it "sets the authentication type to :ntlm" do
147
- auth.ntlm "username", "password"
148
- expect(auth.type).to eq(:ntlm)
149
- end
150
- end
151
-
152
- describe "#ntlm?" do
153
- it "defaults to return false" do
154
- expect(auth).not_to be_ntlm
155
- end
156
-
157
- it "returns true for HTTP ntlm auth" do
158
- auth.ntlm "username", "password"
159
- expect(auth).to be_ntlm
160
- end
161
- end
162
-
163
- end