rspec-dry-struct 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/rspec/dry/struct/matcher.rb +26 -1
- data/lib/rspec/dry/struct/version.rb +2 -2
- data/rspec-dry-struct.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ff418f131c19ff9a7733f3a2df8102e9d3cf31c
|
4
|
+
data.tar.gz: dd0a772bc326b195a4e682abe31ba0c4453ecb8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f905aa87bfe132182d771b3cc18df1b0acc048482c732503739e3a8a2807d7a024ac51b45dd85cd2c59393813188129981f694e08a1170b03ad51b117102d722
|
7
|
+
data.tar.gz: fefe5550e4455f1d44ee0a79cb0808c1d4fb0cd68c49a49566aea49b8f3e6fc77b93fa3f05892f57b3af085d0c76de87344a1d08dcf40c75361f80b61dde65bb
|
data/README.md
CHANGED
@@ -10,7 +10,32 @@ module RSpec
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def matches?(actual)
|
13
|
-
actual
|
13
|
+
@actual = actual
|
14
|
+
@actual_attribute = actual.schema[@attr_name]
|
15
|
+
@actual_attribute == @attr_type
|
16
|
+
end
|
17
|
+
|
18
|
+
def description
|
19
|
+
"have #{@attr_name.inspect} attribute"
|
20
|
+
end
|
21
|
+
|
22
|
+
def failure_message
|
23
|
+
return attr_not_found_message(@actual) if @actual_attribute.nil?
|
24
|
+
attr_type_mismatch_message(@actual)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def attr_not_found_message(actual)
|
30
|
+
"#{expected_message(actual)}, but it was not found"
|
31
|
+
end
|
32
|
+
|
33
|
+
def attr_type_mismatch_message(actual)
|
34
|
+
"#{expected_message(actual)}, but type is wrong"
|
35
|
+
end
|
36
|
+
|
37
|
+
def expected_message(actual)
|
38
|
+
"expected #{actual} to have #{@attr_name.inspect} attribute"
|
14
39
|
end
|
15
40
|
end
|
16
41
|
end
|
data/rspec-dry-struct.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'rspec/dry/struct/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'rspec-dry-struct'
|
8
|
-
spec.version =
|
8
|
+
spec.version = RSpec::Dry::Struct::VERSION
|
9
9
|
spec.authors = ['Sergey Kukunin']
|
10
10
|
spec.email = ['sergey.kukunin@gmail.com']
|
11
11
|
|