It reads nicely and it works well, but the wrinkle comes when the matcher doesn't work for some reason (most likely it's because I'm making changes to the request). Then it doesn't match and I get a confusing error saying real requests are not allowed. Even if I know what it's about and try to investigate, there's no way to inspect the request as written.
I find myself using the following pattern more:
GrpcMock.
stub_request("/hello.hello/Hello").
to_return do |request|
expect(request).to eq(Hello::HelloRequest.new(msg: 'hi'))
Hello::HelloResponse.new(msg: 'test')
end
It's slightly longer, but when something goes wrong it tells me exactly where.
Hi! First of all thanks for making this library!
This is not really an issue... I'm not sure what I'm trying to suggest, just want to put this out here in case it helps someone somehow.
I found the following pattern (from the README) surprisingly frustrating to maintain:
It reads nicely and it works well, but the wrinkle comes when the matcher doesn't work for some reason (most likely it's because I'm making changes to the request). Then it doesn't match and I get a confusing error saying real requests are not allowed. Even if I know what it's about and try to investigate, there's no way to inspect the request as written.
I find myself using the following pattern more:
It's slightly longer, but when something goes wrong it tells me exactly where.