use_case 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/use_case/outcome.rb +2 -1
- data/lib/use_case/version.rb +1 -1
- data/test/use_case/outcome_test.rb +16 -3
- metadata +47 -63
data/lib/use_case/outcome.rb
CHANGED
@@ -62,7 +62,7 @@ module UseCase
|
|
62
62
|
|
63
63
|
def pre_condition_failed
|
64
64
|
yield @failure if block_given?
|
65
|
-
@
|
65
|
+
@failure
|
66
66
|
end
|
67
67
|
|
68
68
|
def to_s
|
@@ -88,6 +88,7 @@ module UseCase
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def symbol
|
91
|
+
return @pre_condition.symbol if @pre_condition.respond_to?(:symbol)
|
91
92
|
klass = @pre_condition.class
|
92
93
|
return klass.symbol if klass.respond_to?(:symbol)
|
93
94
|
klass.name.gsub(/([^A-Z])([A-Z])/, '\1_\2').gsub(/[:_]+/, "_").downcase.to_sym
|
data/lib/use_case/version.rb
CHANGED
@@ -76,12 +76,12 @@ describe UseCase::Outcome do
|
|
76
76
|
refute outcome.success?
|
77
77
|
end
|
78
78
|
|
79
|
-
it "returns failed pre-condition" do
|
79
|
+
it "returns failed pre-condition wrapped" do
|
80
80
|
pre_condition = 42
|
81
81
|
outcome = UseCase::PreConditionFailed.new(pre_condition)
|
82
82
|
returned_pc = outcome.pre_condition_failed
|
83
83
|
|
84
|
-
assert_equal pre_condition, returned_pc
|
84
|
+
assert_equal pre_condition, returned_pc.pre_condition
|
85
85
|
end
|
86
86
|
|
87
87
|
describe "yielded wrapper" do
|
@@ -102,7 +102,7 @@ describe UseCase::Outcome do
|
|
102
102
|
pre_condition = Array.new
|
103
103
|
outcome = UseCase::PreConditionFailed.new(pre_condition)
|
104
104
|
|
105
|
-
|
105
|
+
outcome.pre_condition_failed do |f|
|
106
106
|
f.when(:something) { |pc| yielded = pc }
|
107
107
|
end
|
108
108
|
|
@@ -157,6 +157,19 @@ describe UseCase::Outcome do
|
|
157
157
|
|
158
158
|
assert_equal :something, failure.symbol
|
159
159
|
end
|
160
|
+
|
161
|
+
it "accesses pre-condition instance symbol" do
|
162
|
+
pre_condition = MyPreCondition.new
|
163
|
+
def pre_condition.symbol; :other; end
|
164
|
+
outcome = UseCase::PreConditionFailed.new(pre_condition)
|
165
|
+
failure = nil
|
166
|
+
|
167
|
+
outcome.pre_condition_failed do |f|
|
168
|
+
failure = f
|
169
|
+
end
|
170
|
+
|
171
|
+
assert_equal :other, failure.symbol
|
172
|
+
end
|
160
173
|
end
|
161
174
|
end
|
162
175
|
|
metadata
CHANGED
@@ -1,60 +1,54 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: use_case
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.13.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 12
|
9
|
-
- 0
|
10
|
-
version: 0.12.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Christian Johansen
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-04-15 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: minitest
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
18
|
+
requirements:
|
27
19
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 4
|
32
|
-
version: "4"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '4'
|
33
22
|
type: :development
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: rake
|
37
23
|
prerelease: false
|
38
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
25
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '4'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
47
38
|
type: :development
|
48
|
-
|
49
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description: ''
|
50
47
|
email: christian@gitorious.com
|
51
48
|
executables: []
|
52
|
-
|
53
49
|
extensions: []
|
54
|
-
|
55
50
|
extra_rdoc_files: []
|
56
|
-
|
57
|
-
files:
|
51
|
+
files:
|
58
52
|
- Gemfile
|
59
53
|
- Gemfile.lock
|
60
54
|
- LICENSE
|
@@ -71,41 +65,31 @@ files:
|
|
71
65
|
- test/use_case/validator_test.rb
|
72
66
|
- test/use_case_test.rb
|
73
67
|
- use_case.gemspec
|
74
|
-
has_rdoc: true
|
75
68
|
homepage: http://gitorious.org/gitorious/use_case
|
76
69
|
licenses: []
|
77
|
-
|
78
70
|
post_install_message:
|
79
71
|
rdoc_options: []
|
80
|
-
|
81
|
-
require_paths:
|
72
|
+
require_paths:
|
82
73
|
- lib
|
83
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
75
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
|
89
|
-
|
90
|
-
- 0
|
91
|
-
version: "0"
|
92
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
81
|
none: false
|
94
|
-
requirements:
|
95
|
-
- -
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
|
98
|
-
segments:
|
99
|
-
- 0
|
100
|
-
version: "0"
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
101
86
|
requirements: []
|
102
|
-
|
103
87
|
rubyforge_project:
|
104
|
-
rubygems_version: 1.
|
88
|
+
rubygems_version: 1.8.24
|
105
89
|
signing_key:
|
106
90
|
specification_version: 3
|
107
|
-
summary:
|
108
|
-
test_files:
|
91
|
+
summary: ''
|
92
|
+
test_files:
|
109
93
|
- test/sample_use_case.rb
|
110
94
|
- test/test_helper.rb
|
111
95
|
- test/use_case/outcome_test.rb
|