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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1e044db947afd477d7b8042fbd679fdffbd8a63
4
- data.tar.gz: 021cfb1817dd007895a76184af0db53095c0c9a1
3
+ metadata.gz: dd27f8350ae4a2243a2f2bde7f2481edda37ee2e
4
+ data.tar.gz: dcf03e07231a348a26747e94d346c20c77d119c5
5
5
  SHA512:
6
- metadata.gz: 0a88837defef4d2cc6f3c7167e0f891f73dd09ff6378a5719df8772e8a4f1bdd7cd22043ca29b3596d9e53d619c9a714d03c2107a27d3746150c8f3d167d2730
7
- data.tar.gz: ea8a66ec330153ba06932837a9795d7931c3741faed743c3ebdaa40e211ffde726a173121a84c6a91c89cca5561308373d04aca9d0a776764ce195d8f75694f2
6
+ metadata.gz: 3c2ddec2804d8f4c60376bb562e8e82cf753fcbed65dfd8713cfecec668592c2b67267d1bd1036db5507dd999ddb6083fc12b402f2b3f8da7d7da262024881c6
7
+ data.tar.gz: 471b1498238e7a5e444d2f61af683ed78c823dc24b300dcd7f38f2629f50e187731fb3d4adc6b38b4178f03bb2fc36e2e435ae017c7e25b865f02b81be108899
data/README.md CHANGED
@@ -44,7 +44,7 @@ class AuthenticateUser
44
44
  if user = User.authenticate(@email, @password)
45
45
  return user
46
46
  else
47
- errors.add_error(authentication: I18n.t "authenticate_user.failure")
47
+ errors.add(authentication: I18n.t "authenticate_user.failure")
48
48
  end
49
49
  nil
50
50
  end
@@ -2,7 +2,7 @@ module SimpleCommand
2
2
  class NotImplementedError < ::StandardError; end
3
3
 
4
4
  class Errors < Hash
5
- def add_error(key, value)
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| add_error key, value }
13
+ values.each { |value| add key, value }
14
14
  end
15
15
  end
16
16
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleCommand
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.9'
3
3
  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 '#add_error' do
6
+ describe '#add' do
7
7
  before do
8
- errors.add_error :some_error, 'some error description'
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.add_error :some_error, 'some error description'
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
@@ -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.add_error(:some_error, 'some message')
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.add_error(:some_error, 'some message')
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.add_error(:some_error, 'some message')
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.8
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-19 00:00:00.000000000 Z
11
+ date: 2015-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler