roust 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2f1667d37f6c04f786ddb9bd4c437290151f549
4
- data.tar.gz: e65c73bab11bd66ec7c904445de4aa7573440f69
3
+ metadata.gz: d1a2f356ca5640d7d394f07ced73cc03abcd6e34
4
+ data.tar.gz: 41196d852637d8c592068c6e1faf993183349a5a
5
5
  SHA512:
6
- metadata.gz: 0aa451f3c531b9981ecd88f47d738122ed38684a3ec41ac27eb743b1bdb528c9377b42feb9e352f65039bc24a8458faa94d3717df009ebf0681da230ff77efc8
7
- data.tar.gz: fdcf546e35a39bd594c9f2d5fa42d1232675a9019f6f019d77caf52e04fef5254bf4a15b452aad381c38feaa8a575941586256e30dc15e98674da7a65eff9d55
6
+ metadata.gz: 197a802ad243cafcff1965016d544b1722dd83ef9d633410ede414422a0ffba1de3e63f4d91f548ac546501f4c898bda05f459f50c255495c3a11252ee326089
7
+ data.tar.gz: 5a68904147845e22f3ff138eb0bf1d0a6d5f64da303d7cc877706ac57a132d7bea1ef7ef5122ea4bbe128a5ed44b8f77adc990a6283334a9461b04cda8ad2725
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- roust (1.4.0)
4
+ roust (1.4.1)
5
5
  activesupport (>= 4.1.0)
6
6
  httparty (>= 0.13.1)
7
7
  mail (>= 2.5.4)
data/lib/roust/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Roust
2
- VERSION = '1.4.0'
2
+ VERSION = '1.4.1'
3
3
  end
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
- '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 => {})
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roust
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lindsay Holmwood