functional-light-service 6.2.0 → 6.3.0
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/lib/functional-light-service.rb +6 -36
- metadata +14 -307
- data/.github/workflows/project-build.yml +0 -71
- data/.gitignore +0 -24
- data/.rspec +0 -3
- data/.rubocop.yml +0 -101
- data/.solargraph.yml +0 -11
- data/AUDIT-functional-light-service.md +0 -352
- data/Appraisals +0 -7
- data/CHANGELOG.md +0 -292
- data/CODE_OF_CONDUCT.md +0 -22
- data/Gemfile +0 -4
- data/LICENSE +0 -22
- data/README.md +0 -1663
- data/Rakefile +0 -12
- data/VERSION +0 -1
- data/audit/bench.rb +0 -99
- data/audit/verify_findings.rb +0 -172
- data/functional-light-service.gemspec +0 -35
- data/gemfiles/dry_inflector_0_2_1.gemfile +0 -5
- data/gemfiles/i18n_1_8_11.gemfile +0 -5
- data/lib/functional-light-service/action.rb +0 -145
- data/lib/functional-light-service/configuration.rb +0 -36
- data/lib/functional-light-service/context/key_verifier.rb +0 -124
- data/lib/functional-light-service/context.rb +0 -208
- data/lib/functional-light-service/deprecations.rb +0 -26
- data/lib/functional-light-service/errors.rb +0 -9
- data/lib/functional-light-service/functional/enum.rb +0 -286
- data/lib/functional-light-service/functional/maybe.rb +0 -21
- data/lib/functional-light-service/functional/monad.rb +0 -77
- data/lib/functional-light-service/functional/null.rb +0 -88
- data/lib/functional-light-service/functional/option.rb +0 -100
- data/lib/functional-light-service/functional/result.rb +0 -129
- data/lib/functional-light-service/functional/sequencer.rb +0 -144
- data/lib/functional-light-service/i18n/localization_adapter.rb +0 -50
- data/lib/functional-light-service/localization_adapter.rb +0 -39
- data/lib/functional-light-service/localization_map.rb +0 -9
- data/lib/functional-light-service/organizer/execute.rb +0 -16
- data/lib/functional-light-service/organizer/iterate.rb +0 -30
- data/lib/functional-light-service/organizer/reduce_case.rb +0 -50
- data/lib/functional-light-service/organizer/reduce_if.rb +0 -19
- data/lib/functional-light-service/organizer/reduce_if_else.rb +0 -23
- data/lib/functional-light-service/organizer/reduce_until.rb +0 -22
- data/lib/functional-light-service/organizer/reduce_while.rb +0 -31
- data/lib/functional-light-service/organizer/scoped_reducable.rb +0 -15
- data/lib/functional-light-service/organizer/with_callback.rb +0 -28
- data/lib/functional-light-service/organizer/with_reducer.rb +0 -81
- data/lib/functional-light-service/organizer/with_reducer_factory.rb +0 -20
- data/lib/functional-light-service/organizer/with_reducer_log_decorator.rb +0 -111
- data/lib/functional-light-service/organizer.rb +0 -129
- data/lib/functional-light-service/testing/context_factory.rb +0 -48
- data/lib/functional-light-service/testing.rb +0 -3
- data/lib/functional-light-service/version.rb +0 -5
- data/resources/fail_actions.png +0 -0
- data/resources/light-service.png +0 -0
- data/resources/organizer_and_actions.png +0 -0
- data/resources/skip_actions.png +0 -0
- data/spec/acceptance/add_numbers_spec.rb +0 -11
- data/spec/acceptance/after_actions_spec.rb +0 -87
- data/spec/acceptance/around_each_spec.rb +0 -19
- data/spec/acceptance/before_actions_spec.rb +0 -115
- data/spec/acceptance/custom_log_from_organizer_spec.rb +0 -61
- data/spec/acceptance/deprecation_warnings_spec.rb +0 -82
- data/spec/acceptance/fail_spec.rb +0 -52
- data/spec/acceptance/log_from_organizer_spec.rb +0 -154
- data/spec/acceptance/message_localization_spec.rb +0 -119
- data/spec/acceptance/organizer/add_aliases_spec.rb +0 -28
- data/spec/acceptance/organizer/add_to_context_spec.rb +0 -54
- data/spec/acceptance/organizer/around_each_with_reduce_if_spec.rb +0 -42
- data/spec/acceptance/organizer/context_failure_and_skipping_spec.rb +0 -90
- data/spec/acceptance/organizer/execute_spec.rb +0 -67
- data/spec/acceptance/organizer/iterate_spec.rb +0 -44
- data/spec/acceptance/organizer/reduce_case_spec.rb +0 -65
- data/spec/acceptance/organizer/reduce_if_else_spec.rb +0 -60
- data/spec/acceptance/organizer/reduce_if_spec.rb +0 -89
- data/spec/acceptance/organizer/reduce_until_spec.rb +0 -49
- data/spec/acceptance/organizer/reduce_while_spec.rb +0 -96
- data/spec/acceptance/organizer/with_callback_spec.rb +0 -113
- data/spec/acceptance/organizer_entry_point_spec.rb +0 -35
- data/spec/acceptance/rollback_spec.rb +0 -183
- data/spec/acceptance/skip_all_remaining_spec.rb +0 -139
- data/spec/acceptance/testing/context_factory_spec.rb +0 -54
- data/spec/action_expected_keys_spec.rb +0 -63
- data/spec/action_expects_and_promises_spec.rb +0 -97
- data/spec/action_optional_expected_keys_spec.rb +0 -107
- data/spec/action_promised_keys_spec.rb +0 -126
- data/spec/action_spec.rb +0 -97
- data/spec/context/inspect_spec.rb +0 -52
- data/spec/context_spec.rb +0 -301
- data/spec/examples/amount_spec.rb +0 -77
- data/spec/examples/controller_spec.rb +0 -63
- data/spec/examples/validate_address_spec.rb +0 -38
- data/spec/i18n_localization_adapter_spec.rb +0 -83
- data/spec/lib/deterministic/class_mixin_spec.rb +0 -24
- data/spec/lib/deterministic/currify_spec.rb +0 -90
- data/spec/lib/deterministic/monad_axioms.rb +0 -46
- data/spec/lib/deterministic/monad_spec.rb +0 -47
- data/spec/lib/deterministic/null_spec.rb +0 -65
- data/spec/lib/deterministic/option_spec.rb +0 -140
- data/spec/lib/deterministic/result/failure_spec.rb +0 -65
- data/spec/lib/deterministic/result/result_map_spec.rb +0 -155
- data/spec/lib/deterministic/result/result_shared.rb +0 -25
- data/spec/lib/deterministic/result/success_spec.rb +0 -41
- data/spec/lib/deterministic/result_spec.rb +0 -63
- data/spec/lib/deterministic/sequencer_spec.rb +0 -506
- data/spec/lib/edge_cases_spec.rb +0 -156
- data/spec/lib/enum_spec.rb +0 -114
- data/spec/lib/native_pattern_matching_spec.rb +0 -74
- data/spec/localization_adapter_spec.rb +0 -66
- data/spec/organizer/with_reducer_spec.rb +0 -56
- data/spec/organizer_key_aliases_spec.rb +0 -29
- data/spec/organizer_spec.rb +0 -115
- data/spec/readme_spec.rb +0 -45
- data/spec/sample/calculates_order_tax_action_spec.rb +0 -16
- data/spec/sample/calculates_tax_spec.rb +0 -30
- data/spec/sample/looks_up_tax_percentage_action_spec.rb +0 -55
- data/spec/sample/provides_free_shipping_action_spec.rb +0 -25
- data/spec/sample/tax/calculates_order_tax_action.rb +0 -10
- data/spec/sample/tax/calculates_tax.rb +0 -11
- data/spec/sample/tax/looks_up_tax_percentage_action.rb +0 -28
- data/spec/sample/tax/provides_free_shipping_action.rb +0 -11
- data/spec/spec_helper.rb +0 -32
- data/spec/support.rb +0 -1
- data/spec/test_doubles.rb +0 -656
- data/spec/testing/context_factory/iterate_spec.rb +0 -39
- data/spec/testing/context_factory/reduce_if_spec.rb +0 -40
- data/spec/testing/context_factory/reduce_until_spec.rb +0 -40
- data/spec/testing/context_factory/with_callback_spec.rb +0 -38
- data/spec/testing/context_factory_spec.rb +0 -76
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
require 'test_doubles'
|
|
3
|
-
|
|
4
|
-
RSpec.describe 'ContextFactory - used with ReduceIfOrganizer' do
|
|
5
|
-
let(:organizer) { TestDoubles::ReduceIfOrganizer }
|
|
6
|
-
|
|
7
|
-
context 'when called with a truthy argument action' do
|
|
8
|
-
it 'executes a context up-to the callback action' do
|
|
9
|
-
ctx =
|
|
10
|
-
FunctionalLightService::Testing::ContextFactory
|
|
11
|
-
.make_from(organizer)
|
|
12
|
-
.for(TestDoubles::AddsThreeAction)
|
|
13
|
-
.with(:number => 1)
|
|
14
|
-
|
|
15
|
-
expect(ctx.number).to eq(4)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it 'creates a context up-to action with empty context steps' do
|
|
19
|
-
ctx =
|
|
20
|
-
FunctionalLightService::Testing::ContextFactory
|
|
21
|
-
.make_from(organizer)
|
|
22
|
-
.for(TestDoubles::AddsTwoAction)
|
|
23
|
-
.with(:number => 1)
|
|
24
|
-
|
|
25
|
-
expect(ctx.number).to eq(2)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
context 'when called with a false argument action' do
|
|
30
|
-
it 'does not execute the steps' do
|
|
31
|
-
ctx =
|
|
32
|
-
FunctionalLightService::Testing::ContextFactory
|
|
33
|
-
.make_from(organizer)
|
|
34
|
-
.for(TestDoubles::AddsThreeAction)
|
|
35
|
-
.with(:number => 0)
|
|
36
|
-
|
|
37
|
-
expect(ctx.number).to eq(1)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
require 'test_doubles'
|
|
3
|
-
|
|
4
|
-
RSpec.describe 'ContextFactory - used with ReduceUntilOrganizer' do
|
|
5
|
-
let(:organizer) { TestDoubles::ReduceUntilOrganizer }
|
|
6
|
-
|
|
7
|
-
context 'when called with truthy block' do
|
|
8
|
-
it 'creates a context up-to the action defined before the iteration' do
|
|
9
|
-
ctx =
|
|
10
|
-
FunctionalLightService::Testing::ContextFactory
|
|
11
|
-
.make_from(organizer)
|
|
12
|
-
.for(TestDoubles::AddsTwoAction)
|
|
13
|
-
.with(:number => 1)
|
|
14
|
-
|
|
15
|
-
expect(ctx[:number]).to eq(2)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it 'creates a context only to the first step of the loop' do
|
|
19
|
-
ctx =
|
|
20
|
-
FunctionalLightService::Testing::ContextFactory
|
|
21
|
-
.make_from(organizer)
|
|
22
|
-
.for(TestDoubles::AddsThreeAction)
|
|
23
|
-
.with(:number => 1)
|
|
24
|
-
|
|
25
|
-
expect(ctx.number).to eq(4)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
context 'when called with falsey block' do
|
|
30
|
-
it 'creates a context up-to the first step' do
|
|
31
|
-
ctx =
|
|
32
|
-
FunctionalLightService::Testing::ContextFactory
|
|
33
|
-
.make_from(organizer)
|
|
34
|
-
.for(TestDoubles::AddsThreeAction)
|
|
35
|
-
.with(:number => 7)
|
|
36
|
-
|
|
37
|
-
expect(ctx[:number]).to eq(10)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
require 'spec_helper'
|
|
2
|
-
require 'test_doubles'
|
|
3
|
-
|
|
4
|
-
RSpec.describe 'ContextFactory - used with CallbackOrganizer' do
|
|
5
|
-
let(:organizer) { TestDoubles::CallbackOrganizer }
|
|
6
|
-
|
|
7
|
-
context 'when called with the callback action' do
|
|
8
|
-
it 'creates a context up-to the callback action' do
|
|
9
|
-
ctx =
|
|
10
|
-
FunctionalLightService::Testing::ContextFactory
|
|
11
|
-
.make_from(organizer)
|
|
12
|
-
.for(TestDoubles::AddTenCallbackAction)
|
|
13
|
-
.with(:number => 1)
|
|
14
|
-
|
|
15
|
-
expect(ctx.number).to eq(2)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it 'creates a context up-to callback action with empty context steps' do
|
|
19
|
-
ctx =
|
|
20
|
-
FunctionalLightService::Testing::ContextFactory
|
|
21
|
-
.make_from(organizer)
|
|
22
|
-
.for(TestDoubles::AddsTwoAction)
|
|
23
|
-
.with(:number => 1)
|
|
24
|
-
|
|
25
|
-
expect(ctx.number).to eq(12)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it 'creates a context up-to the action defined in context steps' do
|
|
29
|
-
ctx =
|
|
30
|
-
FunctionalLightService::Testing::ContextFactory
|
|
31
|
-
.make_from(organizer)
|
|
32
|
-
.for(TestDoubles::AddsThreeAction)
|
|
33
|
-
.with(:number => 1)
|
|
34
|
-
|
|
35
|
-
expect(ctx.number).to eq(14)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require "test_doubles"
|
|
3
|
-
|
|
4
|
-
describe "ContextFactory - used with AdditionOrganizer" do
|
|
5
|
-
let(:organizer) { TestDoubles::AdditionOrganizer }
|
|
6
|
-
|
|
7
|
-
after do
|
|
8
|
-
TestDoubles::AdditionOrganizer.before_actions = nil
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
context "when called with the first action" do
|
|
12
|
-
it "does not alter the context" do
|
|
13
|
-
ctx = FunctionalLightService::Testing::ContextFactory
|
|
14
|
-
.make_from(organizer)
|
|
15
|
-
.for(TestDoubles::AddsOneAction)
|
|
16
|
-
.with(1)
|
|
17
|
-
|
|
18
|
-
expect(ctx[:number]).to eq(1)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
context "when called with the second action" do
|
|
23
|
-
it "adds one to the number provided" do
|
|
24
|
-
ctx = FunctionalLightService::Testing::ContextFactory
|
|
25
|
-
.make_from(organizer)
|
|
26
|
-
.for(TestDoubles::AddsTwoAction)
|
|
27
|
-
.with(1)
|
|
28
|
-
|
|
29
|
-
expect(ctx.number).to eq(2)
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
context "when called with third action" do
|
|
34
|
-
it "creates a context up-to the action defined" do
|
|
35
|
-
ctx = FunctionalLightService::Testing::ContextFactory
|
|
36
|
-
.make_from(organizer)
|
|
37
|
-
.for(TestDoubles::AddsThreeAction)
|
|
38
|
-
.with(1)
|
|
39
|
-
|
|
40
|
-
expect(ctx.number).to eq(4)
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
context "when there are already before_actions" do
|
|
45
|
-
it "only appends before_actions" do
|
|
46
|
-
TestDoubles::AdditionOrganizer.before_actions = [
|
|
47
|
-
->(ctx) { ctx[:number] += 1 if ctx.current_action == TestDoubles::AddsTwoAction }
|
|
48
|
-
]
|
|
49
|
-
|
|
50
|
-
context = FunctionalLightService::Testing::ContextFactory
|
|
51
|
-
.make_from(TestDoubles::AdditionOrganizer)
|
|
52
|
-
.for(TestDoubles::AddsThreeAction)
|
|
53
|
-
.with(4) # Context is a "glorified" hash
|
|
54
|
-
|
|
55
|
-
expect(context.number).to eq(8)
|
|
56
|
-
expect(context[:_before_actions].length).to eq(1)
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
context "when used repeatedly" do
|
|
61
|
-
it "does not leave its temporary hook on the organizer class" do
|
|
62
|
-
2.times do
|
|
63
|
-
FunctionalLightService::Testing::ContextFactory
|
|
64
|
-
.make_from(organizer)
|
|
65
|
-
.for(TestDoubles::AddsTwoAction)
|
|
66
|
-
.with(1)
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
hooks = organizer.instance_variable_get(:@before_actions)
|
|
70
|
-
expect(hooks.nil? || hooks.empty?).to be(true)
|
|
71
|
-
|
|
72
|
-
# e l'organizer continua a funzionare normalmente
|
|
73
|
-
expect(organizer.call(1).fetch(:number)).to eq(7)
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
end
|