Method: NamedTests#special_status_message

Defined in:
src/ruby/pb/test/client.rb

#special_status_messageObject



652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
# File 'src/ruby/pb/test/client.rb', line 652

def special_status_message
  code = GRPC::Core::StatusCodes::UNKNOWN
  message = "\t\ntest with whitespace\r\nand Unicode BMP ☺ and non-BMP 😈\t\n"
  req = SimpleRequest.new(
    response_status: EchoStatus.new(code: code, message: message))
  begin
    resp = @stub.unary_call(req)
    fail AssertionError, "GRPC::Unknown should have been raised."
  rescue GRPC::Unknown => e
    if e.details.force_encoding("UTF-8") != message
      fail AssertionError,
        "Expected message #{message}. Received: #{e.details}"
    end
  end
end