rspec-twirp 0.3.0 → 0.4.0

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: 7a9027f86450d9e045705304d1d8e590b51a733269938e83ca5ae098a90018d4
4
- data.tar.gz: dca42845c93b814878cf24842320583ddf6dbce3b0d266cd897a58500cf31a31
3
+ metadata.gz: 20ecb58d57f97e2f56012800ab921838dd305710d16656ae4db713374289d4bd
4
+ data.tar.gz: d30cde8ba8696b13843737c74fba1d28512b1a882509a514462f0cefbf165584
5
5
  SHA512:
6
- metadata.gz: 98d362457d71269cf64bffa1fe0b1fe00e173fe68df88e12cf0af20aa1030d518e031415d005050209b070095c36a6eac454e1bdba740661a090ce3be90cfa15
7
- data.tar.gz: a0923b782b8568198fb267cd1e3bc6192bb032b0a7e746be478a4e8d66317ccc81652487f6f3b442847c6c2946b2e398f25b60682c0cc6b1c794c556837d0978
6
+ metadata.gz: 5713899cae185f81e937b60e033064eaaf2247b08782c0176d4111fc428e41052379f6db91d2293fffca0213cd3a5f7d1bed8514dd1a7d5d440943512e46a5c5
7
+ data.tar.gz: aff9016263fe227d186326eeb17a6280bf16710bc0b3d6ea50df2d1446fa5b1b2fb17cf6bc4dc693990e9d104797296d088be0f19c5a6bb453fa8b9816bf96b0
data/CHANGELOG.md ADDED
@@ -0,0 +1,37 @@
1
+ ### v0.4.0 (2023-02-12)
2
+ - support for twirp 1.10
3
+
4
+ ### v0.3.1 (2022-12-15)
5
+ - simplify dependencies
6
+ - action permissions
7
+ - dependabot automation
8
+ - lockfile
9
+ - builds
10
+
11
+ ### v0.3.0 (2022-11-16)
12
+ - diffable error matching
13
+ - extract request stubbing
14
+
15
+ ### v0.2.0 (2022-10-06)
16
+ - ruby 3 fixes
17
+ - mock_client
18
+ - improved make_request spec
19
+ - upgrade mock connection
20
+ - inline request matcher
21
+ - request matcher and_return
22
+ - make request matcher
23
+ - mock_twirp_connection
24
+ - twirp message matcher simplification
25
+
26
+ ### v0.1.0 (2022-09-24)
27
+ - Update README.md
28
+ - client response matcher
29
+ - improved fail messages
30
+ - response matcher
31
+ - error matcher
32
+ - improve regex match
33
+ - be_a_twirp_request
34
+
35
+ ### v0.0.1 (2022-05-24)
36
+ - init
37
+
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "twirp", ENV["TWIRP_VERSION"]
4
+
5
+ # TODO: remove hack/fix after twirp 1.10.1
6
+ # https://github.com/github/twirp-ruby/commit/aa4000f8ea9ff84447060ab8a7f425ed70e0bf56
7
+ gem "rack"
8
+
9
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,66 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rspec-twirp (0.4.0)
5
+ google-protobuf (>= 3)
6
+ rspec-expectations (>= 3)
7
+ rspec-protobuf (>= 0.2)
8
+ twirp (>= 1)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ byebug (11.1.3)
14
+ codecov (0.2.12)
15
+ json
16
+ simplecov
17
+ diff-lcs (1.5.0)
18
+ docile (1.4.0)
19
+ faraday (2.7.4)
20
+ faraday-net_http (>= 2.0, < 3.1)
21
+ ruby2_keywords (>= 0.0.4)
22
+ faraday-net_http (3.0.2)
23
+ google-protobuf (3.21.12)
24
+ json (2.6.3)
25
+ rack (3.0.4.1)
26
+ rspec (3.12.0)
27
+ rspec-core (~> 3.12.0)
28
+ rspec-expectations (~> 3.12.0)
29
+ rspec-mocks (~> 3.12.0)
30
+ rspec-core (3.12.0)
31
+ rspec-support (~> 3.12.0)
32
+ rspec-expectations (3.12.2)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.12.0)
35
+ rspec-mocks (3.12.1)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.12.0)
38
+ rspec-protobuf (0.2.2)
39
+ google-protobuf (>= 3)
40
+ rspec-expectations (>= 3)
41
+ rspec-support (3.12.0)
42
+ ruby2_keywords (0.0.5)
43
+ simplecov (0.22.0)
44
+ docile (~> 1.1)
45
+ simplecov-html (~> 0.11)
46
+ simplecov_json_formatter (~> 0.1)
47
+ simplecov-html (0.12.3)
48
+ simplecov_json_formatter (0.1.4)
49
+ twirp (1.10.0)
50
+ faraday (< 3)
51
+ google-protobuf (~> 3.0, >= 3.7.0)
52
+
53
+ PLATFORMS
54
+ ruby
55
+
56
+ DEPENDENCIES
57
+ byebug
58
+ codecov
59
+ rack
60
+ rspec (>= 3)
61
+ rspec-twirp!
62
+ simplecov
63
+ twirp
64
+
65
+ BUNDLED WITH
66
+ 2.3.9
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Daniel Pepper
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ RSpec::Twirp
2
+ ======
3
+ ![Gem](https://img.shields.io/gem/dt/rspec-twirp?style=plastic)
4
+ [![codecov](https://codecov.io/gh/dpep/rspec-twirp/branch/main/graph/badge.svg)](https://codecov.io/gh/dpep/rspec-twirp)
5
+
6
+ Twirp RSpec matchers.
7
+
8
+
9
+ ```ruby
10
+ require "rspec/twirp"
11
+
12
+ it "matches Twirp responses" do
13
+ is_expected.to be_a_twirp_response
14
+ is_expected.to be_a_twirp_response(count: 3)
15
+ is_expected.to be_a_twirp_response.with_error(:not_found)
16
+ end
17
+
18
+ it "matches Twirp messages" do
19
+ is_expected.to be_a_twirp_message
20
+ is_expected.to be_a_twirp_message(MyRequest)
21
+ is_expected.to be_a_twirp_message(name: /^B/)
22
+ end
23
+
24
+ it "matches Twirp errors" do
25
+ is_expected.to be_a_twirp_error
26
+ is_expected.to be_a_twirp_error(:internal)
27
+ end
28
+ ```
29
+
30
+ To stub Twirp requests, see [webmock-twirp](https://github.com/dpep/webmock-twirp).
31
+
32
+
33
+ ----
34
+ ## Contributing
35
+
36
+ Yes please :)
37
+
38
+ 1. Fork it
39
+ 1. Create your feature branch (`git checkout -b my-feature`)
40
+ 1. Ensure the tests pass (`bundle exec rspec`)
41
+ 1. Commit your changes (`git commit -am 'awesome new feature'`)
42
+ 1. Push your branch (`git push origin my-feature`)
43
+ 1. Create a Pull Request
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module Twirp
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
data/lib/rspec/twirp.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require "google/protobuf"
2
- require "rspec"
2
+ require "rspec/expectations"
3
3
  require "rspec/protobuf"
4
4
  require "twirp"
5
5
 
@@ -0,0 +1,23 @@
1
+ require_relative "lib/rspec/twirp/version"
2
+ package = RSpec::Twirp
3
+
4
+ Gem::Specification.new do |s|
5
+ s.authors = ["Daniel Pepper"]
6
+ s.description = "Twirp RSpec matchers"
7
+ s.files = `git ls-files * ':!:spec'`.split("\n")
8
+ s.homepage = "https://github.com/dpep/rspec-twirp"
9
+ s.license = "MIT"
10
+ s.name = File.basename(__FILE__).split(".")[0]
11
+ s.summary = package.to_s
12
+ s.version = package.const_get "VERSION"
13
+
14
+ s.add_dependency "google-protobuf", ">= 3"
15
+ s.add_dependency "rspec-expectations", ">= 3"
16
+ s.add_dependency "rspec-protobuf", ">= 0.2"
17
+ s.add_dependency "twirp", ">= 1"
18
+
19
+ s.add_development_dependency "byebug"
20
+ s.add_development_dependency "codecov"
21
+ s.add_development_dependency "rspec", ">= 3"
22
+ s.add_development_dependency "simplecov"
23
+ end
data/service.rb ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "google/protobuf"
4
+ require "rack"
5
+ require "twirp"
6
+ require "webrick"
7
+ require "./spec/support/hello_world"
8
+
9
+ server = WEBrick::HTTPServer.new(Port: 3000)
10
+
11
+ handler = HelloWorldHandler.new
12
+ service = HelloWorldService.new(handler)
13
+ path_prefix = "/twirp/" + service.full_name
14
+ server.mount path_prefix, Rack::Handler::WEBrick, service
15
+
16
+ handler = GoodbyeHandler.new
17
+ service = GoodbyeService.new(handler)
18
+ path_prefix = "/twirp/" + service.full_name
19
+ server.mount path_prefix, Rack::Handler::WEBrick, service
20
+
21
+ server.start
22
+
23
+ # client = HelloWorldClient.new("http://localhost:3000/twirp")
24
+ # client = GoodbyeClient.new("http://localhost:3000/twirp")
25
+ # resp = client.hello(name: "World")
26
+ # puts resp.data
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-twirp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Pepper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-16 00:00:00.000000000 Z
11
+ date: 2023-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rspec
28
+ name: rspec-expectations
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '3'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '3'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: simplecov
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -114,16 +128,20 @@ executables: []
114
128
  extensions: []
115
129
  extra_rdoc_files: []
116
130
  files:
131
+ - CHANGELOG.md
132
+ - Gemfile
133
+ - Gemfile.lock
134
+ - LICENSE.txt
135
+ - README.md
117
136
  - lib/rspec-twirp.rb
118
137
  - lib/rspec/twirp.rb
119
138
  - lib/rspec/twirp/error_matcher.rb
120
139
  - lib/rspec/twirp/message_matcher.rb
121
140
  - lib/rspec/twirp/response_matcher.rb
122
141
  - lib/rspec/twirp/version.rb
123
- - spec/error_spec.rb
124
- - spec/message_spec.rb
125
- - spec/response_spec.rb
126
- homepage: https://github.com/dpep/rspec-twirp_rb
142
+ - rspec-twirp.gemspec
143
+ - service.rb
144
+ homepage: https://github.com/dpep/rspec-twirp
127
145
  licenses:
128
146
  - MIT
129
147
  metadata: {}
@@ -145,8 +163,5 @@ requirements: []
145
163
  rubygems_version: 3.3.7
146
164
  signing_key:
147
165
  specification_version: 4
148
- summary: Gem::Specification::RSpec::Twirp
149
- test_files:
150
- - spec/error_spec.rb
151
- - spec/message_spec.rb
152
- - spec/response_spec.rb
166
+ summary: RSpec::Twirp
167
+ test_files: []
data/spec/error_spec.rb DELETED
@@ -1,159 +0,0 @@
1
- describe "be_a_twirp_error" do
2
- subject(:error) { Twirp::Error.new(code, msg, meta) }
3
-
4
- let(:code) { :not_found }
5
- let(:msg) { "Not Found" }
6
- let(:meta) { { is_meta: "true" } }
7
-
8
- it { is_expected.to be_a_twirp_error }
9
-
10
- it "is composable" do
11
- expect(e: error).to include(e: a_twirp_error)
12
- end
13
-
14
- it "catches type mismatches" do
15
- expect {
16
- expect(Object).to be_a_twirp_error
17
- }.to fail_with /to be a Twirp::Error/
18
- end
19
-
20
- describe "status matches" do
21
- it { is_expected.to be_a_twirp_error(404) }
22
-
23
- it "catches mismatches" do
24
- expect {
25
- is_expected.to be_a_twirp_error(400)
26
- }.to fail_including(
27
- "to have status 400",
28
- "found: 404",
29
-
30
- # diff
31
- "-:code => :invalid_argument,",
32
- "+:code => :not_found,",
33
- )
34
- end
35
-
36
- it "catches erroneous codes" do
37
- expect {
38
- is_expected.to be_a_twirp_error(123)
39
- }.to raise_error(ArgumentError, /invalid error/)
40
- end
41
- end
42
-
43
- describe "code matches" do
44
- it { is_expected.to be_a_twirp_error(:not_found) }
45
-
46
- it "catches mismatches" do
47
- expect {
48
- is_expected.to be_a_twirp_error(:unknown)
49
- }.to fail_including(
50
- "to have code `:unknown`",
51
- "found: :not_found",
52
-
53
- # diff
54
- "-:code => :unknown,",
55
- "+:code => :not_found,",
56
- )
57
- end
58
-
59
- it "catches erroneous codes" do
60
- expect {
61
- is_expected.to be_a_twirp_error(:not_a_valid_code)
62
- }.to raise_error(ArgumentError, /:not_a_valid_code/)
63
- end
64
- end
65
-
66
- describe "msg matches" do
67
- it { is_expected.to be_a_twirp_error("Not Found") }
68
-
69
- it "supports Regex matches" do
70
- is_expected.to be_a_twirp_error(/Not/)
71
- end
72
-
73
- it "catches mismatches" do
74
- expect {
75
- is_expected.to be_a_twirp_error("Not")
76
- }.to fail_including(
77
- 'to have msg "Not"',
78
- 'found: "Not Found"',
79
-
80
- # diff
81
- '-:msg => "Not",',
82
- '+:msg => "Not Found",',
83
- )
84
-
85
- expect {
86
- is_expected.to be_a_twirp_error(/Nope/)
87
- }.to fail_including(
88
- # diff
89
- '-:msg => /Nope/,',
90
- '+:msg => "Not Found",',
91
- )
92
- end
93
- end
94
-
95
- describe "meta matches" do
96
- it { is_expected.to be_a_twirp_error(is_meta: "true") }
97
- it { is_expected.to be_a_twirp_error(is_meta: /^t/) }
98
-
99
- it "catches mismatches" do
100
- expect {
101
- is_expected.to be_a_twirp_error(is_meta: "false")
102
- }.to fail_including(
103
- "to have meta",
104
-
105
- # diff
106
- '-:meta => {:is_meta=>"false"},',
107
- '+:meta => {:is_meta=>"true"},',
108
- )
109
-
110
- expect {
111
- is_expected.to be_a_twirp_error(not_meta: "")
112
- }.to fail_with /to have meta.*not_meta/
113
- end
114
-
115
- it "catches type errors" do
116
- expect {
117
- is_expected.to be_a_twirp_error(is_meta: true)
118
- }.to raise_error(ArgumentError, /meta values must be Strings/)
119
- end
120
- end
121
-
122
- describe "instance matches" do
123
- it "matches similar looking instances" do
124
- error = Twirp::Error.new(code, msg, meta)
125
- is_expected.to be_a_twirp_error(error)
126
- end
127
-
128
- it "catches mismatches" do
129
- # no meta
130
- expect {
131
- is_expected.to be_a_twirp_error(Twirp::Error.not_found("Not Found"))
132
- }.to fail
133
-
134
- expect {
135
- is_expected.to be_a_twirp_error(Twirp::Error.internal("boom"))
136
- }.to fail
137
- end
138
- end
139
-
140
- describe "multi matches" do
141
- it { is_expected.to be_a_twirp_error(:not_found, "Not Found") }
142
- it { is_expected.to be_a_twirp_error(:not_found, /Not/) }
143
- it { is_expected.to be_a_twirp_error(:not_found, is_meta: "true") }
144
-
145
- it "catches mismatches" do
146
- expect {
147
- is_expected.to be_a_twirp_error(:unknown, "Not Found")
148
- }.to fail_with /unknown/
149
-
150
- expect {
151
- is_expected.to be_a_twirp_error(:not_found, "Nope")
152
- }.to fail_with /Nope/
153
-
154
- expect {
155
- is_expected.to be_a_twirp_error(:not_found, is_meta: "false")
156
- }.to fail_with /false/
157
- end
158
- end
159
- end
data/spec/message_spec.rb DELETED
@@ -1,69 +0,0 @@
1
- describe "be_a_twirp_message" do
2
- subject(:request) { HelloRequest.new(**attrs) }
3
-
4
- let(:attrs) { {} }
5
-
6
- it { is_expected.to be_a_twirp_message }
7
-
8
- it "works with responses also" do
9
- expect(HelloResponse.new).to be_a_twirp_message
10
- end
11
-
12
- it "supports compound matchers" do
13
- expect([ request ]).to include(a_twirp_message)
14
- end
15
-
16
- it "does not match non-twirp subjects" do
17
- expect(Object).not_to be_a_twirp_message
18
- end
19
-
20
- it "matches a specific message type" do
21
- is_expected.to be_a_twirp_message(HelloRequest)
22
- end
23
-
24
- it "catches type mismatches" do
25
- is_expected.not_to be_a_twirp_message(GoodbyeRequest)
26
- end
27
-
28
- it "catches erroneous message types" do
29
- expect {
30
- is_expected.to be_a_twirp_message(Object)
31
- }.to raise_error(TypeError, /Object/)
32
- end
33
-
34
- context "with attributes" do
35
- let(:attrs) { { name: "Bob", count: 3 } }
36
-
37
- it "can match attributes" do
38
- is_expected.to be_a_twirp_message(HelloRequest, **attrs)
39
- end
40
-
41
- it "supports regex matches" do
42
- is_expected.to be_a_twirp_message(name: /^B/)
43
- end
44
-
45
- it "supports range matches" do
46
- is_expected.to be_a_twirp_message(count: 1..5)
47
- end
48
-
49
- it "catches mismatches" do
50
- expect {
51
- is_expected.to be_a_twirp_message(GoodbyeRequest, name: "Bob")
52
- }.to fail_with /message of type/
53
-
54
- is_expected.not_to be_a_twirp_message(name: "nope")
55
-
56
- is_expected.not_to be_a_twirp_message(name: /no/)
57
-
58
- is_expected.not_to be_a_twirp_message(count: 1)
59
- end
60
-
61
- it "catches erroneous attribute matches" do
62
- is_expected.not_to be_a_twirp_message(namezzz: "Bob")
63
- end
64
-
65
- it "handles type mismatches" do
66
- is_expected.not_to be_a_twirp_message(name: 123)
67
- end
68
- end
69
- end
@@ -1,89 +0,0 @@
1
- describe "be_a_twirp_response" do
2
- context "with a response" do
3
- subject { Twirp::ClientResp.new(response, nil) }
4
-
5
- let(:response) { GoodbyeResponse.new }
6
-
7
- it { is_expected.to be_a_twirp_response }
8
-
9
- it "handles non-twirp response" do
10
- expect(Object).not_to be_a_twirp_response
11
- end
12
-
13
- context "with attributes" do
14
- let(:response) { GoodbyeResponse.new(**attrs) }
15
- let(:attrs) { { message: "bye", name: "Bob" } }
16
-
17
- it "can match attributes" do
18
- is_expected.to be_a_twirp_response(**attrs)
19
- end
20
-
21
- it "supports regex matches" do
22
- is_expected.to be_a_twirp_response(name: /^B/)
23
- end
24
-
25
- it "catches mismatches" do
26
- expect {
27
- is_expected.to be_a_twirp_response(name: "nope")
28
- }.to fail_including(
29
- '-:name => "nope",',
30
- '+:name => "Bob",',
31
- )
32
-
33
- expect {
34
- is_expected.to be_a_twirp_response(name: /no/)
35
- }.to fail_including(
36
- '-:name => /no/,',
37
- '+:name => "Bob",',
38
- )
39
- end
40
- end
41
- end
42
-
43
- context "with error" do
44
- subject { Twirp::ClientResp.new(nil, error) }
45
-
46
- let(:error) { Twirp::Error.new(code, msg, meta) }
47
- let(:code) { :not_found }
48
- let(:msg) { "Not Found" }
49
- let(:meta) { { is_meta: "true" } }
50
-
51
- it { is_expected.to be_a_twirp_response.with_error }
52
- it { is_expected.to be_a_twirp_response.with_error(code) }
53
- it { is_expected.to be_a_twirp_response.with_error(msg) }
54
- it { is_expected.to be_a_twirp_response.with_error(**meta) }
55
- it { is_expected.to be_a_twirp_response.with_error(/Not/) }
56
-
57
- it "catches mismatches" do
58
- expect {
59
- is_expected.to be_a_twirp_response.with_error(:internal)
60
- }.to fail_with /to have code `:internal`/
61
- end
62
- end
63
-
64
- context "with neither response nor error" do
65
- subject { Twirp::ClientResp.new(nil, nil) }
66
-
67
- it "fails the response match" do
68
- expect {
69
- is_expected.to be_a_twirp_response
70
- }.to fail_with /to have data/
71
- end
72
-
73
- it "fails the error match" do
74
- expect {
75
- is_expected.to be_a_twirp_response.with_error
76
- }.to fail_with /to have an error/
77
- end
78
- end
79
-
80
- context "with both response and error" do
81
- subject { Twirp::ClientResp.new(GoodbyeResponse.new, Twirp::Error.not_found("Not Found")) }
82
-
83
- it "does not permit both attr and error matching" do
84
- expect {
85
- is_expected.to be_a_twirp_response(name: "Bob").with_error
86
- }.to raise_error(ArgumentError, /but not both/)
87
- end
88
- end
89
- end