clean-architecture 1.1.1 → 1.2.0

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: a23ec7e7775cab800b9b090e189276d6e1fe1c69
4
- data.tar.gz: dc91d6bb540f417536cd0c44abe72e96230c7b64
3
+ metadata.gz: 0e9b17c830a7278ecdabf96ed831ec41e730bbdd
4
+ data.tar.gz: 1d4f68de0700753e6163d560a7f6c0d80380b5f8
5
5
  SHA512:
6
- metadata.gz: c40fdd2afd6ddc665ad3173c189d42c8a6fbf2d5196b063e9b4ab66d8760ef4e021619baa13975dc39ee08de31b4af8de6d5991324f2d36b4e6249154de0be1b
7
- data.tar.gz: abf59df881a627b907992eecf5bf49cc725a813fbee2bc77112c49341627bbb1f4ef5658ea1b6ae55e39694c8fb0f5c4a5d94f857432819d70aaa9fc82b30011
6
+ metadata.gz: c7b8bf9a4f6297c0da3843c068b0741c9e33fbd214c7a64d1084df576e5238c2934064c725527fe55f3287cb5fcada3ee75b5e31ef996117915078638d557af1
7
+ data.tar.gz: 433a2e52b95353e0b1f00f1f3c6ea1fbbfaddb1fd3bf21239277bdf92b8c63f422f1432012b3c044587325afacf5dc5d572c7d8db4c1eda08dc333f5a9e9af8b
@@ -1,3 +1,7 @@
1
+ 1.2.0
2
+
3
+ * Support arrays being passed as failure value to UseCaseResult matcher
4
+
1
5
  1.1.1
2
6
 
3
7
  * Remove parameters from use case interface
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- clean-architecture (1.1.1)
4
+ clean-architecture (1.2.0)
5
5
  dry-matcher (~> 0.0)
6
6
  dry-monads (~> 1.0)
7
7
  dry-struct (~> 0.0)
@@ -45,7 +45,7 @@ GEM
45
45
  concurrent-ruby (~> 1.0)
46
46
  dry-core (~> 0.4, >= 0.4.4)
47
47
  dry-equalizer
48
- dry-struct (0.5.1)
48
+ dry-struct (0.6.0)
49
49
  dry-core (~> 0.4, >= 0.4.3)
50
50
  dry-equalizer (~> 0.2)
51
51
  dry-types (~> 0.13)
@@ -16,6 +16,14 @@ module CleanArchitecture
16
16
  attribute :type, FailureTypes
17
17
  attribute :message, Types::Strict::String
18
18
  attribute :other_properties, Types::Strict::Hash.default({})
19
+
20
+ def self.from_array(array)
21
+ new(message: array.map(&:to_s).join(', '), other_properties: {}, type: 'error')
22
+ end
23
+
24
+ def self.from_string(string)
25
+ new(message: string, other_properties: {}, type: 'error')
26
+ end
19
27
  end
20
28
  end
21
29
  end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'clean_architecture/entities/failure_details'
3
4
  require 'dry-matcher'
5
+ require 'dry/monads/all'
4
6
 
5
7
  module CleanArchitecture
6
8
  module Matchers
@@ -32,12 +34,15 @@ module CleanArchitecture
32
34
  def resolve_failure_value(value)
33
35
  failure = value.failure
34
36
  case failure
37
+ when Array
38
+ Entities::FailureDetails.from_array(failure)
35
39
  when String
36
- Entities::FailureDetails.new(message: failure, other_properties: {}, type: 'error')
40
+ Entities::FailureDetails.from_string(failure)
37
41
  when Entities::FailureDetails
38
42
  failure
39
43
  else
40
- raise 'Unexpected failure value - must be String or Entities::FailureDetails'
44
+ type_list = [Array, String, Entities::FailureDetails].map(&:to_s).join(' or ')
45
+ raise ArgumentError, "Unexpected failure value - must be #{type_list}"
41
46
  end
42
47
  end
43
48
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CleanArchitecture
4
- VERSION = '1.1.1'
4
+ VERSION = '1.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clean-architecture
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bellroy Tech Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-22 00:00:00.000000000 Z
11
+ date: 2018-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-matcher