f_service 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests-and-linter.yml +1 -1
- data/.rubocop.yml +5 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +56 -37
- data/README.md +10 -5
- data/f_service.gemspec +1 -2
- data/lib/f_service/rspec/support/matchers/result.rb +1 -1
- data/lib/f_service/version.rb +1 -1
- metadata +5 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4997e65a2e3054de3de7a252a3e85143d41701f44046982ffc583c486755aa1d
|
4
|
+
data.tar.gz: ea5212762e5529ec315dac3437d29ac75a5c20058d30fdc382fe31b6f18288a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3c51bf4006bb0b037361690fabb7e0af7895b393394561ed9a784d89ffe063bd48e573406fbee6675e5d3ef5f9ca3f9085240c6855ece5a7a50259dd6264e98
|
7
|
+
data.tar.gz: 7af0dfcf8f92fb8ac39b43efc044c5f623c9c52084b0b1a9542a9d6f1902dbe7444eb5b3b00ec043302dfe9b6e78eb879bc1cb335c2e078930bb15c49a9fe176
|
data/.rubocop.yml
CHANGED
@@ -2,6 +2,7 @@ require:
|
|
2
2
|
- rubocop-rspec
|
3
3
|
|
4
4
|
AllCops:
|
5
|
+
TargetRubyVersion: 3.0.0
|
5
6
|
NewCops: enable
|
6
7
|
|
7
8
|
Layout/LineLength:
|
@@ -31,3 +32,7 @@ RSpec/ExampleLength:
|
|
31
32
|
|
32
33
|
RSpec/NestedGroups:
|
33
34
|
Enabled: false
|
35
|
+
|
36
|
+
##### RUBYGEMS #####
|
37
|
+
Gemspec/RequireMFA:
|
38
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -10,6 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
10
10
|
<!-- ### Removed -->
|
11
11
|
---
|
12
12
|
|
13
|
+
## 0.3.0
|
14
|
+
### Added
|
15
|
+
- Drop Support to Ruby 2.6 and 2.7
|
16
|
+
- Add Support to Ruby 3.2 and 3.3
|
17
|
+
- Changed and_error to use a matcher instead of equality comparation #51
|
18
|
+
|
13
19
|
## 0.3.0
|
14
20
|
### Added
|
15
21
|
- Added Rspec Helper `#mock_service` #41;
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,39 +1,47 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
f_service (0.3.
|
4
|
+
f_service (0.3.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
ast (2.4.
|
10
|
-
backport (1.
|
11
|
-
benchmark (0.
|
9
|
+
ast (2.4.2)
|
10
|
+
backport (1.2.0)
|
11
|
+
benchmark (0.3.0)
|
12
12
|
coderay (1.1.3)
|
13
13
|
diff-lcs (1.3)
|
14
14
|
docile (1.3.5)
|
15
15
|
e2mmap (0.1.0)
|
16
|
-
jaro_winkler (1.5.
|
17
|
-
|
16
|
+
jaro_winkler (1.5.6)
|
17
|
+
json (2.7.1)
|
18
|
+
kramdown (2.4.0)
|
19
|
+
rexml
|
20
|
+
kramdown-parser-gfm (1.1.0)
|
21
|
+
kramdown (~> 2.0)
|
22
|
+
language_server-protocol (3.17.0.3)
|
18
23
|
method_source (1.0.0)
|
19
|
-
mini_portile2 (2.8.
|
20
|
-
nokogiri (1.
|
21
|
-
mini_portile2 (~> 2.8.
|
24
|
+
mini_portile2 (2.8.6)
|
25
|
+
nokogiri (1.16.5)
|
26
|
+
mini_portile2 (~> 2.8.2)
|
22
27
|
racc (~> 1.4)
|
23
|
-
parallel (1.
|
24
|
-
parser (
|
25
|
-
ast (~> 2.4.
|
28
|
+
parallel (1.24.0)
|
29
|
+
parser (3.3.0.5)
|
30
|
+
ast (~> 2.4.1)
|
31
|
+
racc
|
26
32
|
pry (0.14.1)
|
27
33
|
coderay (~> 1.1)
|
28
34
|
method_source (~> 1.0)
|
29
35
|
pry-nav (1.0.0)
|
30
36
|
pry (>= 0.9.10, < 0.15)
|
31
|
-
racc (1.
|
32
|
-
rainbow (3.
|
37
|
+
racc (1.7.3)
|
38
|
+
rainbow (3.1.1)
|
33
39
|
rake (13.0.1)
|
34
|
-
|
40
|
+
regexp_parser (2.9.0)
|
41
|
+
reverse_markdown (2.1.1)
|
35
42
|
nokogiri
|
36
|
-
rexml (3.2.
|
43
|
+
rexml (3.2.8)
|
44
|
+
strscan (>= 3.0.9)
|
37
45
|
rspec (3.9.0)
|
38
46
|
rspec-core (~> 3.9.0)
|
39
47
|
rspec-expectations (~> 3.9.0)
|
@@ -47,53 +55,64 @@ GEM
|
|
47
55
|
diff-lcs (>= 1.2.0, < 2.0)
|
48
56
|
rspec-support (~> 3.9.0)
|
49
57
|
rspec-support (3.9.2)
|
50
|
-
rubocop (
|
51
|
-
|
58
|
+
rubocop (1.60.2)
|
59
|
+
json (~> 2.3)
|
60
|
+
language_server-protocol (>= 3.17.0)
|
52
61
|
parallel (~> 1.10)
|
53
|
-
parser (>=
|
62
|
+
parser (>= 3.3.0.2)
|
54
63
|
rainbow (>= 2.2.2, < 4.0)
|
55
|
-
|
64
|
+
regexp_parser (>= 1.8, < 3.0)
|
65
|
+
rexml (>= 3.2.5, < 4.0)
|
66
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
56
67
|
ruby-progressbar (~> 1.7)
|
57
|
-
unicode-display_width (>=
|
58
|
-
rubocop-
|
59
|
-
|
60
|
-
|
68
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
69
|
+
rubocop-ast (1.30.0)
|
70
|
+
parser (>= 3.2.1.0)
|
71
|
+
rubocop-capybara (2.20.0)
|
72
|
+
rubocop (~> 1.41)
|
73
|
+
rubocop-factory_bot (2.25.1)
|
74
|
+
rubocop (~> 1.41)
|
75
|
+
rubocop-rspec (2.26.1)
|
76
|
+
rubocop (~> 1.40)
|
77
|
+
rubocop-capybara (~> 2.17)
|
78
|
+
rubocop-factory_bot (~> 2.22)
|
79
|
+
ruby-progressbar (1.13.0)
|
61
80
|
simplecov (0.21.2)
|
62
81
|
docile (~> 1.1)
|
63
82
|
simplecov-html (~> 0.11)
|
64
83
|
simplecov_json_formatter (~> 0.1)
|
65
84
|
simplecov-html (0.12.3)
|
66
85
|
simplecov_json_formatter (0.1.2)
|
67
|
-
solargraph (0.
|
86
|
+
solargraph (0.41.2)
|
68
87
|
backport (~> 1.1)
|
69
88
|
benchmark
|
70
89
|
bundler (>= 1.17.2)
|
71
90
|
e2mmap
|
72
91
|
jaro_winkler (~> 1.5)
|
73
|
-
|
74
|
-
|
75
|
-
parser (~>
|
76
|
-
reverse_markdown (
|
77
|
-
rubocop (
|
92
|
+
kramdown (~> 2.3)
|
93
|
+
kramdown-parser-gfm (~> 1.1)
|
94
|
+
parser (~> 3.0)
|
95
|
+
reverse_markdown (>= 1.0.5, < 3)
|
96
|
+
rubocop (>= 0.52)
|
78
97
|
thor (~> 1.0)
|
79
98
|
tilt (~> 2.0)
|
80
|
-
yard (~> 0.9)
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
99
|
+
yard (~> 0.9, >= 0.9.24)
|
100
|
+
strscan (3.1.0)
|
101
|
+
thor (1.3.0)
|
102
|
+
tilt (2.3.0)
|
103
|
+
unicode-display_width (2.5.0)
|
104
|
+
yard (0.9.36)
|
85
105
|
|
86
106
|
PLATFORMS
|
87
107
|
ruby
|
88
108
|
|
89
109
|
DEPENDENCIES
|
90
|
-
bundler (~> 2.0)
|
91
110
|
f_service!
|
92
111
|
pry
|
93
112
|
pry-nav
|
94
113
|
rake (~> 13.0.0)
|
95
114
|
rspec (~> 3.0)
|
96
|
-
rubocop (~>
|
115
|
+
rubocop (~> 1.60.2)
|
97
116
|
rubocop-rspec
|
98
117
|
simplecov
|
99
118
|
solargraph
|
data/README.md
CHANGED
@@ -189,11 +189,14 @@ class UsersController < BaseController
|
|
189
189
|
end
|
190
190
|
```
|
191
191
|
|
192
|
-
###
|
192
|
+
### Type precedence
|
193
193
|
|
194
|
-
FService matches types from left to right, from more specific to more generic.
|
195
|
-
|
196
|
-
|
194
|
+
FService matches the service's types from left to right, from more specific to more generic.
|
195
|
+
For example, the following result `Failure(:unprocessable_entity, :client_error, :http_response)` will match in the following order:
|
196
|
+
1. `:unprocessable_entity`;
|
197
|
+
2. `:client_error`;
|
198
|
+
3. `:http_response`;
|
199
|
+
4. unmatched block;
|
197
200
|
|
198
201
|
### Chaining services
|
199
202
|
|
@@ -277,7 +280,7 @@ require 'f_service/rspec'
|
|
277
280
|
|
278
281
|
### Mocking a result
|
279
282
|
|
280
|
-
```
|
283
|
+
```rb
|
281
284
|
mock_service(Uer::Create)
|
282
285
|
# => Mocks a successful result with all values nil
|
283
286
|
|
@@ -310,6 +313,8 @@ expect(User::Create.(name: 'Joe')).to have_succeed_with(:created).and_value(an_i
|
|
310
313
|
expect(User::Create.(name: nil)).to have_failed_with(:invalid_attributes)
|
311
314
|
|
312
315
|
expect(User::Create.(name: nil)).to have_failed_with(:invalid_attributes).and_error({ name: ["can't be blank"] })
|
316
|
+
|
317
|
+
expect(User::Create.(name: nil)).to have_failed_with(:invalid_attributes).and_error(a_hash_including(name: ["can't be blank"]))
|
313
318
|
```
|
314
319
|
|
315
320
|
## API Docs
|
data/f_service.gemspec
CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.homepage = 'https://github.com/Fretadao/f_service'
|
21
21
|
spec.license = 'MIT'
|
22
|
+
spec.required_ruby_version = '>= 3.0.0'
|
22
23
|
|
23
24
|
spec.metadata['homepage_uri'] = spec.homepage
|
24
25
|
spec.metadata['source_code_uri'] = 'https://github.com/Fretadao/f_service'
|
@@ -33,6 +34,4 @@ Gem::Specification.new do |spec|
|
|
33
34
|
spec.bindir = 'exe'
|
34
35
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
35
36
|
spec.require_paths = ['lib']
|
36
|
-
|
37
|
-
spec.add_development_dependency 'bundler', '~> 2.0'
|
38
37
|
end
|
@@ -6,7 +6,7 @@ RSpec::Matchers.define :have_failed_with do |*expected_types|
|
|
6
6
|
match do |actual|
|
7
7
|
matched = actual.is_a?(FService::Result::Failure) && actual.types == expected_types
|
8
8
|
|
9
|
-
matched &&= actual.error
|
9
|
+
matched &&= values_match?(@expected_error, actual.error) if defined?(@expected_error)
|
10
10
|
|
11
11
|
matched
|
12
12
|
end
|
data/lib/f_service/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: f_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fretadao Tech Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '2.0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '2.0'
|
11
|
+
date: 2024-07-18 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
27
13
|
description: |2
|
28
14
|
FService is a small gem that provides a base class for your services (aka operations).
|
29
15
|
The goal is to make services simpler, safer and more composable.
|
@@ -77,14 +63,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
63
|
requirements:
|
78
64
|
- - ">="
|
79
65
|
- !ruby/object:Gem::Version
|
80
|
-
version:
|
66
|
+
version: 3.0.0
|
81
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
68
|
requirements:
|
83
69
|
- - ">="
|
84
70
|
- !ruby/object:Gem::Version
|
85
71
|
version: '0'
|
86
72
|
requirements: []
|
87
|
-
rubygems_version: 3.
|
73
|
+
rubygems_version: 3.5.11
|
88
74
|
signing_key:
|
89
75
|
specification_version: 4
|
90
76
|
summary: A small, monad-based service class
|