yyks_simple_command 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yyks_simple_command/errors.rb +11 -0
- data/lib/yyks_simple_command/version.rb +1 -1
- data/spec/yyks_simple_command/errors_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 141f232dfaf02d31bbd6bdc05f8d917ee099f96047d4a38cc21e6d1bb222beb8
|
4
|
+
data.tar.gz: 004544f7b657b5b9b6ea7018434c88e458f27f0186f41e195ccce027f5453124
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14540254963e72c81777156c2a8896916886e2f0f3bf4338115c5bda5a57700b47c6b26f8a8bd24a143ffe3ae05de7d0f20cbfe3e264b8e9afbc8bf0a184c1e9
|
7
|
+
data.tar.gz: 299b44963728374ce5511c48f112e001af7d3d635a2a406adf84d6d3f0f33561dee5f630ac3034ae37e07fdb22ea974499b3e25d0ac6e89d980b94afc91e30aa
|
@@ -19,5 +19,16 @@ module SimpleCommand
|
|
19
19
|
self[field].each { |message| yield field, message }
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
def full_messages
|
24
|
+
map { |attribute, message| full_message(attribute, message) }
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
def full_message(attribute, message)
|
29
|
+
return message if attribute == :base
|
30
|
+
attr_name = attribute.to_s.tr('.', '_').capitalize
|
31
|
+
"%s %s" % [attr_name, message]
|
32
|
+
end
|
22
33
|
end
|
23
34
|
end
|
@@ -55,4 +55,17 @@ describe SimpleCommand::Errors do
|
|
55
55
|
)
|
56
56
|
end
|
57
57
|
end
|
58
|
+
|
59
|
+
describe '#full_messages' do
|
60
|
+
before do
|
61
|
+
errors.add :attr1, 'has an error'
|
62
|
+
errors.add :attr2, 'has an error'
|
63
|
+
errors.add :attr2, 'has two errors'
|
64
|
+
end
|
65
|
+
|
66
|
+
it "returrns the full messages array" do
|
67
|
+
expect(errors.full_messages).to eq ["Attr1 has an error", "Attr2 has an error", "Attr2 has two errors"]
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
58
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yyks_simple_command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Moicen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|