surikat 0.2.5 → 0.3.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 +4 -4
- data/.idea/surikat.iml +1 -1
- data/.idea/workspace.xml +116 -104
- data/README.md +2 -2
- data/lib/surikat.rb +57 -32
- data/lib/surikat/templates/aaa_spec.rb.tmpl +19 -12
- data/lib/surikat/templates/base_spec.rb.tmpl +9 -9
- data/lib/surikat/templates/config.ru.tmpl +2 -0
- data/lib/surikat/templates/crud_queries.rb.tmpl +2 -0
- data/lib/surikat/templates/hello_spec.rb.tmpl +8 -8
- data/lib/surikat/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: da73410a4206c08d8a6091d674be89edcb14f01d
|
|
4
|
+
data.tar.gz: '080707a253926366965c5ced630e3e965357695c'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f4ff00be2b2f2f0b86dcd7f555f7caccdc5ac0f75363cc814c32386063162bc8a0574386d18a59ad565f02e3bcad5e5081776c52af5e7ca70ad30fdc851a2fc2
|
|
7
|
+
data.tar.gz: 345c499013a166026e9708897adc6ee15d246f25a04cce14cb0e871f9b07a75db5aa594f6fd5cc28d23658702c481309b38500e7825538bd90381f8834a044d5
|
data/.idea/surikat.iml
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<orderEntry type="library" scope="PROVIDED" name="crass (v1.0.4, RVM: ruby-2.4.1) [gem]" level="application" />
|
|
21
21
|
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, RVM: ruby-2.4.1) [gem]" level="application" />
|
|
22
22
|
<orderEntry type="library" scope="PROVIDED" name="erubi (v1.7.1, RVM: ruby-2.4.1) [gem]" level="application" />
|
|
23
|
-
<orderEntry type="library" scope="PROVIDED" name="graphql (v1.
|
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="graphql (v1.8.0, RVM: ruby-2.4.1) [gem]" level="application" />
|
|
24
24
|
<orderEntry type="library" scope="PROVIDED" name="graphql-libgraphqlparser (v1.2.0, RVM: ruby-2.4.1) [gem]" level="application" />
|
|
25
25
|
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.0.1, RVM: ruby-2.4.1) [gem]" level="application" />
|
|
26
26
|
<orderEntry type="library" scope="PROVIDED" name="loofah (v2.2.2, RVM: ruby-2.4.1) [gem]" level="application" />
|
data/.idea/workspace.xml
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<project version="4">
|
|
3
3
|
<component name="ChangeListManager">
|
|
4
|
-
<list default="true" id="66400b9f-bfb7-48ab-a1ab-331b1d21e8c6" name="Default" comment="built gem 0.2.
|
|
5
|
-
<change afterPath="$PROJECT_DIR$/bin/postinstall" afterDir="false" />
|
|
4
|
+
<list default="true" id="66400b9f-bfb7-48ab-a1ab-331b1d21e8c6" name="Default" comment="added postinstall fixed issue with JSON being retrieved when no records are found built gem 0.2.5">
|
|
6
5
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
|
7
6
|
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
|
8
7
|
<change beforePath="$PROJECT_DIR$/lib/surikat.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/surikat.rb" afterDir="false" />
|
|
9
|
-
<change beforePath="$PROJECT_DIR$/lib/surikat/
|
|
8
|
+
<change beforePath="$PROJECT_DIR$/lib/surikat/templates/aaa_spec.rb.tmpl" beforeDir="false" afterPath="$PROJECT_DIR$/lib/surikat/templates/aaa_spec.rb.tmpl" afterDir="false" />
|
|
9
|
+
<change beforePath="$PROJECT_DIR$/lib/surikat/templates/base_spec.rb.tmpl" beforeDir="false" afterPath="$PROJECT_DIR$/lib/surikat/templates/base_spec.rb.tmpl" afterDir="false" />
|
|
10
|
+
<change beforePath="$PROJECT_DIR$/lib/surikat/templates/config.ru.tmpl" beforeDir="false" afterPath="$PROJECT_DIR$/lib/surikat/templates/config.ru.tmpl" afterDir="false" />
|
|
11
|
+
<change beforePath="$PROJECT_DIR$/lib/surikat/templates/crud_queries.rb.tmpl" beforeDir="false" afterPath="$PROJECT_DIR$/lib/surikat/templates/crud_queries.rb.tmpl" afterDir="false" />
|
|
12
|
+
<change beforePath="$PROJECT_DIR$/lib/surikat/templates/hello_spec.rb.tmpl" beforeDir="false" afterPath="$PROJECT_DIR$/lib/surikat/templates/hello_spec.rb.tmpl" afterDir="false" />
|
|
10
13
|
<change beforePath="$PROJECT_DIR$/lib/surikat/version.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/surikat/version.rb" afterDir="false" />
|
|
11
|
-
<change beforePath="$PROJECT_DIR$/surikat-0.2.
|
|
12
|
-
<change beforePath="$PROJECT_DIR$/surikat-0.2.2.gem" beforeDir="false" />
|
|
13
|
-
<change beforePath="$PROJECT_DIR$/surikat-0.2.3.gem" beforeDir="false" />
|
|
14
|
-
<change beforePath="$PROJECT_DIR$/surikat-0.2.4.gem" beforeDir="false" afterPath="$PROJECT_DIR$/surikat-0.2.4.gem" afterDir="false" />
|
|
14
|
+
<change beforePath="$PROJECT_DIR$/surikat-0.2.5.gem" beforeDir="false" afterPath="$PROJECT_DIR$/surikat-0.2.5.gem" afterDir="false" />
|
|
15
15
|
</list>
|
|
16
16
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
|
17
17
|
<option name="TRACKING_ENABLED" value="true" />
|
|
@@ -25,17 +25,8 @@
|
|
|
25
25
|
<file leaf-file-name="TODO" pinned="true" current-in-tab="false">
|
|
26
26
|
<entry file="file://$PROJECT_DIR$/TODO">
|
|
27
27
|
<provider selected="true" editor-type-id="text-editor">
|
|
28
|
-
<state relative-caret-position="
|
|
29
|
-
<caret line="
|
|
30
|
-
</state>
|
|
31
|
-
</provider>
|
|
32
|
-
</entry>
|
|
33
|
-
</file>
|
|
34
|
-
<file leaf-file-name="surikat.rb" pinned="false" current-in-tab="false">
|
|
35
|
-
<entry file="file://$PROJECT_DIR$/lib/surikat.rb">
|
|
36
|
-
<provider selected="true" editor-type-id="text-editor">
|
|
37
|
-
<state relative-caret-position="755">
|
|
38
|
-
<caret line="149" column="54" selection-start-line="149" selection-start-column="54" selection-end-line="149" selection-end-column="54" />
|
|
28
|
+
<state relative-caret-position="204">
|
|
29
|
+
<caret line="12" column="52" lean-forward="true" selection-start-line="12" selection-start-column="52" selection-end-line="12" selection-end-column="52" />
|
|
39
30
|
</state>
|
|
40
31
|
</provider>
|
|
41
32
|
</entry>
|
|
@@ -60,12 +51,6 @@
|
|
|
60
51
|
</component>
|
|
61
52
|
<component name="FindInProjectRecents">
|
|
62
53
|
<findStrings>
|
|
63
|
-
<find>surikat_ses</find>
|
|
64
|
-
<find>app:</find>
|
|
65
|
-
<find>columns_new_</find>
|
|
66
|
-
<find>columns_new</find>
|
|
67
|
-
<find>< B</find>
|
|
68
|
-
<find>this.sess</find>
|
|
69
54
|
<find>session =</find>
|
|
70
55
|
<find>['class</find>
|
|
71
56
|
<find>.send</find>
|
|
@@ -86,10 +71,16 @@
|
|
|
86
71
|
<find>active_reco</find>
|
|
87
72
|
<find>puts 71</find>
|
|
88
73
|
<find>puts 'eee</find>
|
|
89
|
-
<find>Author</find>
|
|
90
74
|
<find>puts</find>
|
|
91
75
|
<find>1</find>
|
|
92
76
|
<find>unknown</find>
|
|
77
|
+
<find>errors:</find>
|
|
78
|
+
<find>errors</find>
|
|
79
|
+
<find>data:</find>
|
|
80
|
+
<find>Access de</find>
|
|
81
|
+
<find>%</find>
|
|
82
|
+
<find>Author</find>
|
|
83
|
+
<find>Expected argum</find>
|
|
93
84
|
</findStrings>
|
|
94
85
|
<replaceStrings>
|
|
95
86
|
<replace>@@routes</replace>
|
|
@@ -130,31 +121,31 @@
|
|
|
130
121
|
<option value="$PROJECT_DIR$/lib/surikat/types.rb" />
|
|
131
122
|
<option value="$PROJECT_DIR$/lib/surikat/yaml_configurator.rb" />
|
|
132
123
|
<option value="$PROJECT_DIR$/lib/surikat/templates/aaa_queries.rb.tmpl" />
|
|
133
|
-
<option value="$PROJECT_DIR$/lib/surikat/templates/aaa_spec.rb.tmpl" />
|
|
134
124
|
<option value="$PROJECT_DIR$/lib/surikat/templates/base_aaa_model.rb.tmpl" />
|
|
135
125
|
<option value="$PROJECT_DIR$/lib/surikat/templates/base_model.rb.tmpl" />
|
|
136
126
|
<option value="$PROJECT_DIR$/lib/surikat/templates/hello_queries.rb.tmpl" />
|
|
137
|
-
<option value="$PROJECT_DIR$/lib/surikat/templates/hello_spec.rb.tmpl" />
|
|
138
127
|
<option value="$PROJECT_DIR$/lib/surikat/templates/routes.yml.tmpl" />
|
|
139
128
|
<option value="$PROJECT_DIR$/lib/surikat/templates/application.yml.tmpl" />
|
|
140
129
|
<option value="$PROJECT_DIR$/lib/surikat/session.rb" />
|
|
141
130
|
<option value="$PROJECT_DIR$/lib/surikat/scaffold.rb" />
|
|
142
131
|
<option value="$PROJECT_DIR$/lib/surikat/new_app.rb" />
|
|
143
132
|
<option value="$PROJECT_DIR$/lib/surikat/templates/test_helper.rb.tmpl" />
|
|
144
|
-
<option value="$PROJECT_DIR$/lib/surikat/templates/crud_queries.rb.tmpl" />
|
|
145
133
|
<option value="$PROJECT_DIR$/lib/surikat/templates/database.yml.tmpl" />
|
|
146
|
-
<option value="$PROJECT_DIR$/lib/surikat/templates/config.ru.tmpl" />
|
|
147
134
|
<option value="$PROJECT_DIR$/.gitignore" />
|
|
148
135
|
<option value="$PROJECT_DIR$/bin/console" />
|
|
149
136
|
<option value="$PROJECT_DIR$/lib/surikat/templates/console.tmpl" />
|
|
150
|
-
<option value="$PROJECT_DIR$/exe/surikat" />
|
|
151
|
-
<option value="$PROJECT_DIR$/lib/surikat/templates/base_spec.rb.tmpl" />
|
|
152
137
|
<option value="$PROJECT_DIR$/lib/surikat/session_manager.rb" />
|
|
153
138
|
<option value="$PROJECT_DIR$/surikat.gemspec" />
|
|
154
|
-
<option value="$PROJECT_DIR$/README.md" />
|
|
155
139
|
<option value="$PROJECT_DIR$/bin/postinstall" />
|
|
156
140
|
<option value="$PROJECT_DIR$/lib/surikat/base_model.rb" />
|
|
141
|
+
<option value="$PROJECT_DIR$/README.md" />
|
|
142
|
+
<option value="$PROJECT_DIR$/lib/surikat/templates/config.ru.tmpl" />
|
|
143
|
+
<option value="$PROJECT_DIR$/lib/surikat/templates/aaa_spec.rb.tmpl" />
|
|
144
|
+
<option value="$PROJECT_DIR$/lib/surikat/templates/base_spec.rb.tmpl" />
|
|
145
|
+
<option value="$PROJECT_DIR$/lib/surikat/templates/hello_spec.rb.tmpl" />
|
|
146
|
+
<option value="$PROJECT_DIR$/exe/surikat" />
|
|
157
147
|
<option value="$PROJECT_DIR$/lib/surikat.rb" />
|
|
148
|
+
<option value="$PROJECT_DIR$/lib/surikat/templates/crud_queries.rb.tmpl" />
|
|
158
149
|
<option value="$PROJECT_DIR$/TODO" />
|
|
159
150
|
<option value="$PROJECT_DIR$/lib/surikat/version.rb" />
|
|
160
151
|
</list>
|
|
@@ -170,7 +161,7 @@
|
|
|
170
161
|
<packageJsonPaths />
|
|
171
162
|
</component>
|
|
172
163
|
<component name="ProjectFrameBounds">
|
|
173
|
-
<option name="x" value="
|
|
164
|
+
<option name="x" value="-1870" />
|
|
174
165
|
<option name="y" value="23" />
|
|
175
166
|
<option name="width" value="1889" />
|
|
176
167
|
<option name="height" value="1057" />
|
|
@@ -182,7 +173,6 @@
|
|
|
182
173
|
<foldersAlwaysOnTop value="true" />
|
|
183
174
|
</navigator>
|
|
184
175
|
<panes>
|
|
185
|
-
<pane id="Scope" />
|
|
186
176
|
<pane id="ProjectPane">
|
|
187
177
|
<subPane>
|
|
188
178
|
<expand>
|
|
@@ -195,26 +185,39 @@
|
|
|
195
185
|
<item name="surikat" type="462c0819:PsiDirectoryNode" />
|
|
196
186
|
<item name="bin" type="462c0819:PsiDirectoryNode" />
|
|
197
187
|
</path>
|
|
188
|
+
<path>
|
|
189
|
+
<item name="surikat" type="b2602c69:ProjectViewProjectNode" />
|
|
190
|
+
<item name="surikat" type="462c0819:PsiDirectoryNode" />
|
|
191
|
+
<item name="exe" type="462c0819:PsiDirectoryNode" />
|
|
192
|
+
</path>
|
|
193
|
+
<path>
|
|
194
|
+
<item name="surikat" type="b2602c69:ProjectViewProjectNode" />
|
|
195
|
+
<item name="surikat" type="462c0819:PsiDirectoryNode" />
|
|
196
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
|
197
|
+
</path>
|
|
198
198
|
<path>
|
|
199
199
|
<item name="surikat" type="b2602c69:ProjectViewProjectNode" />
|
|
200
200
|
<item name="surikat" type="462c0819:PsiDirectoryNode" />
|
|
201
201
|
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
|
202
|
+
<item name="surikat" type="462c0819:PsiDirectoryNode" />
|
|
202
203
|
</path>
|
|
203
204
|
<path>
|
|
204
205
|
<item name="surikat" type="b2602c69:ProjectViewProjectNode" />
|
|
205
206
|
<item name="surikat" type="462c0819:PsiDirectoryNode" />
|
|
206
207
|
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
|
207
208
|
<item name="surikat" type="462c0819:PsiDirectoryNode" />
|
|
209
|
+
<item name="templates" type="462c0819:PsiDirectoryNode" />
|
|
208
210
|
</path>
|
|
209
211
|
</expand>
|
|
210
212
|
<select />
|
|
211
213
|
</subPane>
|
|
212
214
|
</pane>
|
|
215
|
+
<pane id="Scope" />
|
|
213
216
|
</panes>
|
|
214
217
|
</component>
|
|
215
218
|
<component name="PropertiesComponent">
|
|
216
219
|
<property name="RakeTaksPopup.undocumentedIncluded" value="false" />
|
|
217
|
-
<property name="SearchEverywhereHistoryKey" value="session_ma	FILE	file:///Users/alxx/Projects/surikat/lib/surikat/session_manager.rb diagram	ACTION	ShowUmlDiagram highlight	ACTION	HighlightUsagesInFile list	null	null list_ty	FILE	file:///Users/alxx/.rvm/gems/ruby-2.4.1/gems/graphql-1.7.7/lib/graphql/list_type.rb generate_t	null	null generate_aaa	null	null exempl	null	null scaf	FILE	file:///Users/alxx/Projects/surikat/lib/surikat/scaffold.rb new_a	FILE	file:///Users/alxx/Projects/surikat/lib/surikat/new_app.rb scaff	FILE	file:///Users/alxx/Projects/surikat/lib/surikat/scaffold.rb" />
|
|
220
|
+
<property name="SearchEverywhereHistoryKey" value="ver	FILE	file:///Users/alxx/Projects/surikat/lib/surikat/version.rb session_ma	FILE	file:///Users/alxx/Projects/surikat/lib/surikat/session_manager.rb diagram	ACTION	ShowUmlDiagram highlight	ACTION	HighlightUsagesInFile list	null	null list_ty	FILE	file:///Users/alxx/.rvm/gems/ruby-2.4.1/gems/graphql-1.7.7/lib/graphql/list_type.rb generate_t	null	null generate_aaa	null	null exempl	null	null scaf	FILE	file:///Users/alxx/Projects/surikat/lib/surikat/scaffold.rb new_a	FILE	file:///Users/alxx/Projects/surikat/lib/surikat/new_app.rb scaff	FILE	file:///Users/alxx/Projects/surikat/lib/surikat/scaffold.rb" />
|
|
218
221
|
<property name="WebServerToolWindowFactoryState" value="false" />
|
|
219
222
|
<property name="nodejs_interpreter_path.stuck_in_default_project" value="/usr/local/bin/node" />
|
|
220
223
|
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
|
@@ -256,7 +259,8 @@
|
|
|
256
259
|
<workItem from="1527080050867" duration="68864000" />
|
|
257
260
|
<workItem from="1527681663233" duration="14504000" />
|
|
258
261
|
<workItem from="1528216280645" duration="2063000" />
|
|
259
|
-
<workItem from="1528996630109" duration="
|
|
262
|
+
<workItem from="1528996630109" duration="4649000" />
|
|
263
|
+
<workItem from="1529097539864" duration="5357000" />
|
|
260
264
|
</task>
|
|
261
265
|
<task id="LOCAL-00001" summary="no gem">
|
|
262
266
|
<created>1527697580402</created>
|
|
@@ -363,11 +367,18 @@
|
|
|
363
367
|
<option name="project" value="LOCAL" />
|
|
364
368
|
<updated>1528218437319</updated>
|
|
365
369
|
</task>
|
|
366
|
-
<
|
|
370
|
+
<task id="LOCAL-00016" summary="added postinstall fixed issue with JSON being retrieved when no records are found built gem 0.2.5">
|
|
371
|
+
<created>1529005228798</created>
|
|
372
|
+
<option name="number" value="00016" />
|
|
373
|
+
<option name="presentableId" value="LOCAL-00016" />
|
|
374
|
+
<option name="project" value="LOCAL" />
|
|
375
|
+
<updated>1529005228798</updated>
|
|
376
|
+
</task>
|
|
377
|
+
<option name="localTasksCounter" value="17" />
|
|
367
378
|
<servers />
|
|
368
379
|
</component>
|
|
369
380
|
<component name="TimeTrackingManager">
|
|
370
|
-
<option name="totallyTimeSpent" value="
|
|
381
|
+
<option name="totallyTimeSpent" value="139529000" />
|
|
371
382
|
</component>
|
|
372
383
|
<component name="TodoView">
|
|
373
384
|
<todo-panel id="selected-file">
|
|
@@ -379,7 +390,7 @@
|
|
|
379
390
|
</todo-panel>
|
|
380
391
|
</component>
|
|
381
392
|
<component name="ToolWindowManager">
|
|
382
|
-
<frame x="
|
|
393
|
+
<frame x="-1870" y="23" width="1889" height="1057" extended-state="0" />
|
|
383
394
|
<editor active="true" />
|
|
384
395
|
<layout>
|
|
385
396
|
<window_info anchor="bottom" id="TODO" order="6" weight="0.32977587" />
|
|
@@ -389,10 +400,10 @@
|
|
|
389
400
|
<window_info anchor="bottom" id="Version Control" order="10" />
|
|
390
401
|
<window_info anchor="right" id="Mongo Explorer" order="3" />
|
|
391
402
|
<window_info anchor="bottom" id="Terminal" order="8" />
|
|
392
|
-
<window_info active="true" content_ui="combo" id="Project" order="0" sideWeight="0.
|
|
403
|
+
<window_info active="true" content_ui="combo" id="Project" order="0" sideWeight="0.48986125" visible="true" weight="0.2512182" />
|
|
393
404
|
<window_info anchor="right" id="Database" order="4" />
|
|
394
405
|
<window_info anchor="bottom" id="Find" order="1" weight="0.32977587" />
|
|
395
|
-
<window_info id="Structure" order="1" sideWeight="0.
|
|
406
|
+
<window_info id="Structure" order="1" sideWeight="0.51013875" side_tool="true" visible="true" weight="0.2512182" />
|
|
396
407
|
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
|
397
408
|
<window_info id="Favorites" order="2" side_tool="true" />
|
|
398
409
|
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
|
@@ -422,7 +433,8 @@
|
|
|
422
433
|
<MESSAGE value="fixed casting of custom types" />
|
|
423
434
|
<MESSAGE value="increased version to 0.2.4" />
|
|
424
435
|
<MESSAGE value="built gem 0.2.4" />
|
|
425
|
-
<
|
|
436
|
+
<MESSAGE value="added postinstall fixed issue with JSON being retrieved when no records are found built gem 0.2.5" />
|
|
437
|
+
<option name="LAST_COMMIT_MESSAGE" value="added postinstall fixed issue with JSON being retrieved when no records are found built gem 0.2.5" />
|
|
426
438
|
</component>
|
|
427
439
|
<component name="XDebuggerManager">
|
|
428
440
|
<breakpoint-manager>
|
|
@@ -471,13 +483,6 @@
|
|
|
471
483
|
</state>
|
|
472
484
|
</provider>
|
|
473
485
|
</entry>
|
|
474
|
-
<entry file="file://$PROJECT_DIR$/lib/surikat/templates/.rspec.tmpl">
|
|
475
|
-
<provider selected="true" editor-type-id="text-editor">
|
|
476
|
-
<state relative-caret-position="17">
|
|
477
|
-
<caret line="1" lean-forward="true" selection-start-line="1" selection-end-line="1" />
|
|
478
|
-
</state>
|
|
479
|
-
</provider>
|
|
480
|
-
</entry>
|
|
481
486
|
<entry file="file://$PROJECT_DIR$/lib/surikat/templates/.standalone_migrations.tmpl">
|
|
482
487
|
<provider selected="true" editor-type-id="text-editor">
|
|
483
488
|
<state relative-caret-position="102">
|
|
@@ -485,13 +490,6 @@
|
|
|
485
490
|
</state>
|
|
486
491
|
</provider>
|
|
487
492
|
</entry>
|
|
488
|
-
<entry file="file://$PROJECT_DIR$/lib/surikat/templates/aaa_queries.rb.tmpl">
|
|
489
|
-
<provider selected="true" editor-type-id="text-editor">
|
|
490
|
-
<state relative-caret-position="85">
|
|
491
|
-
<caret line="5" selection-start-line="5" selection-end-line="5" selection-end-column="22" />
|
|
492
|
-
</state>
|
|
493
|
-
</provider>
|
|
494
|
-
</entry>
|
|
495
493
|
<entry file="file://$PROJECT_DIR$/lib/surikat/templates/Gemfile.tmpl">
|
|
496
494
|
<provider selected="true" editor-type-id="text-editor">
|
|
497
495
|
<state relative-caret-position="510">
|
|
@@ -537,13 +535,6 @@
|
|
|
537
535
|
</state>
|
|
538
536
|
</provider>
|
|
539
537
|
</entry>
|
|
540
|
-
<entry file="file://$PROJECT_DIR$/lib/surikat/templates/hello_spec.rb.tmpl">
|
|
541
|
-
<provider selected="true" editor-type-id="text-editor">
|
|
542
|
-
<state relative-caret-position="578">
|
|
543
|
-
<caret line="34" column="58" selection-start-line="34" selection-start-column="58" selection-end-line="34" selection-end-column="58" />
|
|
544
|
-
</state>
|
|
545
|
-
</provider>
|
|
546
|
-
</entry>
|
|
547
538
|
<entry file="file://$PROJECT_DIR$/lib/surikat/session.rb">
|
|
548
539
|
<provider selected="true" editor-type-id="text-editor">
|
|
549
540
|
<state relative-caret-position="306">
|
|
@@ -578,13 +569,6 @@
|
|
|
578
569
|
</state>
|
|
579
570
|
</provider>
|
|
580
571
|
</entry>
|
|
581
|
-
<entry file="file://$PROJECT_DIR$/lib/surikat/templates/crud_queries.rb.tmpl">
|
|
582
|
-
<provider selected="true" editor-type-id="text-editor">
|
|
583
|
-
<state relative-caret-position="945">
|
|
584
|
-
<caret line="101" column="8" selection-start-line="101" selection-start-column="8" selection-end-line="101" selection-end-column="8" />
|
|
585
|
-
</state>
|
|
586
|
-
</provider>
|
|
587
|
-
</entry>
|
|
588
572
|
<entry file="file://$PROJECT_DIR$/lib/surikat/templates/database.yml.tmpl">
|
|
589
573
|
<provider selected="true" editor-type-id="text-editor">
|
|
590
574
|
<state relative-caret-position="425">
|
|
@@ -592,13 +576,6 @@
|
|
|
592
576
|
</state>
|
|
593
577
|
</provider>
|
|
594
578
|
</entry>
|
|
595
|
-
<entry file="file://$PROJECT_DIR$/lib/surikat/templates/config.ru.tmpl">
|
|
596
|
-
<provider selected="true" editor-type-id="text-editor">
|
|
597
|
-
<state relative-caret-position="116">
|
|
598
|
-
<caret line="19" column="51" selection-start-line="19" selection-start-column="51" selection-end-line="19" selection-end-column="51" />
|
|
599
|
-
</state>
|
|
600
|
-
</provider>
|
|
601
|
-
</entry>
|
|
602
579
|
<entry file="file://$PROJECT_DIR$/lib/surikat/base_queries.rb">
|
|
603
580
|
<provider selected="true" editor-type-id="text-editor">
|
|
604
581
|
<state relative-caret-position="119">
|
|
@@ -1098,20 +1075,6 @@
|
|
|
1098
1075
|
</state>
|
|
1099
1076
|
</provider>
|
|
1100
1077
|
</entry>
|
|
1101
|
-
<entry file="file://$PROJECT_DIR$/exe/surikat">
|
|
1102
|
-
<provider selected="true" editor-type-id="text-editor">
|
|
1103
|
-
<state relative-caret-position="765">
|
|
1104
|
-
<caret line="45" column="45" selection-start-line="45" selection-start-column="45" selection-end-line="45" selection-end-column="45" />
|
|
1105
|
-
</state>
|
|
1106
|
-
</provider>
|
|
1107
|
-
</entry>
|
|
1108
|
-
<entry file="file://$PROJECT_DIR$/lib/surikat/templates/base_spec.rb.tmpl">
|
|
1109
|
-
<provider selected="true" editor-type-id="text-editor">
|
|
1110
|
-
<state relative-caret-position="322">
|
|
1111
|
-
<caret line="71" column="29" selection-start-line="71" selection-start-column="29" selection-end-line="71" selection-end-column="29" />
|
|
1112
|
-
</state>
|
|
1113
|
-
</provider>
|
|
1114
|
-
</entry>
|
|
1115
1078
|
<entry file="file://$PROJECT_DIR$/lib/surikat/session_manager.rb">
|
|
1116
1079
|
<provider selected="true" editor-type-id="text-editor">
|
|
1117
1080
|
<state relative-caret-position="459">
|
|
@@ -1133,13 +1096,6 @@
|
|
|
1133
1096
|
</state>
|
|
1134
1097
|
</provider>
|
|
1135
1098
|
</entry>
|
|
1136
|
-
<entry file="file://$PROJECT_DIR$/lib/surikat/templates/aaa_spec.rb.tmpl">
|
|
1137
|
-
<provider selected="true" editor-type-id="text-editor">
|
|
1138
|
-
<state relative-caret-position="2550">
|
|
1139
|
-
<caret line="150" column="3" selection-start-line="150" selection-start-column="3" selection-end-line="150" selection-end-column="3" />
|
|
1140
|
-
</state>
|
|
1141
|
-
</provider>
|
|
1142
|
-
</entry>
|
|
1143
1099
|
<entry file="file://$PROJECT_DIR$/lib/surikat/templates/application.yml.tmpl">
|
|
1144
1100
|
<provider selected="true" editor-type-id="text-editor">
|
|
1145
1101
|
<state relative-caret-position="221">
|
|
@@ -1185,24 +1141,80 @@
|
|
|
1185
1141
|
<entry file="file://$PROJECT_DIR$/README.md">
|
|
1186
1142
|
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
|
1187
1143
|
<state split_layout="SPLIT">
|
|
1188
|
-
<first_editor relative-caret-position="
|
|
1189
|
-
<caret line="
|
|
1144
|
+
<first_editor relative-caret-position="258">
|
|
1145
|
+
<caret line="227" column="197" selection-start-line="227" selection-start-column="197" selection-end-line="227" selection-end-column="197" />
|
|
1190
1146
|
</first_editor>
|
|
1191
1147
|
<second_editor />
|
|
1192
1148
|
</state>
|
|
1193
1149
|
</provider>
|
|
1194
1150
|
</entry>
|
|
1151
|
+
<entry file="file://$PROJECT_DIR$/lib/surikat/templates/config.ru.tmpl">
|
|
1152
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
1153
|
+
<state relative-caret-position="745">
|
|
1154
|
+
<caret line="56" column="57" selection-start-line="56" selection-start-column="57" selection-end-line="56" selection-end-column="57" />
|
|
1155
|
+
</state>
|
|
1156
|
+
</provider>
|
|
1157
|
+
</entry>
|
|
1158
|
+
<entry file="file://$PROJECT_DIR$/lib/surikat/templates/.rspec.tmpl">
|
|
1159
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
1160
|
+
<state relative-caret-position="17">
|
|
1161
|
+
<caret line="1" lean-forward="true" selection-start-line="1" selection-end-line="1" />
|
|
1162
|
+
</state>
|
|
1163
|
+
</provider>
|
|
1164
|
+
</entry>
|
|
1165
|
+
<entry file="file://$PROJECT_DIR$/lib/surikat/templates/aaa_queries.rb.tmpl">
|
|
1166
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
1167
|
+
<state relative-caret-position="85">
|
|
1168
|
+
<caret line="5" selection-start-line="5" selection-end-line="5" selection-end-column="22" />
|
|
1169
|
+
</state>
|
|
1170
|
+
</provider>
|
|
1171
|
+
</entry>
|
|
1172
|
+
<entry file="file://$PROJECT_DIR$/lib/surikat/templates/aaa_spec.rb.tmpl">
|
|
1173
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
1174
|
+
<state relative-caret-position="881">
|
|
1175
|
+
<caret line="157" column="3" selection-start-line="157" selection-start-column="3" selection-end-line="157" selection-end-column="3" />
|
|
1176
|
+
</state>
|
|
1177
|
+
</provider>
|
|
1178
|
+
</entry>
|
|
1179
|
+
<entry file="file://$PROJECT_DIR$/lib/surikat/templates/base_spec.rb.tmpl">
|
|
1180
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
1181
|
+
<state relative-caret-position="677">
|
|
1182
|
+
<caret line="139" column="30" selection-start-line="139" selection-start-column="30" selection-end-line="139" selection-end-column="30" />
|
|
1183
|
+
</state>
|
|
1184
|
+
</provider>
|
|
1185
|
+
</entry>
|
|
1186
|
+
<entry file="file://$PROJECT_DIR$/lib/surikat/templates/hello_spec.rb.tmpl">
|
|
1187
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
1188
|
+
<state relative-caret-position="289">
|
|
1189
|
+
<caret line="17" column="31" selection-start-line="17" selection-start-column="31" selection-end-line="17" selection-end-column="31" />
|
|
1190
|
+
</state>
|
|
1191
|
+
</provider>
|
|
1192
|
+
</entry>
|
|
1193
|
+
<entry file="file://$PROJECT_DIR$/exe/surikat">
|
|
1194
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
1195
|
+
<state relative-caret-position="332">
|
|
1196
|
+
<caret line="70" column="44" lean-forward="true" selection-start-line="70" selection-start-column="44" selection-end-line="70" selection-end-column="44" />
|
|
1197
|
+
</state>
|
|
1198
|
+
</provider>
|
|
1199
|
+
</entry>
|
|
1195
1200
|
<entry file="file://$PROJECT_DIR$/lib/surikat.rb">
|
|
1196
1201
|
<provider selected="true" editor-type-id="text-editor">
|
|
1197
|
-
<state relative-caret-position="
|
|
1198
|
-
<caret line="
|
|
1202
|
+
<state relative-caret-position="315">
|
|
1203
|
+
<caret line="261" column="21" lean-forward="true" selection-start-line="261" selection-start-column="21" selection-end-line="261" selection-end-column="21" />
|
|
1204
|
+
</state>
|
|
1205
|
+
</provider>
|
|
1206
|
+
</entry>
|
|
1207
|
+
<entry file="file://$PROJECT_DIR$/lib/surikat/templates/crud_queries.rb.tmpl">
|
|
1208
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
1209
|
+
<state relative-caret-position="348">
|
|
1210
|
+
<caret line="42" column="41" lean-forward="true" selection-start-line="42" selection-start-column="41" selection-end-line="42" selection-end-column="41" />
|
|
1199
1211
|
</state>
|
|
1200
1212
|
</provider>
|
|
1201
1213
|
</entry>
|
|
1202
1214
|
<entry file="file://$PROJECT_DIR$/TODO">
|
|
1203
1215
|
<provider selected="true" editor-type-id="text-editor">
|
|
1204
|
-
<state relative-caret-position="
|
|
1205
|
-
<caret line="
|
|
1216
|
+
<state relative-caret-position="204">
|
|
1217
|
+
<caret line="12" column="52" lean-forward="true" selection-start-line="12" selection-start-column="52" selection-end-line="12" selection-end-column="52" />
|
|
1206
1218
|
</state>
|
|
1207
1219
|
</provider>
|
|
1208
1220
|
</entry>
|
data/README.md
CHANGED
|
@@ -225,7 +225,7 @@ that has those two keys.
|
|
|
225
225
|
|
|
226
226
|
#### Errors
|
|
227
227
|
|
|
228
|
-
|
|
228
|
+
As per [GraphQL specs](http://facebook.github.io/graphql/June2018/#sec-Errors), application errors, type errors or model validation errors are return inside a field named `errors` which is an array.
|
|
229
229
|
|
|
230
230
|
#### Arguments
|
|
231
231
|
|
|
@@ -407,7 +407,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/alxx/s
|
|
|
407
407
|
|
|
408
408
|
## Version
|
|
409
409
|
|
|
410
|
-
This code reflects version 0.2.
|
|
410
|
+
This code reflects version 0.2.5.
|
|
411
411
|
|
|
412
412
|
## License
|
|
413
413
|
|
data/lib/surikat.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require('surikat/version')
|
|
2
2
|
|
|
3
3
|
module Surikat
|
|
4
|
-
%w(active_support graphql/libgraphqlparser surikat/yaml_configurator).each {
|
|
4
|
+
%w(active_support graphql/libgraphqlparser surikat/yaml_configurator).each {|g| require g}
|
|
5
5
|
|
|
6
6
|
class << self
|
|
7
7
|
def config
|
|
@@ -12,14 +12,14 @@ module Surikat
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
%w(base_queries base_model base_type).each {
|
|
15
|
+
%w(base_queries base_model base_type).each {|g| require "surikat/#{g}"}
|
|
16
16
|
|
|
17
17
|
# Require all models and queries
|
|
18
18
|
%w(queries models).each do |dir|
|
|
19
|
-
Dir.glob("#{FileUtils.pwd}/app/#{dir}/*.rb").each {
|
|
19
|
+
Dir.glob("#{FileUtils.pwd}/app/#{dir}/*.rb").each {|f| require(f)}
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
%w(types routes session).each {
|
|
22
|
+
%w(types routes session).each {|g| require "surikat/#{g}"}
|
|
23
23
|
|
|
24
24
|
class << self
|
|
25
25
|
def types
|
|
@@ -82,11 +82,11 @@ module Surikat
|
|
|
82
82
|
if Types::BASIC.include? type_singular_nobang
|
|
83
83
|
result = cast_scalar(data, type_singular_nobang)
|
|
84
84
|
else
|
|
85
|
-
result
|
|
85
|
+
result = {}
|
|
86
86
|
type = Surikat.types[type_singular_nobang]
|
|
87
87
|
allowed_fields = data.keys & type['fields'].keys
|
|
88
88
|
allowed_fields.each do |af|
|
|
89
|
-
type_name
|
|
89
|
+
type_name = type['fields'][af]
|
|
90
90
|
result[af] = cast(data[af], type_name, type_name.first == '[', af)
|
|
91
91
|
end
|
|
92
92
|
end
|
|
@@ -135,8 +135,6 @@ module Surikat
|
|
|
135
135
|
method_selectors = shallow_selectors
|
|
136
136
|
end
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
140
138
|
puts "
|
|
141
139
|
\ttype_name_single: #{type_name_single}
|
|
142
140
|
\tfields: #{fields.inspect}
|
|
@@ -264,7 +262,13 @@ module Surikat
|
|
|
264
262
|
expected ||= {}
|
|
265
263
|
given ||= {}
|
|
266
264
|
|
|
267
|
-
|
|
265
|
+
required = expected.keys.select { |k| expected[k].include?('!') }
|
|
266
|
+
|
|
267
|
+
# Make sure all required arguments are present
|
|
268
|
+
return false unless (required & given.keys) == required
|
|
269
|
+
|
|
270
|
+
# Make sure no unknown arguments exist
|
|
271
|
+
return false unless (given.keys - expected.keys).empty?
|
|
268
272
|
|
|
269
273
|
given.each do |k, v|
|
|
270
274
|
given[k] = cast_scalar(v, expected[k])
|
|
@@ -324,64 +328,75 @@ module Surikat
|
|
|
324
328
|
given.selections.map(&:name) - expected_type['fields'].keys
|
|
325
329
|
end
|
|
326
330
|
|
|
327
|
-
# Turn a parsed query into a
|
|
331
|
+
# Turn a parsed query into a response by means of a routing table
|
|
332
|
+
# Returns the response, suitable for serialization, and an errors array.
|
|
328
333
|
def query(selection)
|
|
329
|
-
name
|
|
330
|
-
|
|
334
|
+
name = selection.name
|
|
331
335
|
route = routes['queries'][name]
|
|
332
336
|
|
|
333
|
-
return({
|
|
334
|
-
|
|
335
|
-
return({error: 'Access denied'}) unless allowed?(route)
|
|
337
|
+
return([nil, [{unknownQueryName: true}]]) if route.nil?
|
|
338
|
+
return([nil, [{accessDenied: true}]]) unless allowed?(route)
|
|
336
339
|
|
|
337
340
|
arguments = {}
|
|
338
341
|
selection.arguments.each do |argument|
|
|
339
342
|
arguments[argument.name] = argument.value
|
|
340
343
|
end
|
|
341
344
|
|
|
342
|
-
cast_arguments = validate_arguments(arguments, route['arguments'])
|
|
343
|
-
|
|
345
|
+
unless cast_arguments = validate_arguments(arguments, route['arguments'])
|
|
346
|
+
error = "Expected arguments: {#{route['arguments'].to_a.map {|k, v| "#{k} (#{v})"}.join(', ')}}. Received instead {#{arguments.to_a.map {|k, v| "#{k}: #{v}"}.join(', ')}}."
|
|
347
|
+
return([nil, [{argumentError: error}]])
|
|
348
|
+
end
|
|
344
349
|
|
|
345
350
|
invalid_s = invalid_selectors(selection, route['output_type'])
|
|
346
|
-
return({
|
|
351
|
+
return([nil, [{selectorError: "Invalid selectors: #{invalid_s.join(', ')}"}]]) unless invalid_s.empty?
|
|
347
352
|
|
|
348
353
|
queries = Object.const_get(route['class']).new(cast_arguments, self.session)
|
|
349
354
|
data = queries.send(route['method'])
|
|
350
355
|
|
|
351
|
-
return({
|
|
356
|
+
return([nil, [{noResult: true}]]) if data.nil? || data.class.to_s == 'ActiveRecord::Relation' && data.empty?
|
|
352
357
|
|
|
353
358
|
begin
|
|
354
|
-
hashify(data, selection.selections, route['output_type'])
|
|
359
|
+
hashified_data = hashify(data, selection.selections, route['output_type'])
|
|
360
|
+
if hashified_data.is_a?(Hash) && hashified_data[:errors]
|
|
361
|
+
[nil, hashified_data[:errors]]
|
|
362
|
+
else
|
|
363
|
+
[hashified_data, []]
|
|
364
|
+
end
|
|
355
365
|
rescue Exception => e
|
|
356
366
|
puts "EXCEPTION: #{e.message}\n#{e.backtrace.join("\n")}"
|
|
357
|
-
return({error: e.message})
|
|
367
|
+
return([nil, [{error: e.message}]])
|
|
358
368
|
end
|
|
359
369
|
|
|
360
370
|
end
|
|
361
371
|
|
|
362
|
-
# Turn a parsed mutation into a
|
|
372
|
+
# Turn a parsed mutation into a response suitable for serialization.
|
|
373
|
+
# Returns the Hash object and an errors array.
|
|
363
374
|
def mutation(selection, variable_definitions, variables)
|
|
364
|
-
name
|
|
365
|
-
|
|
375
|
+
name = selection.name
|
|
366
376
|
route = routes['mutations'][name]
|
|
367
377
|
|
|
368
|
-
return({
|
|
369
|
-
return({
|
|
378
|
+
return([nil, [{unknownQueryName: true}]]) if route.nil?
|
|
379
|
+
return([nil, [{accessDenied: true}]]) unless allowed?(route)
|
|
370
380
|
|
|
371
381
|
begin
|
|
372
382
|
check_variables(variables, variable_definitions)
|
|
373
383
|
rescue Exception => e
|
|
374
|
-
return(
|
|
384
|
+
return([nil, [variableError: e.message]])
|
|
375
385
|
end
|
|
376
386
|
|
|
377
387
|
queries = Object.const_get(route['class']).new(variables, self.session)
|
|
378
388
|
data = queries.send(route['method'])
|
|
379
389
|
|
|
380
390
|
begin
|
|
381
|
-
hashify(data, selection.selections, route['output_type'])
|
|
391
|
+
hashified_data = hashify(data, selection.selections, route['output_type'])
|
|
392
|
+
if hashified_data.is_a?(Hash) && hashified_data[:errors]
|
|
393
|
+
[nil, hashified_data[:errors]]
|
|
394
|
+
else
|
|
395
|
+
[hashified_data, []]
|
|
396
|
+
end
|
|
382
397
|
rescue Exception => e
|
|
383
398
|
puts "EXCEPTION: #{e.message}\n#{e.backtrace.join("\n")}"
|
|
384
|
-
return(
|
|
399
|
+
return([nil, [error: e.message]])
|
|
385
400
|
end
|
|
386
401
|
|
|
387
402
|
end
|
|
@@ -423,14 +438,18 @@ module Surikat
|
|
|
423
438
|
|
|
424
439
|
self.session = options[:session_key].blank? ? {} : Surikat::Session.new(options[:session_key])
|
|
425
440
|
|
|
426
|
-
|
|
441
|
+
data = {}
|
|
442
|
+
errors = []
|
|
427
443
|
|
|
428
444
|
parsed_query.definitions.each do |definition|
|
|
429
445
|
case definition.operation_type
|
|
430
446
|
|
|
431
447
|
when 'query'
|
|
432
448
|
definition.selections.each do |selection|
|
|
433
|
-
|
|
449
|
+
q_result, q_errors = query(selection)
|
|
450
|
+
errors += q_errors
|
|
451
|
+
|
|
452
|
+
data[selection.name] = q_result
|
|
434
453
|
end
|
|
435
454
|
|
|
436
455
|
when 'mutation'
|
|
@@ -438,11 +457,17 @@ module Surikat
|
|
|
438
457
|
definition.variables.each {|v| variable_definitions[v.name] = v.type.name}
|
|
439
458
|
|
|
440
459
|
definition.selections.each do |selection|
|
|
441
|
-
|
|
460
|
+
q_result, q_errors = mutation(selection, variable_definitions, variables)
|
|
461
|
+
errors += q_errors
|
|
462
|
+
|
|
463
|
+
data[selection.name] = q_result
|
|
442
464
|
end
|
|
443
465
|
end
|
|
444
466
|
end
|
|
445
467
|
|
|
468
|
+
result = {data: data}
|
|
469
|
+
result.merge!({errors: errors}) unless errors.empty?
|
|
470
|
+
|
|
446
471
|
result
|
|
447
472
|
end
|
|
448
473
|
end
|
|
@@ -18,14 +18,15 @@ describe AAAQueries do
|
|
|
18
18
|
query = "{ Authenticate(email: \"a@b.com\", password: \"onetwothree\") }"
|
|
19
19
|
response = Surikat::run query
|
|
20
20
|
|
|
21
|
-
expect(response['Authenticate']).to be true
|
|
21
|
+
expect(response[:data]['Authenticate']).to be true
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
it "should incorrectly authenticate User" do
|
|
25
25
|
query = "{ Authenticate(email: \"a@b.com\", password: \"definitely not onetwothree\") }"
|
|
26
26
|
response = Surikat::run query
|
|
27
27
|
|
|
28
|
-
expect(response[
|
|
28
|
+
expect(response[:errors]).to be_a Array
|
|
29
|
+
expect(response[:errors]).to include({noResult: true})
|
|
29
30
|
end
|
|
30
31
|
end
|
|
31
32
|
|
|
@@ -40,13 +41,15 @@ describe AAAQueries do
|
|
|
40
41
|
query = "{ DemoOne }"
|
|
41
42
|
response = Surikat::run query, {}, session_key: @session_key
|
|
42
43
|
|
|
43
|
-
expect(response['DemoOne']).to include "if you see this"
|
|
44
|
+
expect(response[:data]['DemoOne']).to include "if you see this"
|
|
44
45
|
end
|
|
45
46
|
|
|
46
47
|
it "should not allow a non-logged in user to access a private route" do
|
|
47
48
|
query = "{ DemoOne }"
|
|
48
49
|
response = Surikat::run query
|
|
49
|
-
expect(response[
|
|
50
|
+
expect(response[:errors]).to be_a Array
|
|
51
|
+
expect(response[:errors]).to include({accessDenied: true})
|
|
52
|
+
expect(response[:data]['DemoOne']).to be nil
|
|
50
53
|
end
|
|
51
54
|
|
|
52
55
|
|
|
@@ -58,13 +61,15 @@ describe AAAQueries do
|
|
|
58
61
|
# Then, log them out
|
|
59
62
|
query = "{ Logout }"
|
|
60
63
|
response = Surikat::run query, {}, {session_key: @session_key}
|
|
61
|
-
expect(response['Logout']).to be true
|
|
64
|
+
expect(response[:data]['Logout']).to be true
|
|
62
65
|
|
|
63
66
|
# Then, check that they don't have access to a private query
|
|
64
67
|
query = "{ DemoOne }"
|
|
65
68
|
response = Surikat::run query, {}, {session_key: @session_key}
|
|
66
69
|
|
|
67
|
-
expect(response[
|
|
70
|
+
expect(response[:errors]).to be_a Array
|
|
71
|
+
expect(response[:errors]).to include({accessDenied: true})
|
|
72
|
+
expect(response[:data]['DemoOne']).to be nil
|
|
68
73
|
end
|
|
69
74
|
|
|
70
75
|
it "should retrieve the current user" do
|
|
@@ -75,7 +80,7 @@ describe AAAQueries do
|
|
|
75
80
|
query = "{ CurrentUser {id} }"
|
|
76
81
|
response = Surikat::run query, {}, {session_key: @session_key}
|
|
77
82
|
|
|
78
|
-
expect(response['CurrentUser']).to eq 'id' => @user.id
|
|
83
|
+
expect(response[:data]['CurrentUser']).to eq 'id' => @user.id
|
|
79
84
|
end
|
|
80
85
|
end
|
|
81
86
|
|
|
@@ -89,7 +94,9 @@ describe AAAQueries do
|
|
|
89
94
|
query = "{ DemoTwo }"
|
|
90
95
|
response = Surikat::run query, {}, {session_key: @session_key}
|
|
91
96
|
|
|
92
|
-
expect(response[
|
|
97
|
+
expect(response[:errors]).to be_a Array
|
|
98
|
+
expect(response[:errors]).to include({accessDenied: true})
|
|
99
|
+
expect(response[:data]['DemoTwo']).to be nil
|
|
93
100
|
end
|
|
94
101
|
|
|
95
102
|
it "should allow a user of the right role to a route protected by roles" do
|
|
@@ -101,14 +108,14 @@ describe AAAQueries do
|
|
|
101
108
|
query = "{ DemoThree }"
|
|
102
109
|
response = Surikat::run query, {}, {session_key: @session_key}
|
|
103
110
|
|
|
104
|
-
expect(response['DemoThree']).to include "if you see this"
|
|
111
|
+
expect(response[:data]['DemoThree']).to include "if you see this"
|
|
105
112
|
end
|
|
106
113
|
|
|
107
114
|
it "should allow a superadmin to login as another user" do
|
|
108
115
|
# First, log a superadmin in
|
|
109
116
|
query = "{ Authenticate(email: \"#{@superadmin.email}\", password: \"onetwothree\") }"
|
|
110
117
|
response = Surikat::run query, {}, session_key: @session_key
|
|
111
|
-
session_key = response['Authenticate']
|
|
118
|
+
session_key = response[:data]['Authenticate']
|
|
112
119
|
|
|
113
120
|
# Then, create another user and login as them
|
|
114
121
|
user = User.create_random
|
|
@@ -120,7 +127,7 @@ describe AAAQueries do
|
|
|
120
127
|
query = "{ CurrentUser {id} }"
|
|
121
128
|
response = Surikat::run query, {}, {session_key: @session_key}
|
|
122
129
|
|
|
123
|
-
expect(response['CurrentUser']).to include 'id' => user.id
|
|
130
|
+
expect(response[:data]['CurrentUser']).to include 'id' => user.id
|
|
124
131
|
end
|
|
125
132
|
|
|
126
133
|
it "should allow a superadmin to return after having logged in as someone else" do
|
|
@@ -142,7 +149,7 @@ describe AAAQueries do
|
|
|
142
149
|
query = "{ CurrentUser {id} }"
|
|
143
150
|
response = Surikat::run query, {}, {session_key: @session_key}
|
|
144
151
|
|
|
145
|
-
expect(response['CurrentUser']).to include 'id' => @superadmin.id
|
|
152
|
+
expect(response[:data]['CurrentUser']).to include 'id' => @superadmin.id
|
|
146
153
|
end
|
|
147
154
|
|
|
148
155
|
end
|
|
@@ -25,7 +25,7 @@ describe % {class_name}Queries do
|
|
|
25
25
|
"%{class_name}" => dates2string(@%{model_name}.attributes.slice(*@expected_fields))
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
expect(response).to eq expected
|
|
28
|
+
expect(response[:data]).to eq expected
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
[ %{columns_space} ].each do |col|
|
|
@@ -43,7 +43,7 @@ describe % {class_name}Queries do
|
|
|
43
43
|
})
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
expect(response).to eq expected
|
|
46
|
+
expect(response[:data]).to eq expected
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
@@ -59,7 +59,7 @@ describe % {class_name}Queries do
|
|
|
59
59
|
"%{class_name_plural}" => ([ @%{model_name}] + @more_%{model_name_plural}).map {|r| dates2string(r.attributes.slice(*@expected_fields))}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
expect(response).to eq expected
|
|
62
|
+
expect(response[:data]).to eq expected
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
end
|
|
@@ -89,8 +89,8 @@ describe % {class_name}Queries do
|
|
|
89
89
|
|
|
90
90
|
response = Surikat::run query, variables
|
|
91
91
|
|
|
92
|
-
expect(response).to be_instance_of Hash
|
|
93
|
-
expect(response['%{class_name}']).to include variables['%{model_name}'].slice(*@expected_fields)
|
|
92
|
+
expect(response[:data]).to be_instance_of Hash
|
|
93
|
+
expect(response[:data]['%{class_name}']).to include variables['%{model_name}'].slice(*@expected_fields)
|
|
94
94
|
end
|
|
95
95
|
|
|
96
96
|
it "should update an instance of %{class_name}" do
|
|
@@ -114,8 +114,8 @@ describe % {class_name}Queries do
|
|
|
114
114
|
|
|
115
115
|
response = Surikat::run query, variables
|
|
116
116
|
|
|
117
|
-
expect(response).to be_instance_of Hash
|
|
118
|
-
expect(response['Update%{class_name}']).to eq true
|
|
117
|
+
expect(response[:data]).to be_instance_of Hash
|
|
118
|
+
expect(response[:data]['Update%{class_name}']).to eq true
|
|
119
119
|
|
|
120
120
|
# Step 2: Test that the record has been updated
|
|
121
121
|
%{model_name}.reload
|
|
@@ -136,8 +136,8 @@ describe % {class_name}Queries do
|
|
|
136
136
|
|
|
137
137
|
response = Surikat::run query, variables
|
|
138
138
|
|
|
139
|
-
expect(response).to be_instance_of Hash
|
|
140
|
-
expect(response['Delete%{class_name}']).to eq true
|
|
139
|
+
expect(response[:data]).to be_instance_of Hash
|
|
140
|
+
expect(response[:data]['Delete%{class_name}']).to eq true
|
|
141
141
|
|
|
142
142
|
# Step 2: Test that the object actually doesn't exist
|
|
143
143
|
expect {%{model_name}.reload}.to raise_error ActiveRecord::RecordNotFound
|
|
@@ -5,7 +5,7 @@ describe HelloQueries do
|
|
|
5
5
|
describe "Surikat" do
|
|
6
6
|
it "should respond nicely" do
|
|
7
7
|
response = Surikat.run '{Hello}', {}
|
|
8
|
-
expect(response['Hello']).to eq 'world'
|
|
8
|
+
expect(response[:data]['Hello']).to eq 'world'
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
end
|
|
@@ -15,24 +15,24 @@ describe HelloQueries do
|
|
|
15
15
|
it "should persist data in session between requests" do
|
|
16
16
|
query = "{AddSession}"
|
|
17
17
|
response = Surikat::run(query, {}, {session_key: 'abc'})
|
|
18
|
-
expect(response['AddSession']).to include ','
|
|
18
|
+
expect(response[:data]['AddSession']).to include ','
|
|
19
19
|
|
|
20
|
-
key, val = response['AddSession'].split(',')
|
|
20
|
+
key, val = response[:data]['AddSession'].split(',')
|
|
21
21
|
query = '{ShowSession}'
|
|
22
22
|
response = Surikat::run(query, {}, {session_key: 'abc'})
|
|
23
|
-
expect(response['ShowSession']).to include val
|
|
24
|
-
expect(response['ShowSession']).to include key
|
|
23
|
+
expect(response[:data]['ShowSession']).to include val
|
|
24
|
+
expect(response[:data]['ShowSession']).to include key
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
it "should not persist data across different sessions" do
|
|
28
28
|
query = "{AddSession}"
|
|
29
29
|
response = Surikat::run(query, {}, {session_key: 'abc'})
|
|
30
|
-
expect(response['AddSession']).to include ','
|
|
30
|
+
expect(response[:data]['AddSession']).to include ','
|
|
31
31
|
|
|
32
|
-
_, val = response['AddSession'].split(',')
|
|
32
|
+
_, val = response[:data]['AddSession'].split(',')
|
|
33
33
|
query = '{ShowSession}'
|
|
34
34
|
response = Surikat::run(query, {}, {session_key: 'def'})
|
|
35
|
-
expect(response['ShowSession']).to_not include val
|
|
35
|
+
expect(response[:data]['ShowSession']).to_not include val
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
end
|
data/lib/surikat/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: surikat
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alex Deva
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-06-
|
|
11
|
+
date: 2018-06-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: pry
|