graphiti_spec_helpers 1.0.beta.4 → 1.0.beta.6

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: 133ae38aebb30d45d6f16c5c449a30e1e3eba0ea
4
- data.tar.gz: bf0c8c6157c3e4a89c075fa96f3703e831555fa5
3
+ metadata.gz: b6413f4a6d9110c189532d164c337d4ac3123f2e
4
+ data.tar.gz: f9d61cdd38667932d05c5a47b8a38c8038e0cd65
5
5
  SHA512:
6
- metadata.gz: 7eb4d0b4e3df24b8919b2d95ccc040a71e3c1f3e070b3a451e003e38d8b09eaec9e7678ae1fa430909355240c03b4be39edb7932715d7363c2ad846e1754abd8
7
- data.tar.gz: 97c90e3e948d8d04072f83c082d95d7f1b392c1d17cde862386b0fd9b7b0c465fa4aa2d8ebb2aecfaa55c5e0ddb61e5ce3141c68ceea57e76b366fa54bfa1f50
6
+ metadata.gz: 91c77a4d540c6eb91d471ba019aa47c8ec2fb38db46efe176011f26b9ba2656b24624e8ec9a5e463b4b920c16182d30675b34fc758a49c74700497afc98cbf5e
7
+ data.tar.gz: 5fd41ad23bcbba86233d6c48a87969c9bd429d71c0cc0977c9ef4344d3d440c3d4075600c2cbdfe4a27128a7640ae49b47da0085d4fc187cb4e521aafa568cdd
@@ -35,7 +35,15 @@ module GraphitiSpecHelpers
35
35
  end
36
36
 
37
37
  def dt(*args)
38
- datetime(*args)
38
+ json_datetime(*args)
39
+ end
40
+
41
+ def datetime(*args)
42
+ json_datetime(*args)
43
+ end
44
+
45
+ def date(*args)
46
+ json_date(*args)
39
47
  end
40
48
  end
41
49
  end
@@ -57,5 +57,15 @@ module GraphitiSpecHelpers
57
57
  "Tried to find sideload, but the payload did not contain 'included'! Payload was:\n\n#{JSON.pretty_generate(@payload)}"
58
58
  end
59
59
  end
60
+
61
+ class NoMeta < Base
62
+ def initialize(payload)
63
+ @payload = payload
64
+ end
65
+
66
+ def message
67
+ "Tried to find metadata, but the payload did not contain 'meta'! Payload was:\n\n#{JSON.pretty_generate(@payload)}"
68
+ end
69
+ end
60
70
  end
61
71
  end
@@ -37,6 +37,10 @@ module GraphitiSpecHelpers
37
37
  @jsonapi_errors ||= ErrorsProxy.new(json['errors'] || [])
38
38
  end
39
39
 
40
+ def jsonapi_meta
41
+ @jsonapi_errors = json['meta'] || raise(Errors::NoMeta.new(json))
42
+ end
43
+
40
44
  def jsonapi_headers
41
45
  {
42
46
  'CONTENT_TYPE' => 'application/vnd.api+json'
@@ -63,8 +67,12 @@ module GraphitiSpecHelpers
63
67
  delete url, headers: jsonapi_headers
64
68
  end
65
69
 
66
- def datetime(value)
67
- Graphiti::Types[:datetime][:read][value]
70
+ def json_datetime(value)
71
+ Graphiti::Types[:datetime][:read][value].as_json
72
+ end
73
+
74
+ def json_date(value)
75
+ Graphiti::Types[:date][:read][value].as_json
68
76
  end
69
77
 
70
78
  # @api private
@@ -44,6 +44,10 @@ module GraphitiSpecHelpers
44
44
  end
45
45
  end
46
46
 
47
+ def respond_to?(*args)
48
+ super
49
+ end
50
+
47
51
  def link(relationship_name, name)
48
52
  if @relationships.has_key?(relationship_name)
49
53
  links = @relationships[relationship_name][:links]
@@ -1,3 +1,3 @@
1
1
  module GraphitiSpecHelpers
2
- VERSION = "1.0.beta.4"
2
+ VERSION = "1.0.beta.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphiti_spec_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.beta.4
4
+ version: 1.0.beta.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-04 00:00:00.000000000 Z
11
+ date: 2019-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphiti