activeinteractor 1.0.3 → 1.0.4

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
  SHA256:
3
- metadata.gz: bb760f4036450f632f5734d8575389462d80019152811ea20479754b04754aa2
4
- data.tar.gz: ebc3326b09daec0e2b654a29014794aedf9e3d508d869d3b4aa1e180bf9b2fc8
3
+ metadata.gz: 27a9224897436b0f0c13ca2f34c728f26309d19580cab050b23460cfe2aa8b9e
4
+ data.tar.gz: 4ca49b278929696a601f551f393641b107773d9cc30780954a49f4cd02193f35
5
5
  SHA512:
6
- metadata.gz: 1358b3923eb46838102b5e5e6c84021465cd3ade38954e9a36432019491e598f1d4b6aa2a1467816d81753a59d47d5205a10f5fa1fad2212110d926266ef20ae
7
- data.tar.gz: 6318ca357ceba0628cbc13dec29bfe7971b8c5341a31f11c1b930ba060bc311b79813548fe73b99a4a689bb10019f9b02ea4e2c62d8753e260a47521a57c63f1
6
+ metadata.gz: c51d11ddd7bc484646e7e7aae24f136ce257b7d377b2d70e3a6da1dbeacffaa6bf4dfbd6d96ee7fc2be7ab5709ed44e02ad5278ba6ad91524c34b4e941407f8c
7
+ data.tar.gz: 2b2ef09ee580e8cfb64af433753ffe1ae694dcc54cf01e9b345930a7b16a429117964d3e11bc3a9747e67c1cdfd979820bd5376490f8f2201e21e72a00fce863
data/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning].
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [v1.0.4] - 2020-02-11
11
+
12
+ ### Fixed
13
+
14
+ - [\#184](https://github.com/aaronmallen/activeinteractor/issues/184) `ActiveInteractor::Context::Base#fail!` error
15
+ message gets pupulated 3 times with the same message.
16
+
10
17
  ## [v1.0.3] - 2020-02-10
11
18
 
12
19
  ### Added
@@ -188,7 +195,8 @@ and this project adheres to [Semantic Versioning].
188
195
 
189
196
  <!-- versions -->
190
197
 
191
- [Unreleased]: https://github.com/aaronmallen/activeinteractor/compare/v1.0.3...HEAD
198
+ [Unreleased]: https://github.com/aaronmallen/activeinteractor/compare/v1.0.4...HEAD
199
+ [v1.0.4]: https://github.com/aaronmallen/activeinteractor/compare/v1.0.3...v1.0.4
192
200
  [v1.0.3]: https://github.com/aaronmallen/activeinteractor/compare/v1.0.2...v1.0.3
193
201
  [v1.0.2]: https://github.com/aaronmallen/activeinteractor/compare/v1.0.1...v1.0.2
194
202
  [v1.0.1]: https://github.com/aaronmallen/activeinteractor/compare/v1.0.0...v1.0.1
@@ -18,6 +18,11 @@ module ActiveInteractor
18
18
 
19
19
  private
20
20
 
21
+ def clear_all_errors
22
+ errors.clear
23
+ failure_errors.clear
24
+ end
25
+
21
26
  def handle_errors(errors)
22
27
  if errors.is_a?(String)
23
28
  failure_errors.add(:context, errors)
@@ -33,7 +38,9 @@ module ActiveInteractor
33
38
  end
34
39
 
35
40
  def resolve_errors
36
- errors.merge!(failure_errors)
41
+ all_errors = (failure_errors.uniq + errors.uniq).compact.uniq
42
+ clear_all_errors
43
+ all_errors.each { |error| errors.add(error[0], error[1]) }
37
44
  end
38
45
  end
39
46
  end
@@ -3,5 +3,5 @@
3
3
  module ActiveInteractor
4
4
  # The ActiveInteractor version
5
5
  # @return [String] the ActiveInteractor version
6
- VERSION = '1.0.3'
6
+ VERSION = '1.0.4'
7
7
  end
@@ -83,6 +83,7 @@ RSpec.describe 'A basic organizer', type: :integration do
83
83
  it { expect { subject }.not_to raise_error }
84
84
  it { is_expected.to be_a interactor_class.context_class }
85
85
  it { is_expected.to be_failure }
86
+ it { expect(subject.errors.count).to eq 1 }
86
87
  it 'is expected to have errors "something went wrong" on :context' do
87
88
  expect(subject.errors[:context]).not_to be_empty
88
89
  expect(subject.errors[:context]).to include 'something went wrong'
@@ -125,6 +126,7 @@ RSpec.describe 'A basic organizer', type: :integration do
125
126
  it { expect { subject }.not_to raise_error }
126
127
  it { is_expected.to be_a interactor_class.context_class }
127
128
  it { is_expected.to be_failure }
129
+ it { expect(subject.errors.count).to eq 1 }
128
130
  it 'is expected to have errors "something went wrong" on :context' do
129
131
  expect(subject.errors[:context]).not_to be_empty
130
132
  expect(subject.errors[:context]).to include 'something went wrong'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeinteractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Allen
@@ -201,10 +201,10 @@ licenses:
201
201
  - MIT
202
202
  metadata:
203
203
  bug_tracker_uri: https://github.com/aaronmallen/activeinteractor/issues
204
- changelog_uri: https://github.com/aaronmallen/activeinteractor/blob/v1.0.3/CHANGELOG.md
205
- documentation_uri: https://www.rubydoc.info/gems/activeinteractor/1.0.3
204
+ changelog_uri: https://github.com/aaronmallen/activeinteractor/blob/v1.0.4/CHANGELOG.md
205
+ documentation_uri: https://www.rubydoc.info/gems/activeinteractor/1.0.4
206
206
  hompage_uri: https://github.com/aaronmallen/activeinteractor
207
- source_code_uri: https://github.com/aaronmallen/activeinteractor/tree/v1.0.3
207
+ source_code_uri: https://github.com/aaronmallen/activeinteractor/tree/v1.0.4
208
208
  wiki_uri: https://github.com/aaronmallen/activeinteractor/wiki
209
209
  post_install_message:
210
210
  rdoc_options: []