light-service 0.10.1 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +6 -0
  4. data/.travis.yml +12 -10
  5. data/Appraisals +4 -0
  6. data/README.md +39 -20
  7. data/RELEASES.md +17 -0
  8. data/gemfiles/activesupport_6.gemfile +8 -0
  9. data/lib/light-service.rb +1 -0
  10. data/lib/light-service/context.rb +4 -1
  11. data/lib/light-service/localization_adapter.rb +1 -1
  12. data/lib/light-service/organizer.rb +32 -0
  13. data/lib/light-service/organizer/with_reducer.rb +4 -5
  14. data/lib/light-service/organizer/with_reducer_factory.rb +11 -7
  15. data/lib/light-service/organizer/with_reducer_log_decorator.rb +2 -2
  16. data/lib/light-service/testing/context_factory.rb +12 -7
  17. data/lib/light-service/version.rb +1 -1
  18. data/light-service.gemspec +5 -4
  19. data/spec/acceptance/after_actions_spec.rb +13 -0
  20. data/spec/acceptance/custom_log_from_organizer_spec.rb +60 -0
  21. data/spec/acceptance/fail_spec.rb +42 -16
  22. data/spec/acceptance/organizer/add_aliases_spec.rb +28 -0
  23. data/spec/acceptance/organizer/add_to_context_spec.rb +30 -0
  24. data/spec/acceptance/organizer/execute_spec.rb +1 -1
  25. data/spec/acceptance/organizer/reduce_if_spec.rb +32 -0
  26. data/spec/acceptance/testing/context_factory_spec.rb +12 -3
  27. data/spec/organizer_spec.rb +37 -14
  28. data/spec/sample/provides_free_shipping_action_spec.rb +1 -1
  29. data/spec/spec_helper.rb +2 -1
  30. data/spec/test_doubles.rb +93 -0
  31. data/spec/testing/context_factory_spec.rb +20 -0
  32. metadata +32 -15
  33. data/gemfiles/activesupport_3.gemfile.lock +0 -76
  34. data/gemfiles/activesupport_4.gemfile.lock +0 -82
  35. data/gemfiles/activesupport_5.gemfile.lock +0 -82
@@ -39,4 +39,24 @@ describe 'ContextFactory - used with AdditionOrganizer' do
39
39
  expect(ctx.number).to eq(4)
40
40
  end
41
41
  end
42
+
43
+ context 'when there are already before_actions' do
44
+ it 'only appends before_actions' do
45
+ TestDoubles::AdditionOrganizer.before_actions = [
46
+ lambda do |ctx|
47
+ ctx[:number] += 1 \
48
+ if ctx.current_action == TestDoubles::AddsTwoAction
49
+ end
50
+ ]
51
+
52
+ context =
53
+ LightService::Testing::ContextFactory
54
+ .make_from(TestDoubles::AdditionOrganizer)
55
+ .for(TestDoubles::AddsThreeAction)
56
+ .with(4) # Context is a "glorified" hash
57
+
58
+ expect(context.number).to eq(8)
59
+ expect(context[:_before_actions].length).to eq(1)
60
+ end
61
+ end
42
62
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: light-service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Attila Domokos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-30 00:00:00.000000000 Z
11
+ date: 2020-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
19
+ version: 3.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '3.0'
26
+ version: 3.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,42 +44,56 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.16.1
47
+ version: '0.17'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.16.1
54
+ version: '0.17'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rubocop
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.53'
61
+ version: 0.68.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.68.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-performance
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.2.0
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '0.53'
82
+ version: 1.2.0
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: pry
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '0.10'
89
+ version: 0.12.2
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '0.10'
96
+ version: 0.12.2
83
97
  description: A service skeleton with an emphasis on simplicity
84
98
  email:
85
99
  - adomokos@gmail.com
@@ -99,11 +113,9 @@ files:
99
113
  - RELEASES.md
100
114
  - Rakefile
101
115
  - gemfiles/activesupport_3.gemfile
102
- - gemfiles/activesupport_3.gemfile.lock
103
116
  - gemfiles/activesupport_4.gemfile
104
- - gemfiles/activesupport_4.gemfile.lock
105
117
  - gemfiles/activesupport_5.gemfile
106
- - gemfiles/activesupport_5.gemfile.lock
118
+ - gemfiles/activesupport_6.gemfile
107
119
  - lib/light-service.rb
108
120
  - lib/light-service/action.rb
109
121
  - lib/light-service/configuration.rb
@@ -136,6 +148,7 @@ files:
136
148
  - spec/acceptance/after_actions_spec.rb
137
149
  - spec/acceptance/around_each_spec.rb
138
150
  - spec/acceptance/before_actions_spec.rb
151
+ - spec/acceptance/custom_log_from_organizer_spec.rb
139
152
  - spec/acceptance/fail_spec.rb
140
153
  - spec/acceptance/include_warning_spec.rb
141
154
  - spec/acceptance/log_from_organizer_spec.rb
@@ -148,6 +161,8 @@ files:
148
161
  - spec/acceptance/orchestrator/reduce_if_spec.rb
149
162
  - spec/acceptance/orchestrator/reduce_until_spec.rb
150
163
  - spec/acceptance/orchestrator/with_callback_spec.rb
164
+ - spec/acceptance/organizer/add_aliases_spec.rb
165
+ - spec/acceptance/organizer/add_to_context_spec.rb
151
166
  - spec/acceptance/organizer/around_each_with_reduce_if_spec.rb
152
167
  - spec/acceptance/organizer/context_failure_and_skipping_spec.rb
153
168
  - spec/acceptance/organizer/execute_spec.rb
@@ -203,8 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
203
218
  - !ruby/object:Gem::Version
204
219
  version: '0'
205
220
  requirements: []
206
- rubyforge_project:
207
- rubygems_version: 2.6.13
221
+ rubygems_version: 3.1.2
208
222
  signing_key:
209
223
  specification_version: 4
210
224
  summary: A service skeleton with an emphasis on simplicity
@@ -213,6 +227,7 @@ test_files:
213
227
  - spec/acceptance/after_actions_spec.rb
214
228
  - spec/acceptance/around_each_spec.rb
215
229
  - spec/acceptance/before_actions_spec.rb
230
+ - spec/acceptance/custom_log_from_organizer_spec.rb
216
231
  - spec/acceptance/fail_spec.rb
217
232
  - spec/acceptance/include_warning_spec.rb
218
233
  - spec/acceptance/log_from_organizer_spec.rb
@@ -225,6 +240,8 @@ test_files:
225
240
  - spec/acceptance/orchestrator/reduce_if_spec.rb
226
241
  - spec/acceptance/orchestrator/reduce_until_spec.rb
227
242
  - spec/acceptance/orchestrator/with_callback_spec.rb
243
+ - spec/acceptance/organizer/add_aliases_spec.rb
244
+ - spec/acceptance/organizer/add_to_context_spec.rb
228
245
  - spec/acceptance/organizer/around_each_with_reduce_if_spec.rb
229
246
  - spec/acceptance/organizer/context_failure_and_skipping_spec.rb
230
247
  - spec/acceptance/organizer/execute_spec.rb
@@ -1,76 +0,0 @@
1
- PATH
2
- remote: ../
3
- specs:
4
- light-service (0.6.1)
5
- activesupport (>= 3.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- activesupport (3.2.22)
11
- i18n (~> 0.6, >= 0.6.4)
12
- multi_json (~> 1.0)
13
- appraisal (2.0.2)
14
- bundler
15
- rake
16
- thor (>= 0.14.0)
17
- ast (2.3.0)
18
- coderay (1.1.1)
19
- diff-lcs (1.2.5)
20
- docile (1.1.5)
21
- i18n (0.7.0)
22
- json (2.0.2)
23
- method_source (0.8.2)
24
- multi_json (1.11.2)
25
- parser (2.3.1.2)
26
- ast (~> 2.2)
27
- powerpack (0.1.1)
28
- pry (0.10.4)
29
- coderay (~> 1.1.0)
30
- method_source (~> 0.8.1)
31
- slop (~> 3.4)
32
- rainbow (2.1.0)
33
- rake (10.4.2)
34
- rspec (3.3.0)
35
- rspec-core (~> 3.3.0)
36
- rspec-expectations (~> 3.3.0)
37
- rspec-mocks (~> 3.3.0)
38
- rspec-core (3.3.2)
39
- rspec-support (~> 3.3.0)
40
- rspec-expectations (3.3.1)
41
- diff-lcs (>= 1.2.0, < 2.0)
42
- rspec-support (~> 3.3.0)
43
- rspec-mocks (3.3.2)
44
- diff-lcs (>= 1.2.0, < 2.0)
45
- rspec-support (~> 3.3.0)
46
- rspec-support (3.3.0)
47
- rubocop (0.42.0)
48
- parser (>= 2.3.1.1, < 3.0)
49
- powerpack (~> 0.1)
50
- rainbow (>= 1.99.1, < 3.0)
51
- ruby-progressbar (~> 1.7)
52
- unicode-display_width (~> 1.0, >= 1.0.1)
53
- ruby-progressbar (1.8.1)
54
- simplecov (0.12.0)
55
- docile (~> 1.1.0)
56
- json (>= 1.8, < 3)
57
- simplecov-html (~> 0.10.0)
58
- simplecov-html (0.10.0)
59
- slop (3.6.0)
60
- thor (0.19.1)
61
- unicode-display_width (1.1.1)
62
-
63
- PLATFORMS
64
- ruby
65
-
66
- DEPENDENCIES
67
- activesupport (~> 3.0)
68
- appraisal (~> 2.0)
69
- light-service!
70
- pry (~> 0.10)
71
- rspec (~> 3.0)
72
- rubocop (~> 0.36)
73
- simplecov (~> 0.11)
74
-
75
- BUNDLED WITH
76
- 1.12.5
@@ -1,82 +0,0 @@
1
- PATH
2
- remote: ../
3
- specs:
4
- light-service (0.6.1)
5
- activesupport (>= 3.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- activesupport (4.2.3)
11
- i18n (~> 0.7)
12
- json (~> 1.7, >= 1.7.7)
13
- minitest (~> 5.1)
14
- thread_safe (~> 0.3, >= 0.3.4)
15
- tzinfo (~> 1.1)
16
- appraisal (2.0.2)
17
- bundler
18
- rake
19
- thor (>= 0.14.0)
20
- ast (2.3.0)
21
- coderay (1.1.1)
22
- diff-lcs (1.2.5)
23
- docile (1.1.5)
24
- i18n (0.7.0)
25
- json (1.8.3)
26
- method_source (0.8.2)
27
- minitest (5.7.0)
28
- parser (2.3.1.2)
29
- ast (~> 2.2)
30
- powerpack (0.1.1)
31
- pry (0.10.4)
32
- coderay (~> 1.1.0)
33
- method_source (~> 0.8.1)
34
- slop (~> 3.4)
35
- rainbow (2.1.0)
36
- rake (10.4.2)
37
- rspec (3.3.0)
38
- rspec-core (~> 3.3.0)
39
- rspec-expectations (~> 3.3.0)
40
- rspec-mocks (~> 3.3.0)
41
- rspec-core (3.3.2)
42
- rspec-support (~> 3.3.0)
43
- rspec-expectations (3.3.1)
44
- diff-lcs (>= 1.2.0, < 2.0)
45
- rspec-support (~> 3.3.0)
46
- rspec-mocks (3.3.2)
47
- diff-lcs (>= 1.2.0, < 2.0)
48
- rspec-support (~> 3.3.0)
49
- rspec-support (3.3.0)
50
- rubocop (0.42.0)
51
- parser (>= 2.3.1.1, < 3.0)
52
- powerpack (~> 0.1)
53
- rainbow (>= 1.99.1, < 3.0)
54
- ruby-progressbar (~> 1.7)
55
- unicode-display_width (~> 1.0, >= 1.0.1)
56
- ruby-progressbar (1.8.1)
57
- simplecov (0.12.0)
58
- docile (~> 1.1.0)
59
- json (>= 1.8, < 3)
60
- simplecov-html (~> 0.10.0)
61
- simplecov-html (0.10.0)
62
- slop (3.6.0)
63
- thor (0.19.1)
64
- thread_safe (0.3.5)
65
- tzinfo (1.2.2)
66
- thread_safe (~> 0.1)
67
- unicode-display_width (1.1.1)
68
-
69
- PLATFORMS
70
- ruby
71
-
72
- DEPENDENCIES
73
- activesupport (~> 4.0)
74
- appraisal (~> 2.0)
75
- light-service!
76
- pry (~> 0.10)
77
- rspec (~> 3.0)
78
- rubocop (~> 0.36)
79
- simplecov (~> 0.11)
80
-
81
- BUNDLED WITH
82
- 1.12.5
@@ -1,82 +0,0 @@
1
- PATH
2
- remote: ../
3
- specs:
4
- light-service (0.6.1)
5
- activesupport (>= 3.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- activesupport (5.0.0.1)
11
- concurrent-ruby (~> 1.0, >= 1.0.2)
12
- i18n (~> 0.7)
13
- minitest (~> 5.1)
14
- tzinfo (~> 1.1)
15
- appraisal (2.1.0)
16
- bundler
17
- rake
18
- thor (>= 0.14.0)
19
- ast (2.3.0)
20
- coderay (1.1.1)
21
- concurrent-ruby (1.0.2)
22
- diff-lcs (1.2.5)
23
- docile (1.1.5)
24
- i18n (0.7.0)
25
- json (2.0.2)
26
- method_source (0.8.2)
27
- minitest (5.9.0)
28
- parser (2.3.1.2)
29
- ast (~> 2.2)
30
- powerpack (0.1.1)
31
- pry (0.10.4)
32
- coderay (~> 1.1.0)
33
- method_source (~> 0.8.1)
34
- slop (~> 3.4)
35
- rainbow (2.1.0)
36
- rake (11.2.2)
37
- rspec (3.5.0)
38
- rspec-core (~> 3.5.0)
39
- rspec-expectations (~> 3.5.0)
40
- rspec-mocks (~> 3.5.0)
41
- rspec-core (3.5.2)
42
- rspec-support (~> 3.5.0)
43
- rspec-expectations (3.5.0)
44
- diff-lcs (>= 1.2.0, < 2.0)
45
- rspec-support (~> 3.5.0)
46
- rspec-mocks (3.5.0)
47
- diff-lcs (>= 1.2.0, < 2.0)
48
- rspec-support (~> 3.5.0)
49
- rspec-support (3.5.0)
50
- rubocop (0.42.0)
51
- parser (>= 2.3.1.1, < 3.0)
52
- powerpack (~> 0.1)
53
- rainbow (>= 1.99.1, < 3.0)
54
- ruby-progressbar (~> 1.7)
55
- unicode-display_width (~> 1.0, >= 1.0.1)
56
- ruby-progressbar (1.8.1)
57
- simplecov (0.12.0)
58
- docile (~> 1.1.0)
59
- json (>= 1.8, < 3)
60
- simplecov-html (~> 0.10.0)
61
- simplecov-html (0.10.0)
62
- slop (3.6.0)
63
- thor (0.19.1)
64
- thread_safe (0.3.5)
65
- tzinfo (1.2.2)
66
- thread_safe (~> 0.1)
67
- unicode-display_width (1.1.1)
68
-
69
- PLATFORMS
70
- ruby
71
-
72
- DEPENDENCIES
73
- activesupport (~> 5.0)
74
- appraisal (~> 2.0)
75
- light-service!
76
- pry (~> 0.10)
77
- rspec (~> 3.0)
78
- rubocop (~> 0.36)
79
- simplecov (~> 0.11)
80
-
81
- BUNDLED WITH
82
- 1.12.5