simple_command 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/simple_command/errors.rb +2 -2
- data/lib/simple_command/version.rb +1 -1
- data/spec/simple_command/errors_spec.rb +3 -3
- data/spec/simple_command_spec.rb +3 -3
- 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: dd27f8350ae4a2243a2f2bde7f2481edda37ee2e
|
4
|
+
data.tar.gz: dcf03e07231a348a26747e94d346c20c77d119c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c2ddec2804d8f4c60376bb562e8e82cf753fcbed65dfd8713cfecec668592c2b67267d1bd1036db5507dd999ddb6083fc12b402f2b3f8da7d7da262024881c6
|
7
|
+
data.tar.gz: 471b1498238e7a5e444d2f61af683ed78c823dc24b300dcd7f38f2629f50e187731fb3d4adc6b38b4178f03bb2fc36e2e435ae017c7e25b865f02b81be108899
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@ module SimpleCommand
|
|
2
2
|
class NotImplementedError < ::StandardError; end
|
3
3
|
|
4
4
|
class Errors < Hash
|
5
|
-
def
|
5
|
+
def add(key, value, _opts = {})
|
6
6
|
self[key] ||= []
|
7
7
|
self[key] << value
|
8
8
|
self[key].uniq!
|
@@ -10,7 +10,7 @@ module SimpleCommand
|
|
10
10
|
|
11
11
|
def add_multiple_errors(errors_hash)
|
12
12
|
errors_hash.each do |key, values|
|
13
|
-
values.each { |value|
|
13
|
+
values.each { |value| add key, value }
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -3,9 +3,9 @@ require 'spec_helper'
|
|
3
3
|
describe SimpleCommand::Errors do
|
4
4
|
let(:errors) { SimpleCommand::Errors.new }
|
5
5
|
|
6
|
-
describe '#
|
6
|
+
describe '#add' do
|
7
7
|
before do
|
8
|
-
errors.
|
8
|
+
errors.add :some_error, 'some error description'
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'adds the error' do
|
@@ -13,7 +13,7 @@ describe SimpleCommand::Errors do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'adds the same error only once' do
|
16
|
-
errors.
|
16
|
+
errors.add :some_error, 'some error description'
|
17
17
|
expect(errors[:some_error]).to eq(['some error description'])
|
18
18
|
end
|
19
19
|
end
|
data/spec/simple_command_spec.rb
CHANGED
@@ -40,7 +40,7 @@ describe SimpleCommand do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'is false if something went wrong' do
|
43
|
-
command.errors.
|
43
|
+
command.errors.add(:some_error, 'some message')
|
44
44
|
expect(command.call.success?).to be_falsy
|
45
45
|
end
|
46
46
|
|
@@ -69,7 +69,7 @@ describe SimpleCommand do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'is true if something went wrong' do
|
72
|
-
command.errors.
|
72
|
+
command.errors.add(:some_error, 'some message')
|
73
73
|
expect(command.call.failure?).to be_truthy
|
74
74
|
end
|
75
75
|
|
@@ -93,7 +93,7 @@ describe SimpleCommand do
|
|
93
93
|
|
94
94
|
context 'with errors' do
|
95
95
|
before do
|
96
|
-
command.errors.
|
96
|
+
command.errors.add(:some_error, 'some message')
|
97
97
|
end
|
98
98
|
|
99
99
|
it 'has a key with error message' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrea Pavoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|