Class: FailingService

Inherits:
Object
  • Object
show all
Includes:
GRPC::GenericService
Defined in:
src/ruby/spec/generic/rpc_server_spec.rb

Overview

A test service with an implementation that fails with BadStatus

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from GRPC::GenericService

included, underscore

Constructor Details

#initialize(_default_var = 'ignored') ⇒ FailingService

Returns a new instance of FailingService.



95
96
97
98
99
# File 'src/ruby/spec/generic/rpc_server_spec.rb', line 95

def initialize(_default_var = 'ignored')
  @details = 'app error'
  @code = 101
  @md = { 'failed_method' => 'an_rpc' }
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



93
94
95
# File 'src/ruby/spec/generic/rpc_server_spec.rb', line 93

def code
  @code
end

#detailsObject (readonly)

Returns the value of attribute details.



93
94
95
# File 'src/ruby/spec/generic/rpc_server_spec.rb', line 93

def details
  @details
end

#mdObject (readonly)

Returns the value of attribute md.



93
94
95
# File 'src/ruby/spec/generic/rpc_server_spec.rb', line 93

def md
  @md
end

Instance Method Details

#an_rpc(_req, _call) ⇒ Object



101
102
103
# File 'src/ruby/spec/generic/rpc_server_spec.rb', line 101

def an_rpc(_req, _call)
  fail GRPC::BadStatus.new(@code, @details, @md)
end