protobuf-rspec 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -133,7 +133,7 @@ module Protobuf
133
133
  #
134
134
  # Asserting the request object can be done one of two ways: direct or explicit. If you would like to directly test
135
135
  # the object that is given as a request you should provide a :request object as part of the cb_mocks third parameter hash.
136
- # Alternatively you can do an explicit assertion by providing a block to mock_remote_service. The block will be yielded with
136
+ # Alternatively you can do an explicit assertion by providing a block to mock_rpc. The block will be yielded with
137
137
  # the request object as its only parameter. This allows you to perform your own assertions on the request object
138
138
  # (e.g. only check a few of the fields in the request). Also note that if a :request param is given in the third param,
139
139
  # the block will be ignored.
@@ -153,7 +153,7 @@ module Protobuf
153
153
  #
154
154
  # # spec
155
155
  # it 'verifies the on_success method behaves correctly' do
156
- # mock_remote_service(Proto::UserService, :client, response: mock('response_mock', status: 'success'))
156
+ # mock_rpc(Proto::UserService, :client, response: mock('response_mock', status: 'success'))
157
157
  # create_user(request).should eq('success')
158
158
  # end
159
159
  #
@@ -173,7 +173,7 @@ module Protobuf
173
173
  #
174
174
  # # spec
175
175
  # it 'verifies the on_success method behaves correctly' do
176
- # mock_remote_service(Proto::UserService, :client, error: mock('error_mock', message: 'this is an error message'))
176
+ # mock_rpc(Proto::UserService, :client, error: mock('error_mock', message: 'this is an error message'))
177
177
  # ErrorReporter.should_receive(:report).with('this is an error message')
178
178
  # create_user(request).should eq('error')
179
179
  # end
@@ -191,7 +191,7 @@ module Protobuf
191
191
  # # spec
192
192
  # it 'verifies the request is built correctly' do
193
193
  # expected_request = ... # some expectation
194
- # mock_remote_service(Proto::UserService, :client, request: expected_request)
194
+ # mock_rpc(Proto::UserService, :client, request: expected_request)
195
195
  # create_user(request)
196
196
  # end
197
197
  #
@@ -207,7 +207,7 @@ module Protobuf
207
207
  #
208
208
  # # spec
209
209
  # it 'verifies the request is built correctly' do
210
- # mock_remote_service(Proto::UserService, :client) do |given_request|
210
+ # mock_rpc(Proto::UserService, :client) do |given_request|
211
211
  # given_request.field1.should eq 'rainbows'
212
212
  # given_request.field2.should eq 'ponies'
213
213
  # end
@@ -216,16 +216,10 @@ module Protobuf
216
216
  #
217
217
  # @param [Class] klass the service class constant
218
218
  # @param [Symbol, String] method a symbol or string denoting the method to call
219
- # @param [Hash] cb_mocks provides expectation objects to invoke on_success (with :response), on_failure (with :error), and the request object (:request)
219
+ # @param [Hash] callbacks provides expectation objects to invoke on_success (with :response), on_failure (with :error), and the request object (:request)
220
220
  # @param [Block] assert_block when given, will be invoked with the request message sent to the client method
221
221
  # @return [Mock] the stubbed out client mock
222
- def mock_remote_service(klass, method, cb_mocks={}, &assert_block)
223
- self.class.subject_service { klass }
224
- mock_rpc(method, cb_mocks, &assert_block)
225
- end
226
- alias_method :mock_service, :mock_remote_service
227
-
228
- def mock_rpc(method, callbacks = {}, &assert_block)
222
+ def mock_rpc(klass, method, callbacks={}, &assert_block)
229
223
  client = double('Client', :on_success => true, :on_failure => true)
230
224
  client.stub(method).and_yield(client)
231
225
 
@@ -246,6 +240,8 @@ module Protobuf
246
240
 
247
241
  client
248
242
  end
243
+ alias_method :mock_service, :mock_rpc
244
+ alias_method :mock_remote_service, :mock_rpc
249
245
 
250
246
  end
251
247
 
@@ -1,5 +1,5 @@
1
1
  module Protobuf
2
2
  module RSpec
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protobuf-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-25 00:00:00.000000000Z
12
+ date: 2012-10-26 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: protobuf
16
- requirement: &2154800360 !ruby/object:Gem::Requirement
16
+ requirement: &2154950180 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2154800360
24
+ version_requirements: *2154950180
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &2154799860 !ruby/object:Gem::Requirement
27
+ requirement: &2154949680 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '2.8'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2154799860
35
+ version_requirements: *2154949680
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &2154799420 !ruby/object:Gem::Requirement
38
+ requirement: &2154949300 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2154799420
46
+ version_requirements: *2154949300
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: yard
49
- requirement: &2154798860 !ruby/object:Gem::Requirement
49
+ requirement: &2154925960 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0.7'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2154798860
57
+ version_requirements: *2154925960
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: redcarpet
60
- requirement: &2154798360 !ruby/object:Gem::Requirement
60
+ requirement: &2154925440 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '2.1'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2154798360
68
+ version_requirements: *2154925440
69
69
  description: Protobuf RSpec helpers for testing services and clients. Meant to be
70
70
  used with the protobuf gem. Decouple external services/clients from each other using
71
71
  the given helper methods.
@@ -97,7 +97,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
97
  version: '0'
98
98
  segments:
99
99
  - 0
100
- hash: 3890569250292723612
100
+ hash: 2223780834525857114
101
101
  required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  none: false
103
103
  requirements:
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  segments:
108
108
  - 0
109
- hash: 3890569250292723612
109
+ hash: 2223780834525857114
110
110
  requirements: []
111
111
  rubyforge_project: protobuf-rspec
112
112
  rubygems_version: 1.8.15