blackbriar 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/blackbriar/rspec/matchers.rb +35 -2
- data/lib/blackbriar/version.rb +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: 7365bf06ad8930316900235ff8358b91695bc010
|
4
|
+
data.tar.gz: eb4b9a3689a3987cd2992df1b6357c179ea2ff4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc64b13e4300e7e83d0b0cb4e8ae7f16e245620c6d8cd2b9ed460f4929d3eae6c2bd7cf96e33892e1648e156fc39c5ef9a6cd983620e275a6030c0f51c4e3d8c
|
7
|
+
data.tar.gz: 5a378970d9a5a3836f23c5ab069af0d3675de3476921c85d73b60e31092c926260b0d4254d19fb6407bab20f3c39b74ad313ff5054a899d48b354ebc3c1c2c85
|
@@ -48,7 +48,7 @@ RSpec::Matchers.define :match_json_schema do |schema|
|
|
48
48
|
# Parse and expand the schema definition
|
49
49
|
@schema = JsonSchema.parse!(YAML.load(File.read(schema_path)))
|
50
50
|
elsif schema.kind_of? Hash
|
51
|
-
@schema = JsonSchema.parse!(schema)
|
51
|
+
@schema = JsonSchema.parse!(schema.deep_stringify_keys)
|
52
52
|
end
|
53
53
|
|
54
54
|
@schema.expand_references!
|
@@ -67,9 +67,42 @@ RSpec::Matchers.define :match_json_schema do |schema|
|
|
67
67
|
end
|
68
68
|
|
69
69
|
failure_message do
|
70
|
-
binding.pry
|
71
70
|
@errors
|
72
71
|
end
|
73
72
|
end
|
74
73
|
|
75
74
|
RSpec::Matchers.define_negated_matcher :not_match_json_schema, :match_json_schema
|
75
|
+
|
76
|
+
RSpec::Matchers.define :have_errors_at do |map|
|
77
|
+
error_schema = {
|
78
|
+
type: "object",
|
79
|
+
properties: {
|
80
|
+
errors: {
|
81
|
+
type: "array"
|
82
|
+
}
|
83
|
+
},
|
84
|
+
required: ["errors"]
|
85
|
+
}
|
86
|
+
|
87
|
+
define_method :matches? do |actual|
|
88
|
+
value = Blackbriar::ValueProvider.new(actual).resolve(map)
|
89
|
+
expect(value).to match_json_schema error_schema
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
RSpec::Matchers.define :not_have_errors_at do |map|
|
94
|
+
error_schema = {
|
95
|
+
type: "object",
|
96
|
+
properties: {
|
97
|
+
errors: {
|
98
|
+
type: "array"
|
99
|
+
}
|
100
|
+
},
|
101
|
+
required: ["errors"]
|
102
|
+
}
|
103
|
+
|
104
|
+
define_method :matches? do |actual|
|
105
|
+
value = Blackbriar::ValueProvider.new(actual).resolve(map)
|
106
|
+
expect(value).to not_match_json_schema error_schema
|
107
|
+
end
|
108
|
+
end
|
data/lib/blackbriar/version.rb
CHANGED