pebblebed 0.0.19 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -55,7 +55,6 @@ Other helper methods provided by this extension:
55
55
  pebbles # Common entrypoint for the Pebblebed::Connector
56
56
  current_identity # Returns the a DeepStruct record with the vital data for the current user
57
57
  require_identity # Halts with 403 if there is no current user
58
- current_identity_is?(identity_id) # Halts with 403 if the current user is neither the provided user or a god
59
58
  require_god # Halts with 403 if the current user is not a god
60
59
  require_parameters(parameters, *keys) # Halts with 409 if the at least one of the provided keys is not in the params-hash
61
60
 
@@ -5,6 +5,7 @@ require 'futurevalue'
5
5
  module Pebblebed
6
6
  class QuorumClient < AbstractClient
7
7
  def initialize(services, session_key)
8
+ LOGGER.warn "DEPRECATED: The Pebblebed::QuorumClient is no longer supported."
8
9
  @clients = Hash[services.map do |service|
9
10
  [service, Pebblebed::GenericClient.new(session_key, Pebblebed.root_url_for(service))]
10
11
  end]
@@ -27,4 +28,4 @@ module Pebblebed
27
28
  Hash[results.map{|service, response| [service, response.value]}]
28
29
  end
29
30
  end
30
- end
31
+ end
@@ -13,7 +13,7 @@ module Pebblebed
13
13
  attr_reader :status, :message
14
14
  def initialize(message, status = nil)
15
15
  @message = message
16
- @status = status
16
+ @status = status
17
17
  end
18
18
 
19
19
  def not_found?
@@ -49,7 +49,7 @@ module Pebblebed
49
49
  end
50
50
 
51
51
  def self.get(url = nil, params = nil, &block)
52
- url, params = url_and_params_from_args(url, params, &block)
52
+ url, params = url_and_params_from_args(url, params, &block)
53
53
  handle_curl_response(Curl::Easy.perform(url_with_params(url, params)))
54
54
  end
55
55
 
@@ -63,7 +63,7 @@ module Pebblebed
63
63
  end
64
64
 
65
65
  def self.put(url, params, &block)
66
- url, params = url_and_params_from_args(url, params, &block)
66
+ url, params = url_and_params_from_args(url, params, &block)
67
67
  content_type, body = serialize_params(params)
68
68
  handle_curl_response(Curl::Easy.http_put(url.to_s, body) do |curl|
69
69
  curl.headers['Accept'] = 'application/json'
@@ -72,7 +72,7 @@ module Pebblebed
72
72
  end
73
73
 
74
74
  def self.delete(url, params, &block)
75
- url, params = url_and_params_from_args(url, params, &block)
75
+ url, params = url_and_params_from_args(url, params, &block)
76
76
  handle_curl_response(Curl::Easy.http_delete(url_with_params(url, params)))
77
77
  end
78
78
 
@@ -94,17 +94,18 @@ module Pebblebed
94
94
  if result.status >= 400
95
95
  errmsg = "Service request to '#{result.url}' failed (#{result.status}):"
96
96
  errmsg << extract_error_summary(result.body)
97
- raise HttpError.new(ActiveSupport::SafeBuffer.new(errmsg), result.status)
97
+ puts errmsg
98
+ raise HttpError.new(ActiveSupport::SafeBuffer.new(errmsg), result.status)
98
99
  # ActiveSupport::SafeBuffer.new is the same as errmsg.html_safe in rails
99
100
  end
100
101
  result
101
102
  end
102
103
 
103
- def self.handle_curl_response(curl_response)
104
+ def self.handle_curl_response(curl_response)
104
105
  handle_http_errors(CurlResult.new(curl_response))
105
106
  end
106
107
 
107
- def self.url_with_params(url, params)
108
+ def self.url_with_params(url, params)
108
109
  url.query = QueryParams.encode(params || {})
109
110
  url.to_s
110
111
  end
@@ -0,0 +1,47 @@
1
+ module Pebblebed
2
+ class Labels
3
+
4
+ NO_MARKER = Class.new
5
+
6
+ attr_reader :path, :prefix, :suffix, :stop
7
+ def initialize(path, options = {})
8
+ @path = path
9
+ @base_path = path.split('.').select {|label| Uid.valid_label?(label)}.join('.')
10
+ @wildcard = !!Uid.wildcard_path?(path)
11
+ @prefix = options.fetch(:prefix) { 'label' }
12
+ @suffix = options.fetch(:suffix) { nil }
13
+ @stop = options.fetch(:stop) { NO_MARKER }
14
+ end
15
+
16
+ def next
17
+ label(expanded.length)
18
+ end
19
+
20
+ def wildcard?
21
+ @wildcard
22
+ end
23
+
24
+ def expanded
25
+ unless @expanded
26
+ values = {}
27
+ @base_path.split('.').each_with_index do |label, i|
28
+ values[label(i)] = label
29
+ end
30
+ if use_stop_marker?
31
+ values[label(values.length)] = stop
32
+ end
33
+ @expanded = values
34
+ end
35
+ @expanded
36
+ end
37
+
38
+ def label(i)
39
+ [prefix, i, suffix].compact.join('_')
40
+ end
41
+
42
+ def use_stop_marker?
43
+ stop != NO_MARKER
44
+ end
45
+ end
46
+
47
+ end
@@ -33,7 +33,9 @@ module Sinatra
33
33
  end
34
34
 
35
35
  def current_identity
36
- pebbles.checkpoint.me
36
+ return @current_identity if @identity_checked
37
+ @identity_checked = true
38
+ @current_identity = get("/identities/me")[:identity]
37
39
  end
38
40
 
39
41
  def require_identity
@@ -42,13 +44,6 @@ module Sinatra
42
44
  end
43
45
  end
44
46
 
45
- def current_identity_is?(identity_id)
46
- require_identity
47
- unless (current_identity.id == identity_id || current_identity.god)
48
- halt 403, "Private resource"
49
- end
50
- end
51
-
52
47
  def require_god
53
48
  require_identity
54
49
  halt 403, "Current identity #{current_identity.id} is not god" unless current_identity.god
@@ -82,5 +77,27 @@ module Sinatra
82
77
  set :service_name, service_name
83
78
  end
84
79
 
80
+ ##
81
+ # Adds a before filter to ensure all visitors gets assigned a provisional identity. The options hash takes an
82
+ # optional key "unless" which can be used to specify a lambda/proc that yields true if
83
+ # the request should *not* trigger a redirect to checkpoint
84
+ #
85
+ # TODO: Also implement a guard against infinite redirect loops
86
+ #
87
+ # Usage example:
88
+ #
89
+ # assign_provisional_identity :unless => lambda {
90
+ # request.path_info == '/ping' || BotDetector.bot?(request.user_agent)
91
+ # }
92
+ #
93
+ def assign_provisional_identity(opts={})
94
+ before do
95
+ skip = opts.has_key?(:unless) && instance_exec(&opts[:unless])
96
+ if !skip && current_identity.nil?
97
+ redirect pebbles.checkpoint.service_url("/login/anonymous", :redirect_to => request.path).to_s
98
+ end
99
+ end
100
+ end
101
+
85
102
  end
86
103
  end
@@ -1,3 +1,3 @@
1
1
  module Pebblebed
2
- VERSION = "0.0.19"
2
+ VERSION = "0.0.20"
3
3
  end
data/lib/pebblebed.rb CHANGED
@@ -10,3 +10,4 @@ require 'pebblebed/clients/checkpoint_client'
10
10
  require 'pebblebed/clients/quorum_client'
11
11
  require 'pebblebed/parts'
12
12
  require 'pebblebed/river'
13
+ require 'pebblebed/labels'
@@ -3,7 +3,7 @@ require 'pebblebed/config'
3
3
  require 'pebblebed/connector'
4
4
  require 'pebblebed/clients/abstract_client'
5
5
  require 'pebblebed/clients/generic_client'
6
- require 'pebblebed/clients/checkpoint_client'
6
+ require 'pebblebed/clients/quorum_client'
7
7
 
8
8
  describe "Pebblebed::Connector" do
9
9
  it "can configure clients for any service" do
@@ -19,12 +19,6 @@ describe "Pebblebed::Connector" do
19
19
  connector['foobar'].should eq connector['foobar']
20
20
  end
21
21
 
22
- it "fetches specific client implementations if one is provided" do
23
- connector = Pebblebed::Connector.new("session_key")
24
- connector['checkpoint'].class.name.should eq "Pebblebed::CheckpointClient"
25
- connector['foobar'].class.name.should eq "Pebblebed::GenericClient"
26
- end
27
-
28
22
  it "has key getter and setter" do
29
23
  connector = Pebblebed::Connector.new("session_key")
30
24
  connector.key.should == "session_key"
@@ -0,0 +1,33 @@
1
+ require 'pebblebed/uid'
2
+ require 'pebblebed/labels'
3
+
4
+ describe Pebblebed::Labels do
5
+
6
+ describe "default labels" do
7
+ subject { Pebblebed::Labels.new('a.b.c') }
8
+ its(:expanded) { should eq('label_0' => "a", 'label_1' => "b", 'label_2' => "c") }
9
+ its(:wildcard?) { should == false }
10
+ end
11
+
12
+ describe "with a stop label" do
13
+ subject { Pebblebed::Labels.new('a.b.c', :stop => nil) }
14
+ its(:expanded) { should eq('label_0' => "a", 'label_1' => "b", 'label_2' => "c", 'label_3' => nil) }
15
+ end
16
+
17
+ describe "customized labels" do
18
+ subject { Pebblebed::Labels.new('p.r.q', :prefix => 'dot', :suffix => '', :stop => '<END>') }
19
+ its(:expanded) { should eq('dot_0_' => 'p', 'dot_1_' => 'r', 'dot_2_' => 'q', 'dot_3_' => '<END>') }
20
+ end
21
+
22
+ describe "next label" do
23
+ subject { Pebblebed::Labels.new('a.b.c', :prefix => 'thing') }
24
+ its(:next) { should eq('thing_3') }
25
+ end
26
+
27
+ describe "with wildcard *" do
28
+ subject { Pebblebed::Labels.new('a.b.c.*') }
29
+ its(:expanded) { should eq('label_0' => "a", 'label_1' => "b", 'label_2' => "c") }
30
+ its(:wildcard?) { should == true }
31
+ end
32
+
33
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pebblebed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-08-16 00:00:00.000000000 Z
13
+ date: 2012-09-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
17
- requirement: &70357357304320 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,15 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *70357357304320
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
26
31
  - !ruby/object:Gem::Dependency
27
32
  name: rake
28
- requirement: &70357357303880 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
29
34
  none: false
30
35
  requirements:
31
36
  - - ! '>='
@@ -33,10 +38,15 @@ dependencies:
33
38
  version: '0'
34
39
  type: :development
35
40
  prerelease: false
36
- version_requirements: *70357357303880
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
37
47
  - !ruby/object:Gem::Dependency
38
48
  name: simplecov
39
- requirement: &70357357303420 !ruby/object:Gem::Requirement
49
+ requirement: !ruby/object:Gem::Requirement
40
50
  none: false
41
51
  requirements:
42
52
  - - ! '>='
@@ -44,10 +54,15 @@ dependencies:
44
54
  version: '0'
45
55
  type: :development
46
56
  prerelease: false
47
- version_requirements: *70357357303420
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
48
63
  - !ruby/object:Gem::Dependency
49
64
  name: deepstruct
50
- requirement: &70357357302880 !ruby/object:Gem::Requirement
65
+ requirement: !ruby/object:Gem::Requirement
51
66
  none: false
52
67
  requirements:
53
68
  - - ! '>='
@@ -55,10 +70,15 @@ dependencies:
55
70
  version: 0.0.2
56
71
  type: :runtime
57
72
  prerelease: false
58
- version_requirements: *70357357302880
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: 0.0.2
59
79
  - !ruby/object:Gem::Dependency
60
80
  name: curb
61
- requirement: &70357357302320 !ruby/object:Gem::Requirement
81
+ requirement: !ruby/object:Gem::Requirement
62
82
  none: false
63
83
  requirements:
64
84
  - - ! '>='
@@ -66,10 +86,15 @@ dependencies:
66
86
  version: 0.7.14
67
87
  type: :runtime
68
88
  prerelease: false
69
- version_requirements: *70357357302320
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: 0.7.14
70
95
  - !ruby/object:Gem::Dependency
71
96
  name: yajl-ruby
72
- requirement: &70357357318260 !ruby/object:Gem::Requirement
97
+ requirement: !ruby/object:Gem::Requirement
73
98
  none: false
74
99
  requirements:
75
100
  - - ! '>='
@@ -77,10 +102,15 @@ dependencies:
77
102
  version: '0'
78
103
  type: :runtime
79
104
  prerelease: false
80
- version_requirements: *70357357318260
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
81
111
  - !ruby/object:Gem::Dependency
82
112
  name: queryparams
83
- requirement: &70357357317720 !ruby/object:Gem::Requirement
113
+ requirement: !ruby/object:Gem::Requirement
84
114
  none: false
85
115
  requirements:
86
116
  - - ! '>='
@@ -88,10 +118,15 @@ dependencies:
88
118
  version: '0'
89
119
  type: :runtime
90
120
  prerelease: false
91
- version_requirements: *70357357317720
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
92
127
  - !ruby/object:Gem::Dependency
93
128
  name: futurevalue
94
- requirement: &70357357317160 !ruby/object:Gem::Requirement
129
+ requirement: !ruby/object:Gem::Requirement
95
130
  none: false
96
131
  requirements:
97
132
  - - ! '>='
@@ -99,10 +134,15 @@ dependencies:
99
134
  version: '0'
100
135
  type: :runtime
101
136
  prerelease: false
102
- version_requirements: *70357357317160
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
103
143
  - !ruby/object:Gem::Dependency
104
144
  name: pathbuilder
105
- requirement: &70357357316580 !ruby/object:Gem::Requirement
145
+ requirement: !ruby/object:Gem::Requirement
106
146
  none: false
107
147
  requirements:
108
148
  - - ! '>='
@@ -110,10 +150,15 @@ dependencies:
110
150
  version: '0'
111
151
  type: :runtime
112
152
  prerelease: false
113
- version_requirements: *70357357316580
153
+ version_requirements: !ruby/object:Gem::Requirement
154
+ none: false
155
+ requirements:
156
+ - - ! '>='
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
114
159
  - !ruby/object:Gem::Dependency
115
160
  name: nokogiri
116
- requirement: &70357357315620 !ruby/object:Gem::Requirement
161
+ requirement: !ruby/object:Gem::Requirement
117
162
  none: false
118
163
  requirements:
119
164
  - - ! '>='
@@ -121,10 +166,15 @@ dependencies:
121
166
  version: '0'
122
167
  type: :runtime
123
168
  prerelease: false
124
- version_requirements: *70357357315620
169
+ version_requirements: !ruby/object:Gem::Requirement
170
+ none: false
171
+ requirements:
172
+ - - ! '>='
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
125
175
  - !ruby/object:Gem::Dependency
126
176
  name: i18n
127
- requirement: &70357357315180 !ruby/object:Gem::Requirement
177
+ requirement: !ruby/object:Gem::Requirement
128
178
  none: false
129
179
  requirements:
130
180
  - - ! '>='
@@ -132,10 +182,15 @@ dependencies:
132
182
  version: '0'
133
183
  type: :runtime
134
184
  prerelease: false
135
- version_requirements: *70357357315180
185
+ version_requirements: !ruby/object:Gem::Requirement
186
+ none: false
187
+ requirements:
188
+ - - ! '>='
189
+ - !ruby/object:Gem::Version
190
+ version: '0'
136
191
  - !ruby/object:Gem::Dependency
137
192
  name: activesupport
138
- requirement: &70357357314700 !ruby/object:Gem::Requirement
193
+ requirement: !ruby/object:Gem::Requirement
139
194
  none: false
140
195
  requirements:
141
196
  - - ! '>='
@@ -143,10 +198,15 @@ dependencies:
143
198
  version: '0'
144
199
  type: :runtime
145
200
  prerelease: false
146
- version_requirements: *70357357314700
201
+ version_requirements: !ruby/object:Gem::Requirement
202
+ none: false
203
+ requirements:
204
+ - - ! '>='
205
+ - !ruby/object:Gem::Version
206
+ version: '0'
147
207
  - !ruby/object:Gem::Dependency
148
208
  name: bunny
149
- requirement: &70357357314080 !ruby/object:Gem::Requirement
209
+ requirement: !ruby/object:Gem::Requirement
150
210
  none: false
151
211
  requirements:
152
212
  - - ! '>='
@@ -154,7 +214,12 @@ dependencies:
154
214
  version: '0'
155
215
  type: :runtime
156
216
  prerelease: false
157
- version_requirements: *70357357314080
217
+ version_requirements: !ruby/object:Gem::Requirement
218
+ none: false
219
+ requirements:
220
+ - - ! '>='
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
158
223
  description: Development tools for working with Pebblebed
159
224
  email:
160
225
  - katrina@bengler.no
@@ -171,12 +236,12 @@ files:
171
236
  - integration/river_spec.rb
172
237
  - lib/pebblebed.rb
173
238
  - lib/pebblebed/clients/abstract_client.rb
174
- - lib/pebblebed/clients/checkpoint_client.rb
175
239
  - lib/pebblebed/clients/generic_client.rb
176
240
  - lib/pebblebed/clients/quorum_client.rb
177
241
  - lib/pebblebed/config.rb
178
242
  - lib/pebblebed/connector.rb
179
243
  - lib/pebblebed/http.rb
244
+ - lib/pebblebed/labels.rb
180
245
  - lib/pebblebed/parts.rb
181
246
  - lib/pebblebed/river.rb
182
247
  - lib/pebblebed/river/subscription.rb
@@ -185,11 +250,11 @@ files:
185
250
  - lib/pebblebed/uid_query.rb
186
251
  - lib/pebblebed/version.rb
187
252
  - pebblebed.gemspec
188
- - spec/checkpoint_client_spec.rb
189
253
  - spec/config_spec.rb
190
254
  - spec/connector_spec.rb
191
255
  - spec/generic_client_spec.rb
192
256
  - spec/http_spec.rb
257
+ - spec/labels_spec.rb
193
258
  - spec/mock_pebble.rb
194
259
  - spec/mockcached.rb
195
260
  - spec/river_spec.rb
@@ -209,24 +274,30 @@ required_ruby_version: !ruby/object:Gem::Requirement
209
274
  - - ! '>='
210
275
  - !ruby/object:Gem::Version
211
276
  version: '0'
277
+ segments:
278
+ - 0
279
+ hash: 900091083955383393
212
280
  required_rubygems_version: !ruby/object:Gem::Requirement
213
281
  none: false
214
282
  requirements:
215
283
  - - ! '>='
216
284
  - !ruby/object:Gem::Version
217
285
  version: '0'
286
+ segments:
287
+ - 0
288
+ hash: 900091083955383393
218
289
  requirements: []
219
290
  rubyforge_project: pebblebed
220
- rubygems_version: 1.8.15
291
+ rubygems_version: 1.8.24
221
292
  signing_key:
222
293
  specification_version: 3
223
294
  summary: Development tools for working with Pebblebed
224
295
  test_files:
225
- - spec/checkpoint_client_spec.rb
226
296
  - spec/config_spec.rb
227
297
  - spec/connector_spec.rb
228
298
  - spec/generic_client_spec.rb
229
299
  - spec/http_spec.rb
300
+ - spec/labels_spec.rb
230
301
  - spec/mock_pebble.rb
231
302
  - spec/mockcached.rb
232
303
  - spec/river_spec.rb
@@ -1,27 +0,0 @@
1
- module Pebblebed
2
- class CheckpointClient < Pebblebed::GenericClient
3
- def me
4
- return @identity if @identity_checked
5
- @identity_checked = true
6
- @identity = get("/identities/me")[:identity]
7
- end
8
-
9
- # Given a list of identity IDs it returns each identity or an empty hash for identities that doesnt exists.
10
- # If pebbles are configured with memcached, results will be cached.
11
- # Params: ids a list of identities
12
- def find_identities(ids)
13
-
14
- result = {}
15
- request = get("/identities/#{ids.join(',')},")
16
- ids.each_with_index do |id, i|
17
- identity = request.identities[i].identity.unwrap
18
- result[id] = identity
19
- end
20
- return DeepStruct.wrap(ids.collect {|id| result[id]})
21
- end
22
-
23
- def god?
24
- me.god if me
25
- end
26
- end
27
- end
@@ -1,61 +0,0 @@
1
- require 'spec_helper'
2
- require 'pebblebed/config'
3
- require 'pebblebed/connector'
4
- require 'pebblebed/http'
5
- require 'pebblebed/clients/abstract_client'
6
- require 'pebblebed/clients/generic_client'
7
- require 'pebblebed/clients/checkpoint_client'
8
-
9
- describe Pebblebed::CheckpointClient do
10
-
11
- let(:checkpoint_client) { Pebblebed::Connector.new('session_key')[:checkpoint] }
12
-
13
- describe "me" do
14
- let(:canned_response_for_me) {
15
- DeepStruct.wrap({:body=>{:identity => {:id => 1, :god => true}}.to_json})
16
- }
17
-
18
- it "returns current user identity upon request and caches it as an instance variable" do
19
- checkpoint_client = Pebblebed::Connector.new('session_key')[:checkpoint]
20
-
21
- Pebblebed::Http.should_receive(:get) { |url|
22
- url.path.should match("/identities/me")
23
- canned_response_for_me
24
- }.once
25
- checkpoint_client.me
26
- checkpoint_client.me
27
- end
28
-
29
- it "tells us whether we are dealing with god allmighty himself or just another average joe" do
30
- checkpoint_client = Pebblebed::Connector.new('session_key')[:checkpoint]
31
- Pebblebed::Http.should_receive(:get) { |url|
32
- url.path.should match("/identities/me")
33
- canned_response_for_me
34
- }.once
35
- checkpoint_client.god?.should eq true
36
- end
37
- end
38
-
39
- describe "find_identities" do
40
- let(:canned_response) {
41
- DeepStruct.wrap({:body=>
42
- {:identities =>
43
- [{:identity => {:id => 1}}, {:identity => {}}, {:identity => {:id => 3}}, {:identity => {}}]
44
- }.to_json
45
- })
46
- }
47
-
48
- before(:each) do
49
- Pebblebed.config do
50
- host "checkpoint.dev"
51
- service :checkpoint
52
- end
53
- end
54
-
55
- it "issues an http request every time" do
56
- Pebblebed::Http.should_receive(:get).twice.and_return canned_response
57
- checkpoint_client.find_identities([1, 2])
58
- checkpoint_client.find_identities([1, 2])
59
- end
60
- end
61
- end