Class: ConvenientService::RSpec::Helpers::Classes::StubService::Entities::ResultSpec
- Inherits:
-
Object
- Object
- ConvenientService::RSpec::Helpers::Classes::StubService::Entities::ResultSpec
- Defined in:
- lib/convenient_service/rspec/helpers/classes/stub_service/entities/result_spec.rb
Instance Method Summary collapse
- #==(other) ⇒ Boolean?
- #and_code(code) ⇒ ConvenientService::RSpec::Helpers::Classes::StubService::Entities::ResultSpec
- #and_data(data) ⇒ ConvenientService::RSpec::Helpers::Classes::StubService::Entities::ResultSpec
- #and_message(message) ⇒ ConvenientService::RSpec::Helpers::Classes::StubService::Entities::ResultSpec
- #calculate_value ⇒ Object
- #for(service_class) ⇒ ConvenientService::RSpec::Helpers::Classes::StubService::Entities::ResultSpec
- #initialize(status:, service_class: nil, chain: {}) ⇒ void constructor
- #with_code(code) ⇒ ConvenientService::RSpec::Helpers::Classes::StubService::Entities::ResultSpec
- #with_data(data) ⇒ ConvenientService::RSpec::Helpers::Classes::StubService::Entities::ResultSpec
- #with_message(message) ⇒ ConvenientService::RSpec::Helpers::Classes::StubService::Entities::ResultSpec
Constructor Details
#initialize(status:, service_class: nil, chain: {}) ⇒ void
20 21 22 23 24 |
# File 'lib/convenient_service/rspec/helpers/classes/stub_service/entities/result_spec.rb', line 20 def initialize(status:, service_class: nil, chain: {}) @status = status @service_class = service_class @chain = chain end |
Instance Method Details
#==(other) ⇒ Boolean?
108 109 110 111 112 113 114 115 116 |
# File 'lib/convenient_service/rspec/helpers/classes/stub_service/entities/result_spec.rb', line 108 def ==(other) return unless other.instance_of?(self.class) return false if status != other.status return false if service_class != other.service_class return false if chain != other.chain true end |
#and_code(code) ⇒ ConvenientService::RSpec::Helpers::Classes::StubService::Entities::ResultSpec
88 89 90 91 92 |
# File 'lib/convenient_service/rspec/helpers/classes/stub_service/entities/result_spec.rb', line 88 def and_code(code) chain[:code] = code self end |
#and_data(data) ⇒ ConvenientService::RSpec::Helpers::Classes::StubService::Entities::ResultSpec
68 69 70 71 72 |
# File 'lib/convenient_service/rspec/helpers/classes/stub_service/entities/result_spec.rb', line 68 def and_data(data) chain[:data] = data self end |
#and_message(message) ⇒ ConvenientService::RSpec::Helpers::Classes::StubService::Entities::ResultSpec
78 79 80 81 82 |
# File 'lib/convenient_service/rspec/helpers/classes/stub_service/entities/result_spec.rb', line 78 def () chain[:message] = self end |
#calculate_value ⇒ Object
100 101 102 |
# File 'lib/convenient_service/rspec/helpers/classes/stub_service/entities/result_spec.rb', line 100 def calculate_value service_class.__send__(status, **kwargs).copy(overrides: {kwargs: {stubbed_result: true}}) end |
#for(service_class) ⇒ ConvenientService::RSpec::Helpers::Classes::StubService::Entities::ResultSpec
30 31 32 |
# File 'lib/convenient_service/rspec/helpers/classes/stub_service/entities/result_spec.rb', line 30 def for(service_class) self.class.new(status: status, service_class: service_class, chain: chain) end |
#with_code(code) ⇒ ConvenientService::RSpec::Helpers::Classes::StubService::Entities::ResultSpec
58 59 60 61 62 |
# File 'lib/convenient_service/rspec/helpers/classes/stub_service/entities/result_spec.rb', line 58 def with_code(code) chain[:code] = code self end |
#with_data(data) ⇒ ConvenientService::RSpec::Helpers::Classes::StubService::Entities::ResultSpec
38 39 40 41 42 |
# File 'lib/convenient_service/rspec/helpers/classes/stub_service/entities/result_spec.rb', line 38 def with_data(data) chain[:data] = data self end |
#with_message(message) ⇒ ConvenientService::RSpec::Helpers::Classes::StubService::Entities::ResultSpec
48 49 50 51 52 |
# File 'lib/convenient_service/rspec/helpers/classes/stub_service/entities/result_spec.rb', line 48 def () chain[:message] = self end |