A VCR-like test helper for GRPC clients.
# in some test initializer
GCR.cassette_dir = Rails.root.join("test/fixtures/my_grpc_service")
GCR.stub = MyGRPCServer.stub
# in your test code
test "MyController#index works" do
GCR.with_cassette("some cassette name") do
MyGRPCServer.do_something
end
end
To not save empty requests (for instance when error occur), set save_empty_requests
as false
.
GCR.save_empty_requests = false
To run tests:
bundle exec rake