roust 1.4.0 → 1.4.1
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/roust/version.rb +1 -1
- data/lib/roust.rb +4 -0
- data/spec/roust/authentication_spec.rb +17 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1a2f356ca5640d7d394f07ced73cc03abcd6e34
|
4
|
+
data.tar.gz: 41196d852637d8c592068c6e1faf993183349a5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 197a802ad243cafcff1965016d544b1722dd83ef9d633410ede414422a0ffba1de3e63f4d91f548ac546501f4c898bda05f459f50c255495c3a11252ee326089
|
7
|
+
data.tar.gz: 5a68904147845e22f3ff138eb0bf1d0a6d5f64da303d7cc877706ac57a132d7bea1ef7ef5122ea4bbe128a5ed44b8f77adc990a6283334a9461b04cda8ad2725
|
data/Gemfile.lock
CHANGED
data/lib/roust/version.rb
CHANGED
data/lib/roust.rb
CHANGED
@@ -17,6 +17,10 @@ class Roust
|
|
17
17
|
username = credentials[:username]
|
18
18
|
password = credentials[:password]
|
19
19
|
|
20
|
+
if server =~ /REST\/1\.0/
|
21
|
+
raise ArgumentError, "The supplied :server has REST in the URL. You only need to specify the base, e.g. http://rt.example.org/"
|
22
|
+
end
|
23
|
+
|
20
24
|
self.class.base_uri(server)
|
21
25
|
|
22
26
|
response = self.class.post(
|
@@ -13,21 +13,27 @@ describe Roust do
|
|
13
13
|
it 'errors when credentials are incorrect' do
|
14
14
|
mocks_path = Pathname.new(__FILE__).parent.parent.join('mocks')
|
15
15
|
|
16
|
-
stub_request(:post, 'http://rt.example.org/index.html')
|
17
|
-
with(:body => {
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
to_return(:status => 200, :body => '', :headers => {})
|
22
|
-
|
23
|
-
stub_request(:get, 'http://rt.example.org/REST/1.0/ticket/1/show')
|
24
|
-
to_return(:status => 200,
|
25
|
-
|
26
|
-
|
16
|
+
stub_request(:post, 'http://rt.example.org/index.html')
|
17
|
+
.with(:body => {
|
18
|
+
'user'=>'admin',
|
19
|
+
'pass'=>'incorrect',
|
20
|
+
})
|
21
|
+
.to_return(:status => 200, :body => '', :headers => {})
|
22
|
+
|
23
|
+
stub_request(:get, 'http://rt.example.org/REST/1.0/ticket/1/show')
|
24
|
+
.to_return(:status => 200,
|
25
|
+
:body => mocks_path.join('ticket-1-show-unauthenticated.txt').read,
|
26
|
+
:headers => {})
|
27
27
|
|
28
28
|
credentials.merge!({:username => 'admin', :password => 'incorrect'})
|
29
29
|
|
30
30
|
expect { Roust.new(credentials) }.to raise_error(Unauthenticated)
|
31
31
|
end
|
32
|
+
|
33
|
+
it 'errors when API root is supplied in server url' do
|
34
|
+
credentials[:server] = 'http://rt.example.org/REST/1.0'
|
35
|
+
|
36
|
+
expect { Roust.new(credentials) }.to raise_error(ArgumentError)
|
37
|
+
end
|
32
38
|
end
|
33
39
|
end
|