solid_use_case 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50ac616300a91a04f78a2a4934820b138485bda7
4
- data.tar.gz: 343dcee1c7461a90bb05d9f690ec3e3adfbc9040
3
+ metadata.gz: 5853f9c2cc3e82eff481ae6b09ada0776056bbfb
4
+ data.tar.gz: 763ba2e09c2aa6eed51d07c1115f6d1e86d62df9
5
5
  SHA512:
6
- metadata.gz: 0bd5934d65811ec08f7a36086c114319fc08dfcd6928af573753107bbdfee9c15faa88e1512e8cba2062bff8433f047aca97fbac2c9fe1b18f5713e414dab300
7
- data.tar.gz: 47984ff8d514e5b4ec51f785fae3c7495a1b22a41529890ba3ea2c2793f710076d515011373f8e3d2dd0c954187356341e65dd0b045d84e398f323b496e95f80
6
+ metadata.gz: 0f0648d01b73747acc258c454d0a05aefd706d4dfffaa0e21e73454ee37d654f49d5bcc6bff53131d1e4f84070e6cff2bce56f1efcf0536ea553a10f736ca7bc
7
+ data.tar.gz: be6051006b7f0e7a7ae117c2d8a630724e093ded9fb1bd71dd1771ea5e728478568704bfe94baf6c4aabdfb3b43b36d00ebc69bfb7d0e2d27e59e90a9729be63
data/README.md CHANGED
@@ -2,11 +2,13 @@
2
2
 
3
3
  **Solid Use Case** is a gem to help you implement well-tested and flexible use cases. Solid Use Case is not a framework - it's a **design pattern library**. This means it works *with* your app's workflow, not against it.
4
4
 
5
+ [See the Austin on Rails presentation slides](http://library.makersquare.com/learn/fp-in-rails)
6
+
5
7
  ## Installation
6
8
 
7
9
  Add this line to your application's Gemfile:
8
10
 
9
- gem 'solid_use_case', '~> 2.1.1'
11
+ gem 'solid_use_case', '~> 2.1.2'
10
12
 
11
13
  And then execute:
12
14
 
@@ -58,5 +58,14 @@ module SolidUseCase
58
58
 
59
59
  alias :maybe_continue :check_exists
60
60
  alias :continue :Success
61
+
62
+ def self.success(value)
63
+ Success(value)
64
+ end
65
+
66
+ def self.failure(type, data={})
67
+ data[:type] = type
68
+ Failure(ErrorStruct.new(data))
69
+ end
61
70
  end
62
71
  end
@@ -1,3 +1,3 @@
1
1
  module SolidUseCase
2
- VERSION = "2.1.1"
2
+ VERSION = "2.1.2"
3
3
  end
data/spec/either_spec.rb CHANGED
@@ -91,7 +91,7 @@ describe SolidUseCase::Either do
91
91
  end
92
92
  end
93
93
 
94
- it "doesn't run the next step a failure occures" do
94
+ it "doesn't run the next step if a failure occures" do
95
95
  expect { ShortCircuit.run }.to_not raise_error
96
96
  end
97
97
  end
@@ -131,4 +131,19 @@ describe SolidUseCase::Either do
131
131
  expect(matched).to eq true
132
132
  end
133
133
  end
134
+
135
+ describe 'Literals' do
136
+ it "creates a success literal" do
137
+ s = SolidUseCase::Either.success(10)
138
+ expect(s).to be_a_success
139
+ expect(s.value).to eq 10
140
+ end
141
+
142
+ it "creates a failure literal" do
143
+ f = SolidUseCase::Either.failure(:mock, x: 20)
144
+ expect(f).to_not be_a_success
145
+ expect(f).to fail_with :mock
146
+ expect(f.value[:x]).to eq 20
147
+ end
148
+ end
134
149
  end
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solid_use_case
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gilbert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-16 00:00:00.000000000 Z
11
+ date: 2018-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deterministic
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.6.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
26
  version: 0.6.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
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
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 2.14.1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 2.14.1
69
69
  description: Create use cases the way they were meant to be. Easily verify inputs
@@ -74,8 +74,8 @@ executables: []
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
- - .gitignore
78
- - .rspec
77
+ - ".gitignore"
78
+ - ".rspec"
79
79
  - Gemfile
80
80
  - LICENSE.txt
81
81
  - README.md
@@ -102,17 +102,17 @@ require_paths:
102
102
  - lib
103
103
  required_ruby_version: !ruby/object:Gem::Requirement
104
104
  requirements:
105
- - - ~>
105
+ - - "~>"
106
106
  - !ruby/object:Gem::Version
107
107
  version: '2.0'
108
108
  required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - '>='
110
+ - - ">="
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  requirements: []
114
114
  rubyforge_project:
115
- rubygems_version: 2.2.2
115
+ rubygems_version: 2.6.13
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: A flexible UseCase pattern that works *with* your workflow, not against it.
@@ -121,4 +121,3 @@ test_files:
121
121
  - spec/either_spec.rb
122
122
  - spec/rspec_matchers_spec.rb
123
123
  - spec/spec_helper.rb
124
- has_rdoc: