rspec-dry-struct 0.4.0 → 0.5.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
  SHA256:
3
- metadata.gz: f38ccabc288f56d7173f46c1fc665b0d86286707381f0f2e3c2bc679c34bb682
4
- data.tar.gz: 1469179551f6e6a1563a335f8cee230030aa7512c554630710b853c748aa90d9
3
+ metadata.gz: a38aca21d268b46948b7a1df4da3373a7e24fd2b58efbb59bd1721cb0fae875a
4
+ data.tar.gz: 48b8b65549be390c7320d6719379d30a97f8a09c3c57c5d83b21ee249ca48ff9
5
5
  SHA512:
6
- metadata.gz: 6189a2a9309600751857481b06466e3e3dc6acd9f69fd8356080e2bdf12dc77ac609c587373a05d2d4fd6a0660ad6e26adea16852fc732e256eebdeb02bda132
7
- data.tar.gz: 91f25841a7f0ae76fa7fc3f12ad03927cebfe4fb5dda94b490ab8efb8e407235b7d5457048b03337846e111ced95e63e1e2bb64e07ad3d82feb594900aaccb05
6
+ metadata.gz: 5f960bee1582252848de5250b2f2d26f97f2967e161e57cfe89283bc41ff552a44b1ec8d5bc58470056aa15055f5f28ad8263a327628bc3a0d8d10a026fb1203
7
+ data.tar.gz: 0bcf65a2fe0fd2d6da8674a5a27a2533af0fecee5638238f77d451add49644663733ee26c52f69cce994950c747cbc522ed50fde6a76541514ce9c5e44e2e390
data/README.md CHANGED
@@ -76,5 +76,5 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
76
76
 
77
77
  ## Contributing
78
78
 
79
- Bug reports and pull requests are welcome on GitHub at https://github.com/Kukunin/rspec-dry-struct.
79
+ Bug reports and pull requests are welcome on GitHub at https://github.com/matic-insurance/rspec-dry-struct.
80
80
 
@@ -11,10 +11,12 @@ module RSpec
11
11
 
12
12
  def matches?(actual)
13
13
  @actual = actual
14
- @actual_attribute = actual.schema.key(@attr_name).type
15
- correct_attr_type?
16
- rescue KeyError
17
- false
14
+ attribute = actual.schema.find do |attr|
15
+ attr.name == @attr_name
16
+ end
17
+ @actual_attribute = attribute.type if attribute
18
+
19
+ attr_present? && correct_attr_type?
18
20
  end
19
21
 
20
22
  def description
@@ -32,6 +34,10 @@ module RSpec
32
34
 
33
35
  private
34
36
 
37
+ def attr_present?
38
+ !@actual_attribute.nil?
39
+ end
40
+
35
41
  def correct_attr_type?
36
42
  @attr_type.nil? || @actual_attribute == @attr_type
37
43
  end
@@ -1,7 +1,7 @@
1
1
  module RSpec
2
2
  module Dry
3
3
  module Struct
4
- VERSION = '0.4.0'.freeze
4
+ VERSION = '0.5.0'.freeze
5
5
  end
6
6
  end
7
7
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = 'RSpec matcher for dry-struct gem'
13
13
  spec.description = 'RSpec `have_attribute` matcher for dry-struct gem'
14
- spec.homepage = 'https://github.com/Kukunin/rspec-dry-struct'
14
+ spec.homepage = 'https://github.com/matic-insurance/rspec-dry-struct'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
17
  f.match(%r{^(test|spec|features)/})
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_runtime_dependency 'rspec'
24
24
  spec.add_runtime_dependency 'dry-struct'
25
+ spec.add_runtime_dependency 'dry-types', '>= 0.15.0'
25
26
 
26
27
  spec.add_development_dependency 'bundler'
27
28
  spec.add_development_dependency 'rspec-its'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-dry-struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Kukunin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-09 00:00:00.000000000 Z
11
+ date: 2020-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: dry-types
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 0.15.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.15.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -101,7 +115,7 @@ files:
101
115
  - lib/rspec/dry/struct/matcher.rb
102
116
  - lib/rspec/dry/struct/version.rb
103
117
  - rspec-dry-struct.gemspec
104
- homepage: https://github.com/Kukunin/rspec-dry-struct
118
+ homepage: https://github.com/matic-insurance/rspec-dry-struct
105
119
  licenses: []
106
120
  metadata: {}
107
121
  post_install_message: