orc 0.0.1 → 0.0.2
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 +4 -4
- data/.travis.yml +1 -2
- data/README.md +26 -10
- data/config/flog.yml +1 -1
- data/config/rubocop.yml +2 -2
- data/lib/orc.rb +7 -7
- data/lib/orc/version.rb +1 -1
- data/spec/unit/orc/result_spec.rb +26 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 127fd1871659187b605b3e5c18c6e2a1917b9de3
|
4
|
+
data.tar.gz: 6df9ee6fe949ade30692aaa555345e0c858d9201
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 780610dc00606668c4f03c984ff20c8133ffe886da741106172ae037895607fcafcc976cf8de53c73ee2bb13d5a4beac25766a64e3165d8c84b857a709e542e5
|
7
|
+
data.tar.gz: c0b966a22bc7390c43e6b43f02299bdbd523893baf1ed972b23f78810eda6331b0d66a6217273a95873598e5a1ed6a7fd3ad913712ffbdd1877c86b3c99c79fe
|
data/.travis.yml
CHANGED
@@ -6,8 +6,6 @@ rvm:
|
|
6
6
|
- 1.9.3
|
7
7
|
- 2.1.2
|
8
8
|
- ruby-head
|
9
|
-
- jruby-19mode
|
10
|
-
- jruby-head
|
11
9
|
- rbx-2
|
12
10
|
matrix:
|
13
11
|
include:
|
@@ -17,5 +15,6 @@ matrix:
|
|
17
15
|
env: JRUBY_OPTS="$JRUBY_OPTS --debug"
|
18
16
|
allow_failures:
|
19
17
|
- rvm: ruby-head
|
18
|
+
- rvm: jruby-head
|
20
19
|
notifications:
|
21
20
|
email: false
|
data/README.md
CHANGED
@@ -27,7 +27,7 @@ describe Orc::Result do
|
|
27
27
|
expect(subject.success?).to be(true)
|
28
28
|
end
|
29
29
|
|
30
|
-
it 'returns :success
|
30
|
+
it 'returns :success status' do
|
31
31
|
expect(subject.status).to be(:success)
|
32
32
|
end
|
33
33
|
|
@@ -37,21 +37,37 @@ describe Orc::Result do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
describe '.failure' do
|
40
|
-
|
40
|
+
shared_context 'a failure result' do
|
41
|
+
let(:status) { :confused }
|
42
|
+
let(:object) { :context }
|
41
43
|
|
42
|
-
|
43
|
-
|
44
|
+
it 'signals failure' do
|
45
|
+
expect(subject.success?).to be(false)
|
46
|
+
end
|
44
47
|
|
45
|
-
|
46
|
-
|
48
|
+
it 'exposes the associated #object' do
|
49
|
+
expect(subject.object).to be(object)
|
50
|
+
end
|
47
51
|
end
|
48
52
|
|
49
|
-
|
50
|
-
|
53
|
+
context 'when no status is given' do
|
54
|
+
subject { Orc::Result.failure(object) }
|
55
|
+
|
56
|
+
include_context 'a failure result'
|
57
|
+
|
58
|
+
it 'exposes a :failure status' do
|
59
|
+
expect(subject.status).to be(:failure)
|
60
|
+
end
|
51
61
|
end
|
52
62
|
|
53
|
-
|
54
|
-
|
63
|
+
context 'when status is given' do
|
64
|
+
subject { Orc::Result.failure(object, status) }
|
65
|
+
|
66
|
+
include_context 'a failure result'
|
67
|
+
|
68
|
+
it 'exposes the given #status' do
|
69
|
+
expect(subject.status).to be(status)
|
70
|
+
end
|
55
71
|
end
|
56
72
|
end
|
57
73
|
end
|
data/config/flog.yml
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
---
|
2
|
-
threshold: 1.
|
2
|
+
threshold: 1.6
|
data/config/rubocop.yml
CHANGED
data/lib/orc.rb
CHANGED
@@ -21,15 +21,15 @@ module Orc
|
|
21
21
|
|
22
22
|
# Create a result indicating failure
|
23
23
|
#
|
24
|
-
# @param [Object]
|
25
|
-
# an arbitrary status description (symbol)
|
26
|
-
#
|
27
|
-
# @param [Object] context
|
24
|
+
# @param [Object] object
|
28
25
|
# context information associated with the failure
|
29
26
|
#
|
27
|
+
# @param [Object] status
|
28
|
+
# an optional, arbitrary status description (symbol)
|
29
|
+
#
|
30
30
|
# @return [Success]
|
31
|
-
def self.failure(
|
32
|
-
Failure.new(
|
31
|
+
def self.failure(object, status = :failure)
|
32
|
+
Failure.new(object, status)
|
33
33
|
end
|
34
34
|
|
35
35
|
include AbstractType
|
@@ -58,7 +58,7 @@ module Orc
|
|
58
58
|
|
59
59
|
# Result object indicating failure along with status and context
|
60
60
|
class Failure < self
|
61
|
-
include Concord::Public.new(:
|
61
|
+
include Concord::Public.new(:object, :status)
|
62
62
|
|
63
63
|
# Indicate success
|
64
64
|
#
|
data/lib/orc/version.rb
CHANGED
@@ -12,7 +12,7 @@ describe Orc::Result do
|
|
12
12
|
expect(subject.success?).to be(true)
|
13
13
|
end
|
14
14
|
|
15
|
-
it 'returns :success
|
15
|
+
it 'returns :success status' do
|
16
16
|
expect(subject.status).to be(:success)
|
17
17
|
end
|
18
18
|
|
@@ -22,21 +22,37 @@ describe Orc::Result do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
describe '.failure' do
|
25
|
-
|
25
|
+
shared_context 'a failure result' do
|
26
|
+
let(:status) { :confused }
|
27
|
+
let(:object) { :context }
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
+
it 'signals failure' do
|
30
|
+
expect(subject.success?).to be(false)
|
31
|
+
end
|
29
32
|
|
30
|
-
|
31
|
-
|
33
|
+
it 'exposes the associated #object' do
|
34
|
+
expect(subject.object).to be(object)
|
35
|
+
end
|
32
36
|
end
|
33
37
|
|
34
|
-
|
35
|
-
|
38
|
+
context 'when no status is given' do
|
39
|
+
subject { Orc::Result.failure(object) }
|
40
|
+
|
41
|
+
include_context 'a failure result'
|
42
|
+
|
43
|
+
it 'exposes a :failure status' do
|
44
|
+
expect(subject.status).to be(:failure)
|
45
|
+
end
|
36
46
|
end
|
37
47
|
|
38
|
-
|
39
|
-
|
48
|
+
context 'when status is given' do
|
49
|
+
subject { Orc::Result.failure(object, status) }
|
50
|
+
|
51
|
+
include_context 'a failure result'
|
52
|
+
|
53
|
+
it 'exposes the given #status' do
|
54
|
+
expect(subject.status).to be(status)
|
55
|
+
end
|
40
56
|
end
|
41
57
|
end
|
42
58
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Gamsjaeger (snusnu)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concord
|