quanto-ruby 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/quanto/client.rb +2 -1
- data/lib/quanto/version.rb +1 -1
- data/spec/quanto_client_spec.rb +22 -3
- 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: e9ba4b59823a07cbf4dfcd754d8e8668818f8427
|
4
|
+
data.tar.gz: 3ba2334cc16abeb2fa72626c45958654a57666b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31745e8e2c74c7e3fd342d2704ce96852728e533fc413236d7dd41aa857b4592c886790f9418735600636e09c1c9cfe6df0bcfb33ca385e66597a898c015c52f
|
7
|
+
data.tar.gz: 7f2886f2018ec7bc8557f25b325353ec6a5fde74cacdd4b9fd32b7415e00ad6e64fda3ae7b895fa88082bca6178b49651c9394dd8f39c26d72974b91c2314c41
|
data/lib/quanto/client.rb
CHANGED
data/lib/quanto/version.rb
CHANGED
data/spec/quanto_client_spec.rb
CHANGED
@@ -5,9 +5,12 @@ describe Quanto::Client do
|
|
5
5
|
|
6
6
|
let(:consumer_key) { 'consumer_key' }
|
7
7
|
let(:consumer_secret) { 'consumer_secret' }
|
8
|
+
let(:client) { Quanto::Client.new(consumer_key, consumer_secret, options) }
|
8
9
|
|
9
10
|
describe '#initialize' do
|
10
11
|
|
12
|
+
let(:client) { Quanto::Client.new(consumer_key, consumer_secret, options) }
|
13
|
+
|
11
14
|
it 'constructs an OAuth2 consumer' do
|
12
15
|
OAuth2::Client.should_receive(:new)
|
13
16
|
Quanto::Client.new(consumer_key, consumer_secret)
|
@@ -29,8 +32,6 @@ describe Quanto::Client do
|
|
29
32
|
|
30
33
|
describe '#access_token' do
|
31
34
|
|
32
|
-
let(:client) { double('OAuth2::Client') }
|
33
|
-
let(:client) { Quanto::Client.new(consumer_key, consumer_secret, options) }
|
34
35
|
|
35
36
|
context 'without credentials' do
|
36
37
|
|
@@ -55,7 +56,7 @@ describe Quanto::Client do
|
|
55
56
|
OAuth2::AccessToken
|
56
57
|
.should_receive(:new)
|
57
58
|
.with(anything, options[:access_token])
|
58
|
-
client.stub(:
|
59
|
+
client.stub(:consumer).and_return(double('OAuth2::Client'))
|
59
60
|
client.send(:access_token)
|
60
61
|
end
|
61
62
|
|
@@ -63,4 +64,22 @@ describe Quanto::Client do
|
|
63
64
|
|
64
65
|
end
|
65
66
|
|
67
|
+
describe '#post' do
|
68
|
+
|
69
|
+
let(:options) { { access_token: 'token' } }
|
70
|
+
let(:token) { double('OAuth2::AccessToken') }
|
71
|
+
|
72
|
+
before(:each) do
|
73
|
+
client.stub(:access_token).and_return(token)
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'prepends /api/v1' do
|
77
|
+
path = 'foo'
|
78
|
+
prefix = "/api/v1/"
|
79
|
+
token.should_receive(:post).with("#{prefix}#{path}", anything)
|
80
|
+
client.send(:post, path, {})
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
66
85
|
end
|