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.



47
48
49
50
51
# File 'src/ruby/spec/generic/rpc_server_spec.rb', line 47

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.



45
46
47
# File 'src/ruby/spec/generic/rpc_server_spec.rb', line 45

def code
  @code
end

#detailsObject (readonly)

Returns the value of attribute details.



45
46
47
# File 'src/ruby/spec/generic/rpc_server_spec.rb', line 45

def details
  @details
end

#mdObject (readonly)

Returns the value of attribute md.



45
46
47
# File 'src/ruby/spec/generic/rpc_server_spec.rb', line 45

def md
  @md
end

Instance Method Details

#an_rpc(_req, _call) ⇒ Object



53
54
55
# File 'src/ruby/spec/generic/rpc_server_spec.rb', line 53

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