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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2e4dab0d8a9b42b0207788642574435b6638aff
4
- data.tar.gz: 8b883259c69b57cfc5ebcb58362d8224813b15ab
3
+ metadata.gz: 48ab6015e4091f951a7967e892143a493264edff
4
+ data.tar.gz: 10bc27bd209f637b5b58ec70df044ebb056e94e8
5
5
  SHA512:
6
- metadata.gz: b3eeb7ae1f605095dc0a2606e0530becf9abc70e42f76ba13523511ad11f29af490907efc342f4c1154861581119ca2d419c469f9d171ebf33db5226818af88c
7
- data.tar.gz: dd9cab9f394957edd620b5f5ee9f70a4fca5dff6449b6d0e14ece7c989e14c70730f145f389c506eff106f5aaf6f4f84be4c31c0aecb7aaa28c8c44036c8c713
6
+ metadata.gz: 8dd1be9db2f630c3ce51f6bc44459b21173a8ba5f13cdafc877fbacd25c6f4abd9289cc397cb164082c2aa7901e53c4b6ac275d6f55a46ddfc509bb43ce05f0a
7
+ data.tar.gz: bc81d4ad01f6c477d6288c0136c48c21bee6c66359fcbd072b6599e5904ce5996284b7dcf2a54df3170845ec0f0ceba36d8a318d5855eea140041c0f5167778b
@@ -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.1"
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.}
@@ -72,8 +72,15 @@ module JsonSchemaSpec
72
72
  end
73
73
 
74
74
  def pick_json_schema
75
- if defined?(Rails) && defined?(get)
76
- JSON.parse(get("/schema.json"))
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))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_schema_spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Winton Welsh