json_schema_spec 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/json_schema_spec.gemspec +1 -1
- data/lib/json_schema_spec.rb +9 -2
- 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: 48ab6015e4091f951a7967e892143a493264edff
|
4
|
+
data.tar.gz: 10bc27bd209f637b5b58ec70df044ebb056e94e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dd1be9db2f630c3ce51f6bc44459b21173a8ba5f13cdafc877fbacd25c6f4abd9289cc397cb164082c2aa7901e53c4b6ac275d6f55a46ddfc509bb43ce05f0a
|
7
|
+
data.tar.gz: bc81d4ad01f6c477d6288c0136c48c21bee6c66359fcbd072b6599e5904ce5996284b7dcf2a54df3170845ec0f0ceba36d8a318d5855eea140041c0f5167778b
|
data/json_schema_spec.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "json_schema_spec"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.2"
|
8
8
|
spec.authors = ["Winton Welsh"]
|
9
9
|
spec.email = ["mail@wintoni.us"]
|
10
10
|
spec.description = %q{Generate fixtures from JSON schemas.}
|
data/lib/json_schema_spec.rb
CHANGED
@@ -72,8 +72,15 @@ module JsonSchemaSpec
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def pick_json_schema
|
75
|
-
if defined?(Rails)
|
76
|
-
|
75
|
+
if defined?(Rails)
|
76
|
+
path = "/schema.json"
|
77
|
+
uri = URI.parse(path)
|
78
|
+
env = Rack::MockRequest.env_for(uri, 'HTTP_ACCEPT' => 'application/json')
|
79
|
+
params = Rails.application.routes.recognize_path(path)
|
80
|
+
controller = "#{params[:controller]}_controller".camelize.constantize
|
81
|
+
endpoint = controller.action(params[:action])
|
82
|
+
|
83
|
+
JSON.parse(endpoint.call(env)[2].body)
|
77
84
|
else
|
78
85
|
path = "#{File.expand_path(".")}/spec/fixtures/schema.yml"
|
79
86
|
YAML.load(File.read(path))
|