usecasing 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MTcyYWZhMWNjZmRmZWIyYzI0Yzc4NTY5ZDMyNzY2MWViYmI1ZmJkOA==
4
+ N2ZiYzViMGUwOGViZTg0NDI2NzhkMjAyMDJmNTI3Mzk4Zjk4ODc2OA==
5
5
  data.tar.gz: !binary |-
6
- M2ZlZmViZGM4MGIwMzIyOWExMmFiMjkyZGVkYjJiNzk2NTY2MDdkNg==
6
+ YmIxNzExYzA2MzljNDFiZTA1M2ZkNWU0MDNlY2VhYWUwOTdhZGZmNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YzQzZTk4MmEzNGU4MjlkMjA5MWQ1MDRhNWQyZGE5MDc0ODdjODAzOTEwOGY0
10
- NmJjM2EzMGQzZDZlZWYwZGRkMzJiMTdjOGE1MWU1YTBiZjZkYmM5YTNlMmEx
11
- NmIzNmMxOGE0NGM1NWQ0MDIyYjYyMDA3ZmJhMmI3Yzk3ZTIzYjM=
9
+ NjhkYTgyODc5MTU2Y2NlN2NmOTEzNjRlY2QzOTM1OGRkMTZmMzE3OTgwM2E1
10
+ NDAxOGMyMDBkYmNmZmNkNTQyYTU2MGJlMDYzZjllYTZiZGE3YTU0OGExOWY2
11
+ MDAxOTA4NWFhYzE2NmE1ZjkyMWE1ZmNjZDI5YjMyNjdlNDFiZmI=
12
12
  data.tar.gz: !binary |-
13
- YzQ3MGQ0Y2Q5MDdiOTRkZmUxNWNiMTg1ODYzZTIwOTg2NGY2M2VhMmQ3N2Rj
14
- NTYzYzQxOTRkZWI5MDJjOWU0ODE0YmU0MDc2YjEwZjMwMjJkMjY4MzBlYjAx
15
- MWM1NzJiMDljYzhiOWNhNDllYjdlYTUxMWEwMTg3ZDEzMjY1NDY=
13
+ OGVhZTAxNWQwNjIwYjUyZjJlMWI0Y2Y4ZjVmM2VmNTNhZmVhNWMyOGI2ZWMw
14
+ MTc4NjE2ZGMzYWMzZmYxMWVjYTAwNmE3MTkwMjJlODBiOTFlYzMwOGYyZTc4
15
+ MjRlYTNhMmU5MGUwOTUzN2Y1MjJjMWM4YmI0OWY5ZjkzNzA4Mzc=
data/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
  ## Installation
5
5
 
6
6
  [![Build Status](https://secure.travis-ci.org/tdantas/usecasing.png)](http://travis-ci.org/tdantas/usecasing)
7
+ [![Dependency Status](https://gemnasium.com/tdantas/usecasing.svg)](https://gemnasium.com/tdantas/usecasing)
8
+
7
9
 
8
10
  Add this line to your application's Gemfile:
9
11
 
@@ -29,6 +29,10 @@ module UseCase
29
29
  @errors.keys.empty?
30
30
  end
31
31
 
32
+ def each(&block)
33
+ @errors.each(&block)
34
+ end
35
+
32
36
  end
33
37
 
34
38
  attr_accessor :errors
@@ -1,3 +1,3 @@
1
1
  module Usecasing
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
data/spec/context_spec.rb CHANGED
@@ -86,5 +86,20 @@ describe UseCase::Context do
86
86
  expect(context.to_hash).to eql({ name: 'thiago' , last_name: 'dantas'})
87
87
  end
88
88
 
89
+ it "iterates successfully over errors" do
90
+ context = described_class.new({})
91
+ context.failure(:error_1, "this is the first error")
92
+ context.failure(:error_2, "this is a second error")
93
+
94
+ errors_keys = [];
95
+ errors_values = [];
96
+ context.errors.each do |k, v|
97
+ errors_keys << k
98
+ errors_values << v;
99
+ end
100
+
101
+ expect(errors_keys).to eql([:error_1, :error_2])
102
+ expect(errors_values).to eql([["this is the first error"], ["this is a second error"]])
103
+ end
89
104
  end
90
105
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usecasing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thiago Dantas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-26 00:00:00.000000000 Z
11
+ date: 2014-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec