schema_conformist 0.1.1 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29e3c7aae3756274d33870d4738b44d712aeae2a
4
- data.tar.gz: 886f45cbbe1c9fee58773637c52cfb4a9cae7f67
3
+ metadata.gz: ec3485574ecb3f1b4165d470a4ba8cf9cfea2afd
4
+ data.tar.gz: 6e1672078fc76c513aef48521a2220d755c7c860
5
5
  SHA512:
6
- metadata.gz: 98e7eb8623de0081ce52e6208b94f52d3b91028fce5e3a962254eb424bb6a47f0a5443d8d6f1ba71da4ac46333da20566dfdb8aae7cec7976ee16898499f6492
7
- data.tar.gz: 4195bcd58d4547822e907a81306d0cd9e77aba240fd38f4a9f7dc2ab22cfa9d7ddde9a7f79bce93d158e797d47d97df62adf4e75bfa5912be648dc9277a62b59
6
+ metadata.gz: b04cd4aeeae5d0476c412553a7372ed4cfb955b7468b624b82e68d38313e3022e56e2ec22defcb0ae8d70017e3cc0502d8a85a9168f409dcec1c25efb97edf76
7
+ data.tar.gz: '07193a36056c3e848b1c0e3dfe2f9fcc3d33c439e944f1ed85dc7847a9c78133a195d9f8dc79ddaa227c68b665ad00ee1cd1044da9b29f10aa69d30fca41ed74'
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # SchemaConformist
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/schema_conformist.svg)](https://badge.fury.io/rb/schema_conformist) [![CircleCI](https://circleci.com/gh/kymmt90/schema_conformist.svg?style=svg)](https://circleci.com/gh/kymmt90/schema_conformist)
4
+
3
5
  > An automatic JSON response validator for testing in Rails
4
6
 
5
7
  SchemaConformist is an automatic JSON response validator for your API testing in Rails.
@@ -3,11 +3,15 @@ module SchemaConformist
3
3
  include Committee::Rails::Test::Methods
4
4
 
5
5
  def committee_schema
6
- @committee_schema ||=
7
- begin
8
- schema_hash = JSON.parse(File.read(schema_path))
9
- driver.parse(schema_hash)
10
- end
6
+ @committee_schema ||= driver.parse(schema_hash)
7
+ end
8
+
9
+ def schema_hash(schema_data = File.read(schema_path))
10
+ if %w(.yaml .yml).include?(File.extname(schema_path))
11
+ YAML.safe_load(schema_data)
12
+ else
13
+ JSON.parse(schema_data)
14
+ end
11
15
  end
12
16
 
13
17
  def schema_path
@@ -1,3 +1,3 @@
1
1
  module SchemaConformist
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_conformist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kohei Yamamoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-06 00:00:00.000000000 Z
11
+ date: 2017-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails