convenient_service 0.20.0 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -4
- data/lib/convenient_service/aliases.rb +113 -1
- data/lib/convenient_service/common/plugins/aliases.rb +69 -0
- data/lib/convenient_service/common/plugins/can_have_callbacks/entities/type_collection.rb +2 -2
- data/lib/convenient_service/common/plugins/has_instance_proxy/entities/instance_proxy.rb +8 -8
- data/lib/convenient_service/common.rb +14 -0
- data/lib/convenient_service/config.rb +8 -0
- data/lib/convenient_service/core/aliases.rb +84 -0
- data/lib/convenient_service/dependencies/built_in.rb +15 -1
- data/lib/convenient_service/dependencies/only_queries.rb +0 -6
- data/lib/convenient_service/dependencies/queries/gems/minitest.rb +55 -0
- data/lib/convenient_service/dependencies/queries/gems/rspec.rb +1 -1
- data/lib/convenient_service/dependencies/queries/gems.rb +2 -0
- data/lib/convenient_service/dependencies/queries/ruby.rb +2 -2
- data/lib/convenient_service/dependencies/queries.rb +67 -16
- data/lib/convenient_service/dependencies.rb +6 -6
- data/lib/convenient_service/extras/alias.rb +4 -1
- data/lib/convenient_service/feature/configs/standard.rb +34 -13
- data/lib/convenient_service/feature/core.rb +41 -0
- data/lib/convenient_service/feature/plugins/aliases.rb +29 -0
- data/lib/convenient_service/feature/plugins/can_have_rspec_stubbed_entries/concern.rb +34 -0
- data/lib/convenient_service/{rspec/helpers/classes/stub_entry/entities.rb → feature/plugins/can_have_rspec_stubbed_entries.rb} +1 -2
- data/lib/convenient_service/feature/plugins/can_have_stubbed_entries/commands/delete_feature_stubbed_entry.rb +71 -0
- data/lib/convenient_service/feature/plugins/can_have_stubbed_entries/commands/fetch_all_features_stubbed_entries_cache.rb +16 -2
- data/lib/convenient_service/feature/plugins/can_have_stubbed_entries/commands/fetch_feature_stubbed_entries_cache.rb +1 -1
- data/lib/convenient_service/feature/plugins/can_have_stubbed_entries/commands.rb +2 -0
- data/lib/convenient_service/feature/plugins/can_have_stubbed_entries/concern.rb +23 -0
- data/lib/convenient_service/feature/plugins/can_have_stubbed_entries/entities/feature_stub.rb +123 -0
- data/lib/convenient_service/feature/plugins/can_have_stubbed_entries/entities/feature_unstub.rb +122 -0
- data/lib/convenient_service/feature/plugins/can_have_stubbed_entries/entities/value_mock.rb +118 -0
- data/lib/convenient_service/feature/plugins/can_have_stubbed_entries/entities/value_unmock.rb +88 -0
- data/lib/convenient_service/feature/plugins/can_have_stubbed_entries/entities.rb +12 -0
- data/lib/convenient_service/feature/plugins/can_have_stubbed_entries.rb +1 -14
- data/lib/convenient_service/feature/plugins/has_amazing_print_inspect/concern.rb +34 -0
- data/lib/convenient_service/feature/{configs/standard/commands.rb → plugins/has_amazing_print_inspect.rb} +1 -2
- data/lib/convenient_service/feature/plugins/has_awesome_print_inspect/concern.rb +34 -0
- data/lib/convenient_service/{rspec/helpers/classes/stub_service/entities.rb → feature/plugins/has_awesome_print_inspect.rb} +1 -2
- data/lib/convenient_service/feature/plugins/has_inspect/concern.rb +27 -0
- data/lib/convenient_service/{service/configs/standard/commands.rb → feature/plugins/has_inspect.rb} +1 -2
- data/lib/convenient_service/feature/plugins.rb +1 -0
- data/lib/convenient_service/feature.rb +16 -0
- data/lib/convenient_service/logger.rb +11 -12
- data/lib/convenient_service/rspec/helpers/classes.rb +0 -2
- data/lib/convenient_service/rspec/helpers/stub_entry.rb +23 -5
- data/lib/convenient_service/rspec/helpers/stub_service.rb +79 -11
- data/lib/convenient_service/rspec/matchers/classes/cache_its_value.rb +2 -1
- data/lib/convenient_service/rspec/matchers/classes/delegate_to.rb +3 -5
- data/lib/convenient_service/rspec/matchers/classes/include_config.rb +4 -0
- data/lib/convenient_service/service/configs/aliases.rb +42 -0
- data/lib/convenient_service/service/configs/standard/aliases.rb +24 -0
- data/lib/convenient_service/service/configs/standard/v1.rb +17 -0
- data/lib/convenient_service/service/configs/standard.rb +50 -25
- data/lib/convenient_service/service/core.rb +39 -0
- data/lib/convenient_service/service/plugins/aliases.rb +48 -0
- data/lib/convenient_service/service/plugins/can_have_rollbacks/middleware.rb +33 -2
- data/lib/convenient_service/service/plugins/can_have_rspec_stubbed_results/concern.rb +34 -0
- data/lib/convenient_service/service/plugins/can_have_rspec_stubbed_results.rb +8 -0
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/commands/delete_service_stubbed_result.rb +63 -0
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/commands/fetch_all_services_stubbed_results_cache.rb +15 -10
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/commands/fetch_service_stubbed_results_cache.rb +3 -3
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/commands.rb +2 -0
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/concern.rb +25 -0
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/entities/result_mock.rb +254 -0
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/entities/result_unmock.rb +82 -0
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/entities/service_stub.rb +135 -0
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/entities/service_unstub.rb +113 -0
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/entities.rb +12 -0
- data/lib/convenient_service/service/plugins/can_have_stubbed_results.rb +1 -14
- data/lib/convenient_service/service/plugins/forbids_convenient_service_entities_as_constructor_arguments/exceptions.rb +84 -0
- data/lib/convenient_service/service/plugins/forbids_convenient_service_entities_as_constructor_arguments/middleware.rb +84 -32
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/concern.rb +42 -2
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_called/exceptions.rb +3 -2
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern/instance_methods.rb +5 -0
- data/lib/convenient_service/service.rb +16 -0
- data/lib/convenient_service/specification.rb +42 -12
- data/lib/convenient_service/support/backtrace_cleaner.rb +6 -7
- data/lib/convenient_service/support/cache/entities/caches/array.rb +5 -1
- data/lib/convenient_service/support/cache/entities/caches/hash.rb +5 -1
- data/lib/convenient_service/support/middleware/stack_builder/entities/builders/custom.rb +4 -0
- data/lib/convenient_service/support/middleware/stack_builder/entities/builders/ruby_middleware.rb +4 -0
- data/lib/convenient_service/support/unique_value.rb +4 -1
- data/lib/convenient_service/support.rb +13 -0
- data/lib/convenient_service/utils/array/find_last.rb +18 -9
- data/lib/convenient_service/utils/class/display_name.rb +9 -9
- data/lib/convenient_service/utils/enumerable/find_last.rb +48 -0
- data/lib/convenient_service/utils/enumerable.rb +20 -0
- data/lib/convenient_service/utils/hash/assert_valid_keys.rb +4 -4
- data/lib/convenient_service/utils/hash/except.rb +5 -4
- data/lib/convenient_service/utils/hash/triple_equality_compare.rb +8 -8
- data/lib/convenient_service/utils/kernel/silence_warnings.rb +4 -4
- data/lib/convenient_service/utils/module/fetch_own_const.rb +36 -31
- data/lib/convenient_service/utils/module/get_namespace.rb +26 -21
- data/lib/convenient_service/utils/module/get_own_const.rb +21 -16
- data/lib/convenient_service/utils/object/clamp_class.rb +50 -47
- data/lib/convenient_service/utils/object/duck_class.rb +84 -81
- data/lib/convenient_service/utils/object/get_own_method.rb +1 -1
- data/lib/convenient_service/utils/object/instance_variable_delete.rb +0 -3
- data/lib/convenient_service/utils/object/instance_variable_fetch.rb +0 -3
- data/lib/convenient_service/utils/object/memoize_including_falsy_values.rb +0 -3
- data/lib/convenient_service/utils/object/resolve_type.rb +13 -11
- data/lib/convenient_service/utils/object/safe_send.rb +2 -0
- data/lib/convenient_service/utils/string/enclose.rb +11 -11
- data/lib/convenient_service/utils/string/tab.rb +60 -0
- data/lib/convenient_service/utils/string.rb +5 -0
- data/lib/convenient_service/utils.rb +9 -0
- data/lib/convenient_service/version.rb +8 -1
- data/lib/convenient_service.rb +232 -14
- metadata +37 -754
- data/lib/convenient_service/feature/configs/standard/commands/is_feature.rb +0 -39
- data/lib/convenient_service/feature/configs/standard/commands/is_feature_class.rb +0 -41
- data/lib/convenient_service/rspec/helpers/classes/stub_entry/constants.rb +0 -25
- data/lib/convenient_service/rspec/helpers/classes/stub_entry/entities/stubbed_feature.rb +0 -128
- data/lib/convenient_service/rspec/helpers/classes/stub_entry/entities/value_spec.rb +0 -79
- data/lib/convenient_service/rspec/helpers/classes/stub_entry.rb +0 -48
- data/lib/convenient_service/rspec/helpers/classes/stub_service/constants.rb +0 -25
- data/lib/convenient_service/rspec/helpers/classes/stub_service/entities/result_spec.rb +0 -211
- data/lib/convenient_service/rspec/helpers/classes/stub_service/entities/stubbed_service.rb +0 -119
- data/lib/convenient_service/rspec/helpers/classes/stub_service.rb +0 -43
- data/lib/convenient_service/service/configs/standard/commands/is_service.rb +0 -39
- data/lib/convenient_service/service/configs/standard/commands/is_service_class.rb +0 -41
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
# @author Marian Kostyk <mariankostyk13895@gmail.com>
|
|
5
|
-
# @license LGPLv3 <https://www.gnu.org/licenses/lgpl-3.0.html>
|
|
6
|
-
##
|
|
7
|
-
|
|
8
|
-
module ConvenientService
|
|
9
|
-
module RSpec
|
|
10
|
-
module Helpers
|
|
11
|
-
module Classes
|
|
12
|
-
class StubService < Support::Command
|
|
13
|
-
module Entities
|
|
14
|
-
class StubbedService
|
|
15
|
-
##
|
|
16
|
-
# @param service_class [Class]
|
|
17
|
-
# @return [void]
|
|
18
|
-
#
|
|
19
|
-
# @internal
|
|
20
|
-
# NOTE: `@arguments = nil` means "match any arguments".
|
|
21
|
-
#
|
|
22
|
-
def initialize(service_class:)
|
|
23
|
-
@service_class = service_class
|
|
24
|
-
@arguments = nil
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
##
|
|
28
|
-
# @return [ConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubService]
|
|
29
|
-
#
|
|
30
|
-
# @internal
|
|
31
|
-
# NOTE: `@arguments = nil` means "match any arguments".
|
|
32
|
-
#
|
|
33
|
-
def with_any_arguments(...)
|
|
34
|
-
@arguments = nil
|
|
35
|
-
|
|
36
|
-
self
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
##
|
|
40
|
-
# @return [ConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubService]
|
|
41
|
-
#
|
|
42
|
-
def with_arguments(...)
|
|
43
|
-
@arguments = Support::Arguments.new(...)
|
|
44
|
-
|
|
45
|
-
self
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
##
|
|
49
|
-
# @return [ConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubService]
|
|
50
|
-
#
|
|
51
|
-
def without_arguments
|
|
52
|
-
@arguments = Support::Arguments.null_arguments
|
|
53
|
-
|
|
54
|
-
self
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
##
|
|
58
|
-
# @param result_spec [ConvenientService::RSpec::Helpers::Classes::StubService::Entities::ResultSpec]
|
|
59
|
-
# @return [ConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubService]
|
|
60
|
-
#
|
|
61
|
-
def to(result_spec)
|
|
62
|
-
@result_spec = result_spec
|
|
63
|
-
|
|
64
|
-
service_class.commit_config!(trigger: Constants::Triggers::STUB_SERVICE)
|
|
65
|
-
|
|
66
|
-
Service::Plugins::CanHaveStubbedResults.set_service_stubbed_result(service_class, arguments, result)
|
|
67
|
-
|
|
68
|
-
self
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
##
|
|
72
|
-
# @param other [Object] Can be any type.
|
|
73
|
-
# @return [Boolean, nil]
|
|
74
|
-
#
|
|
75
|
-
def ==(other)
|
|
76
|
-
return unless other.instance_of?(self.class)
|
|
77
|
-
|
|
78
|
-
return false if service_class != other.service_class
|
|
79
|
-
return false if arguments != other.arguments
|
|
80
|
-
return false if result_spec != other.result_spec
|
|
81
|
-
|
|
82
|
-
true
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
protected
|
|
86
|
-
|
|
87
|
-
##
|
|
88
|
-
# @!attribute [r] service_class
|
|
89
|
-
# @return [Class]
|
|
90
|
-
#
|
|
91
|
-
attr_reader :service_class
|
|
92
|
-
|
|
93
|
-
##
|
|
94
|
-
# @!attribute [r] arguments
|
|
95
|
-
# @return [Hash]
|
|
96
|
-
#
|
|
97
|
-
attr_reader :arguments
|
|
98
|
-
|
|
99
|
-
##
|
|
100
|
-
# @!attribute [r] result_spec
|
|
101
|
-
# @return [ConvenientService::RSpec::Helpers::Classes::StubService::Entities::ResultSpec]
|
|
102
|
-
#
|
|
103
|
-
attr_reader :result_spec
|
|
104
|
-
|
|
105
|
-
private
|
|
106
|
-
|
|
107
|
-
##
|
|
108
|
-
# @return [ConvenientService::Service::Plugins::HasJSendResult::Entities::Result]
|
|
109
|
-
#
|
|
110
|
-
def result
|
|
111
|
-
@result ||= result_spec.for(service_class).calculate_value
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
# @author Marian Kostyk <mariankostyk13895@gmail.com>
|
|
5
|
-
# @license LGPLv3 <https://www.gnu.org/licenses/lgpl-3.0.html>
|
|
6
|
-
##
|
|
7
|
-
|
|
8
|
-
require_relative "stub_service/constants"
|
|
9
|
-
require_relative "stub_service/entities"
|
|
10
|
-
|
|
11
|
-
module ConvenientService
|
|
12
|
-
module RSpec
|
|
13
|
-
module Helpers
|
|
14
|
-
module Classes
|
|
15
|
-
##
|
|
16
|
-
# TODO: Direct Specs.
|
|
17
|
-
#
|
|
18
|
-
class StubService < Support::Command
|
|
19
|
-
##
|
|
20
|
-
# @!attribute [r] service_class
|
|
21
|
-
# @return [ConvenientService::Service]
|
|
22
|
-
#
|
|
23
|
-
attr_reader :service_class
|
|
24
|
-
|
|
25
|
-
##
|
|
26
|
-
# @param service_class [ConvenientService::Service]
|
|
27
|
-
# @return [void]
|
|
28
|
-
#
|
|
29
|
-
def initialize(service_class)
|
|
30
|
-
@service_class = service_class
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
##
|
|
34
|
-
# @return [ConvenientService::RSpec::Helpers::Classes::StubService::Entities::StubbedService]
|
|
35
|
-
#
|
|
36
|
-
def call
|
|
37
|
-
Entities::StubbedService.new(service_class: service_class)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
# @author Marian Kostyk <mariankostyk13895@gmail.com>
|
|
5
|
-
# @license LGPLv3 <https://www.gnu.org/licenses/lgpl-3.0.html>
|
|
6
|
-
##
|
|
7
|
-
|
|
8
|
-
module ConvenientService
|
|
9
|
-
module Service
|
|
10
|
-
module Configs
|
|
11
|
-
module Standard
|
|
12
|
-
module Commands
|
|
13
|
-
class IsService < Support::Command
|
|
14
|
-
##
|
|
15
|
-
# @!attribute [r] service
|
|
16
|
-
# @return [Object] Can be any type.
|
|
17
|
-
#
|
|
18
|
-
attr_reader :service
|
|
19
|
-
|
|
20
|
-
##
|
|
21
|
-
# @param service [Object] Can be any type.
|
|
22
|
-
# @return [void]
|
|
23
|
-
#
|
|
24
|
-
def initialize(service:)
|
|
25
|
-
@service = service
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
##
|
|
29
|
-
# @return [Boolean]
|
|
30
|
-
#
|
|
31
|
-
def call
|
|
32
|
-
Commands::IsServiceClass[service_class: service.class]
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
# @author Marian Kostyk <mariankostyk13895@gmail.com>
|
|
5
|
-
# @license LGPLv3 <https://www.gnu.org/licenses/lgpl-3.0.html>
|
|
6
|
-
##
|
|
7
|
-
|
|
8
|
-
module ConvenientService
|
|
9
|
-
module Service
|
|
10
|
-
module Configs
|
|
11
|
-
module Standard
|
|
12
|
-
module Commands
|
|
13
|
-
class IsServiceClass < Support::Command
|
|
14
|
-
##
|
|
15
|
-
# @!attribute [r] service_class
|
|
16
|
-
# @return [Object] Can be any type.
|
|
17
|
-
#
|
|
18
|
-
attr_reader :service_class
|
|
19
|
-
|
|
20
|
-
##
|
|
21
|
-
# @param service_class [Object] Can be any type.
|
|
22
|
-
# @return [void]
|
|
23
|
-
#
|
|
24
|
-
def initialize(service_class:)
|
|
25
|
-
@service_class = service_class
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
##
|
|
29
|
-
# @return [Boolean]
|
|
30
|
-
#
|
|
31
|
-
def call
|
|
32
|
-
return unless service_class.instance_of?(::Class)
|
|
33
|
-
|
|
34
|
-
service_class.include?(Service::Core)
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|