simple_service 2.1.4 → 2.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2220ad6ff738c552c1aec94c1ca60e03e57373407c1358c59771aacc36d1b8ee
4
- data.tar.gz: e33b89e540ecbc047b4d30c3926475c000603d58a7a3cfe02c1205319c28ec37
3
+ metadata.gz: d3f4dc247883ae9ebda40616abae2ecada0f44e3a81babb3fe8f99f4ddd072cf
4
+ data.tar.gz: 1c238edcfa08c34cc0fe9d166b2cb9d4c8d8803d2f0b84e26265433bd2bc59d0
5
5
  SHA512:
6
- metadata.gz: cc84c17c115e32d93fb7038d2a74ae5e6e784a1bf35130ced4ce047ddfb0efc5379d16c42a9bacb283b323af768f41b5e41ba7450fd9fb96d5a4db5adbc1b461
7
- data.tar.gz: 5547aa32dfddea4ea7ec12d7a8906309dbf781f1d74416675d8c7ed3ffe0d619b644572136e0eb144a880fb0f0943cf173907116f1aeb2e687eb0bd7f297239b
6
+ metadata.gz: 53c0ccac4184ad5be6e3a849b94a1dc5c2fb419937a500db3edbe59762cdd54e23ca1dffa411d5362636683dc9ec6aa3aa2b4a68297cd61e28c59330a2cc36ff
7
+ data.tar.gz: 0071e4847fa116a5fcbcc8235528a2a630d974c421b21b199bd4f496ebcc508aa8ee5949bc7f7d7974f0dc58ef83a3b2e33a46a5983538400edcdee6c3d93a38
@@ -0,0 +1,45 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ branches: [ "master" ]
6
+ pull_request:
7
+ branches: [ "master" ]
8
+
9
+ jobs:
10
+ build:
11
+ name: Build + Publish
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: read
15
+ packages: write
16
+
17
+ steps:
18
+ - uses: actions/checkout@v3
19
+ - name: Set up Ruby 2.6
20
+ uses: actions/setup-ruby@v1
21
+ with:
22
+ ruby-version: 2.6.x
23
+
24
+ - name: Publish to GPR
25
+ run: |
26
+ mkdir -p $HOME/.gem
27
+ touch $HOME/.gem/credentials
28
+ chmod 0600 $HOME/.gem/credentials
29
+ printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
30
+ gem build *.gemspec
31
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
32
+ env:
33
+ GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
34
+ OWNER: ${{ github.repository_owner }}
35
+
36
+ - name: Publish to RubyGems
37
+ run: |
38
+ mkdir -p $HOME/.gem
39
+ touch $HOME/.gem/credentials
40
+ chmod 0600 $HOME/.gem/credentials
41
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
42
+ gem build *.gemspec
43
+ gem push *.gem
44
+ env:
45
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
@@ -0,0 +1 @@
1
+ cb567a382f07efd13ccbb083e1f8b876aaae4d752b188fd8d7fc42cc0fdba86d5c6d051187e4422aa3d9e5a7d9ad2db4789142fced9cd6cd3d6b08a99f3d40d3
@@ -3,7 +3,7 @@ module SimpleService
3
3
  attr_accessor :value, :recorded_commands
4
4
 
5
5
  def initialize()
6
- @recorded_commands = []
6
+ @recorded_commands = Set.new
7
7
  @verbose_tracking = SimpleService.configuration.verbose_tracking
8
8
  end
9
9
 
@@ -1,3 +1,3 @@
1
1
  module SimpleService
2
- VERSION = '2.1.4'
2
+ VERSION = '2.1.5'
3
3
  end
@@ -2,6 +2,7 @@ require 'spec_helper'
2
2
  require_relative 'support/basic_service'
3
3
  require_relative 'support/looping_service'
4
4
  require_relative 'support/empty_service'
5
+ require_relative 'support/multiple_outcome_calls'
5
6
 
6
7
  RSpec.describe SimpleService do
7
8
 
@@ -87,31 +88,50 @@ RSpec.describe SimpleService do
87
88
  end
88
89
 
89
90
  context 'record commands' do
91
+ it 'value refects only one outcome call per command' do
92
+ result = MultipleOutcomeCalls.call(params.merge(foo: 'foo', bar: 'bar'))
93
+ expect(result.value).to eq(foo: 'FOO', bar: 'BAR')
94
+ end
95
+
96
+ it 'recorded commands has only one outcome call per command' do
97
+ result = MultipleOutcomeCalls.call(params.merge(foo: 'foo', bar: 'bar'))
98
+ expect(result.recorded_commands).to eq(Set.new([
99
+ {
100
+ class_name: 'MultipleOutcomeCalls',
101
+ command_name: :command_one,
102
+ success: true,
103
+ },
104
+ {
105
+ class_name: 'MultipleOutcomeCalls',
106
+ command_name: :command_two,
107
+ success: true,
108
+ },
109
+ ]))
110
+ end
111
+
90
112
  it 'records normal command execution' do
91
- expect(result.recorded_commands).to eq(
92
- [
93
- {
94
- class_name: 'BasicService',
95
- command_name: :upcase_foo,
96
- success: true,
97
- },
98
- {
99
- class_name: 'BasicService',
100
- command_name: :upcase_bar,
101
- success: true,
102
- },
103
- {
104
- class_name: 'ModifyFooBar',
105
- command_name: :call,
106
- success: true,
107
- },
108
- {
109
- class_name: 'CombineFooBar',
110
- command_name: :call,
111
- success: true,
112
- },
113
- ]
114
- )
113
+ expect(result.recorded_commands).to eq(Set.new([
114
+ {
115
+ class_name: 'BasicService',
116
+ command_name: :upcase_foo,
117
+ success: true,
118
+ },
119
+ {
120
+ class_name: 'BasicService',
121
+ command_name: :upcase_bar,
122
+ success: true,
123
+ },
124
+ {
125
+ class_name: 'ModifyFooBar',
126
+ command_name: :call,
127
+ success: true,
128
+ },
129
+ {
130
+ class_name: 'CombineFooBar',
131
+ command_name: :call,
132
+ success: true,
133
+ },
134
+ ]))
115
135
  end
116
136
 
117
137
  it 'records verbose command execution' do
@@ -119,7 +139,7 @@ RSpec.describe SimpleService do
119
139
  config.verbose_tracking = true
120
140
  end
121
141
 
122
- expect(result.recorded_commands).to eq(
142
+ expect(result.recorded_commands).to eq(Set.new(
123
143
  [
124
144
  {
125
145
  class_name: 'BasicService',
@@ -181,7 +201,7 @@ RSpec.describe SimpleService do
181
201
  },
182
202
  },
183
203
  ]
184
- )
204
+ ))
185
205
  end
186
206
  end
187
207
  end
@@ -0,0 +1,16 @@
1
+ class MultipleOutcomeCalls
2
+ include SimpleService
3
+
4
+ commands :command_one,
5
+ :command_two,
6
+
7
+ def command_one(**kwargs)
8
+ success(kwargs.merge(foo: kwargs[:foo].capitalize))
9
+ success(kwargs.merge(foo: kwargs[:foo].upcase))
10
+ end
11
+
12
+ def command_two(**kwargs)
13
+ success(bar: kwargs[:bar].capitalize)
14
+ success(foo: kwargs[:foo].upcase, bar: kwargs[:bar].upcase)
15
+ end
16
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarrod Spillers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-27 00:00:00.000000000 Z
11
+ date: 2023-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -102,6 +102,7 @@ executables: []
102
102
  extensions: []
103
103
  extra_rdoc_files: []
104
104
  files:
105
+ - ".github/workflows/gem-push.yml"
105
106
  - ".gitignore"
106
107
  - ".rspec"
107
108
  - ".travis.yml"
@@ -110,6 +111,7 @@ files:
110
111
  - LICENSE.txt
111
112
  - README.md
112
113
  - Rakefile
114
+ - checksums/simple_service-2.1.4.gem.sha512
113
115
  - lib/simple_service.rb
114
116
  - lib/simple_service/configuration.rb
115
117
  - lib/simple_service/result.rb
@@ -122,6 +124,7 @@ files:
122
124
  - spec/support/empty_service.rb
123
125
  - spec/support/looping_service.rb
124
126
  - spec/support/modify_foo_bar.rb
127
+ - spec/support/multiple_outcome_calls.rb
125
128
  homepage: https://github.com/jspillers/simple_service
126
129
  licenses:
127
130
  - MIT
@@ -154,3 +157,4 @@ test_files:
154
157
  - spec/support/empty_service.rb
155
158
  - spec/support/looping_service.rb
156
159
  - spec/support/modify_foo_bar.rb
160
+ - spec/support/multiple_outcome_calls.rb