Class: ConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubbedService

Inherits:
Object
  • Object
show all
Includes:
Support::DependencyContainer::Import
Defined in:
lib/convenient_service/rspec/helpers/classes/stub_service/entities/stubbed_service.rb

Instance Method Summary collapse

Methods included from Support::DependencyContainer::Import

import

Constructor Details

#initialize(service_class:) ⇒ void

Parameters:

  • service_class (Class)


28
29
30
31
# File 'lib/convenient_service/rspec/helpers/classes/stub_service/entities/stubbed_service.rb', line 28

def initialize(service_class:)
  @service_class = service_class
  @arguments = Support::Arguments.null_arguments
end

Instance Method Details

#to(result_spec) ⇒ ConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubService

Parameters:

Returns:

  • (ConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubService)


55
56
57
58
59
60
61
62
63
# File 'lib/convenient_service/rspec/helpers/classes/stub_service/entities/stubbed_service.rb', line 55

def to(result_spec)
  @result_spec = result_spec

  service_class.commit_config!(trigger: Constants::Triggers::STUB_SERVICE)

  commands.SetServiceStubbedResult[service: service_class, arguments: arguments, result: result_value]

  self
end

#with_argumentsConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubService

Returns:

  • (ConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubService)


36
37
38
39
40
# File 'lib/convenient_service/rspec/helpers/classes/stub_service/entities/stubbed_service.rb', line 36

def with_arguments(...)
  @arguments = Support::Arguments.new(...)

  self
end

#without_argumentsConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubService

Returns:

  • (ConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubService)


45
46
47
48
49
# File 'lib/convenient_service/rspec/helpers/classes/stub_service/entities/stubbed_service.rb', line 45

def without_arguments
  @arguments = Support::Arguments.null_arguments

  self
end