module ProtoPharm::RSpec::Matchers

Public Instance Methods

endpoint() click to toggle source
# File lib/proto_pharm/rspec/matchers/have_received_rpc.rb, line 40
def endpoint
  @endpoint ||= inspect_rpc(service_reference, endpoint_reference)
end
ensure_valid_proto_type!(expected_proto) click to toggle source
# File lib/proto_pharm/rspec/matchers/have_received_rpc.rb, line 60
def ensure_valid_proto_type!(expected_proto)
  raise InvalidProtoType, "Invalid proto type #{expected_proto.class} for #{grpc_path}, expected #{input_type}" if expected_proto.present? && expected_proto.class != input_type
end
expected_request_proto() click to toggle source
# File lib/proto_pharm/rspec/matchers/have_received_rpc.rb, line 52
def expected_request_proto
  return if expected_proto.nil? && expected_kwargs.nil?

  ensure_valid_proto_type!(expected_proto)

  @expected_request_proto ||= expected_proto.presence || input_type.new(**expected_kwargs)
end
matching_request_stubs() click to toggle source
# File lib/proto_pharm/rspec/matchers/have_received_rpc.rb, line 48
def matching_request_stubs
  @matching_request_stubs ||= ProtoPharm.stub_registry.all_requests_matching(grpc_path, expected_request_proto)
end
received_request_stubs() click to toggle source
# File lib/proto_pharm/rspec/matchers/have_received_rpc.rb, line 44
def received_request_stubs
  matching_request_stubs.select { |stub| stub.received_count > 0 }
end
with_parameters_description() click to toggle source
# File lib/proto_pharm/rspec/matchers/have_received_rpc.rb, line 64
def with_parameters_description
  return if expected_request_proto.blank?

  " with request #{expected_request_proto.inspect}"
end