graphiti_spec_helpers 1.0.beta.2 → 1.0.beta.3
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/graphiti_spec_helpers/node.rb +3 -3
- data/lib/graphiti_spec_helpers/rspec.rb +10 -1
- data/lib/graphiti_spec_helpers/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2df5b0a708725d2778698aad13eef534b1ab9ba7
|
|
4
|
+
data.tar.gz: 2b701facab45ac164f83b8e921733ee1a6d04844
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d9ff8d1a4e779c7f367150ce1c2e6e2e786fce38ae7f403ceecf77c32ca9d1c8ffabaadc4350f86b7e0361927e160d6923054dca6629c557a4536fc5cf6c5190
|
|
7
|
+
data.tar.gz: 75c3bc6db8ea9d18a1c688faa2c50ebe70d72556f348899885c94ed0c2a9092bf2c40a8af15bef08f665b0d82416fb2d073d77cba7dcb0b67ff8db577dff04ad
|
|
@@ -4,7 +4,7 @@ module GraphitiSpecHelpers
|
|
|
4
4
|
|
|
5
5
|
def initialize(attributes, relationships, context)
|
|
6
6
|
@attributes = attributes.with_indifferent_access
|
|
7
|
-
@relationships = relationships
|
|
7
|
+
@relationships = relationships.with_indifferent_access if relationships
|
|
8
8
|
@context = context
|
|
9
9
|
end
|
|
10
10
|
|
|
@@ -72,8 +72,8 @@ module GraphitiSpecHelpers
|
|
|
72
72
|
private
|
|
73
73
|
|
|
74
74
|
def include_for(type, id)
|
|
75
|
-
data = @context.json[
|
|
76
|
-
i[
|
|
75
|
+
data = @context.json['included'].find do |i|
|
|
76
|
+
i['type'] == type && i['id'] == id
|
|
77
77
|
end
|
|
78
78
|
@context.node(from: data)
|
|
79
79
|
end
|
|
@@ -8,12 +8,21 @@ require 'graphiti_spec_helpers'
|
|
|
8
8
|
begin
|
|
9
9
|
original = Graphiti::Resource.validate_endpoints
|
|
10
10
|
Graphiti::Resource.validate_endpoints = false
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
Graphiti.with_context graphiti_context do
|
|
13
|
+
e.run
|
|
14
|
+
end
|
|
12
15
|
ensure
|
|
13
16
|
Graphiti::Resource.validate_endpoints = original
|
|
14
17
|
end
|
|
15
18
|
end
|
|
16
19
|
|
|
20
|
+
def graphiti_context
|
|
21
|
+
ctx = OpenStruct.new
|
|
22
|
+
ctx.current_user = current_user if respond_to?(:current_user)
|
|
23
|
+
ctx
|
|
24
|
+
end
|
|
25
|
+
|
|
17
26
|
# If you need to set context:
|
|
18
27
|
#
|
|
19
28
|
# Graphiti.with_context my_context, {} do
|
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
|
+
version: 1.0.beta.3
|
|
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-09-
|
|
11
|
+
date: 2018-09-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: graphiti
|
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
153
153
|
version: 1.3.1
|
|
154
154
|
requirements: []
|
|
155
155
|
rubyforge_project:
|
|
156
|
-
rubygems_version: 2.6.
|
|
156
|
+
rubygems_version: 2.6.13
|
|
157
157
|
signing_key:
|
|
158
158
|
specification_version: 4
|
|
159
159
|
summary: Spec helpers for Graphiti and JSONAPI
|