gruf-rspec 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: d1796bb825639ddd8df3ab127a6a2cf03e5976f0d12dca68b8a74a24332faf2e
4
- data.tar.gz: 8423df9c7ca13a86db3933cbff4a65174a13cbbab91a14185398e5afedd7cfd1
3
+ metadata.gz: d8d0d67cd2d8e98f3df81aa980be153313ccaaa01381d603f34dac2b7acdd9c9
4
+ data.tar.gz: 9efd36045c83aeaed1815b463afa2c10b7bb14190604f1685cac6e0a89c16756
5
5
  SHA512:
6
- metadata.gz: 5f875ab023f68ff4ce0a280db9487a0a265ee872c518e929fd1cd64676207d8493a0ba4f1fcba5f44f2e507523cef29ddaeefd9a24c9fcc9a58ee710c20cac69
7
- data.tar.gz: 68ec5d8b6099362e4b06e7bd527d678dc029aa52559911903c6c48386b5c28c2c0d7e4736482f49f9cdb8c93f62774594facde57e372f61d42abcabed93a9024
6
+ metadata.gz: 533a16373dfb91ccc3587194064a0be3c5108513683957f1be0d918fb6eb7d7785a4a2c2e31c1d0cba5595ccf82abf62b2df5b1c1c84f62c52f3d72fd8de7f10
7
+ data.tar.gz: 1da2b6434529984d65bd04a3faf461bd5774a5719cf38d3bdd6b4be26864fbd995d5e387d4c07d5f5c2c4affa3f46bcd9eb6ee9b545c77c5b85e78e0129fc2ca
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@ Changelog for the gruf-rspec gem.
2
2
 
3
3
  ### Pending release
4
4
 
5
+ ### 0.1.3
6
+
7
+ * Add ability to include metadata in rpc calls
8
+
5
9
  ### 0.1.2
6
10
 
7
11
  * Fix issue with RSPEC_NAMESPACE conflicts with other gems
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # gruf-rspec
2
2
 
3
- [![Build Status](https://travis-ci.com/bigcommerce/gruf-rspec.svg?token=D3Cc4LCF9BgpUx4dpPpv&branch=master)](https://travis-ci.com/bigcommerce/gruf-rspec) [![Gem Version](https://badge.fury.io/rb/gruf-rspec.svg)](https://badge.fury.io/rb/gruf-rspec) [![Documentation](https://inch-ci.org/github/bigcommerce/gruf-rspec.svg?branch=master)](https://inch-ci.org/github/bigcommerce/gruf-rspec?branch=master)
3
+ [![CircleCI](https://circleci.com/gh/bigcommerce/gruf-rspec/tree/master.svg?style=svg)](https://circleci.com/gh/bigcommerce/gruf-rspec/tree/master) [![Gem Version](https://badge.fury.io/rb/gruf-rspec.svg)](https://badge.fury.io/rb/gruf-rspec) [![Documentation](https://inch-ci.org/github/bigcommerce/gruf-rspec.svg?branch=master)](https://inch-ci.org/github/bigcommerce/gruf-rspec?branch=master)
4
4
 
5
5
  Assistance helpers and custom type for easy testing [Gruf](https://github.com/bigcommerce/gruf) controllers with
6
6
  [RSpec](https://github.com/rspec/rspec).
@@ -22,7 +22,8 @@ Note that this gem requires at least Gruf 2.5.1+ and RSpec 3.8+.
22
22
  ## Usage
23
23
 
24
24
  * Add a test for a Gruf controller in `spec/rpc`
25
- * Run the `run_rpc` method with two args: The gRPC method name, and the request object
25
+ * Run the `run_rpc` method with three args: The gRPC method name, the request object
26
+ and the active_call_options. The third argument is optional.
26
27
  * Validate the response
27
28
 
28
29
  ## Example
@@ -46,9 +47,12 @@ To test it, you'd create `spec/rpc/thing_controller_spec.rb`:
46
47
  describe ThingController do
47
48
  describe '.get_thing' do
48
49
  let(:request_proto) { Rpc::GetThingRequest.new(id: rand(1..100)) }
49
-
50
- subject { run_rpc(:GetThing, request_proto) }
51
-
50
+ let(:metadata) {
51
+ { 'user_id' => 'axj42i' }
52
+ }
53
+
54
+ subject { run_rpc(:GetThing, request_proto, active_call_options: { metadata: metadata }) }
55
+
52
56
  it 'will return the thing' do
53
57
  expect(subject).to be_a(Rpc::GetThingResponse)
54
58
  expect(subject.id).to eq request_proto.id
data/lib/gruf/rspec.rb CHANGED
@@ -45,12 +45,12 @@ GRUF_RSPEC_RUNNER.configure do |config|
45
45
  end
46
46
 
47
47
  config.before(:each, type: :gruf_controller) do
48
- define_singleton_method :run_rpc do |method_name, request, &block|
48
+ define_singleton_method :run_rpc do |method_name, request, active_call_options: {}, &block|
49
49
  @gruf_controller = described_class.new(
50
50
  method_key: method_name.to_s.underscore.to_sym,
51
51
  service: grpc_bound_service,
52
52
  rpc_desc: grpc_bound_service.rpc_descs[method_name.to_sym],
53
- active_call: grpc_active_call,
53
+ active_call: grpc_active_call(active_call_options),
54
54
  message: request
55
55
  )
56
56
  resp = @gruf_controller.call(@gruf_controller.request.method_key)
@@ -15,6 +15,6 @@
15
15
  #
16
16
  module Gruf
17
17
  module Rspec
18
- VERSION = '0.1.2'.freeze
18
+ VERSION = '0.1.3'.freeze
19
19
  end
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gruf-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun McCormick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-13 00:00:00.000000000 Z
11
+ date: 2019-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
126
  requirements: []
127
- rubygems_version: 3.0.2
127
+ rubygems_version: 3.0.6
128
128
  signing_key:
129
129
  specification_version: 4
130
130
  summary: RSpec assistance library for gruf