grape_ape_rails 0.9.3 → 0.9.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ed5d31f357458ac47e0fea4de39a228190de119
|
4
|
+
data.tar.gz: 9b497df070f5e9eb8be89d62d2b722035dcab780
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e9ddff44eebbd29203bb36644b91a7c8c0f36ad7c8c551429b1ecdb1930073d8d7de8a2a148821f79299e9e421882f16c0c87e2d2fa09138cb55a4fb29cfee6
|
7
|
+
data.tar.gz: 6d39757e3076506730ad99544907cfc096cb12a9c405fc27185299366f01f21e357759cad029b4525d70f1534cb4e78e6aa92c2205abc9ddcc570f90a0242398
|
@@ -40,7 +40,8 @@ module Grape
|
|
40
40
|
return %Q[{\"result\":#{MultiJson.dump(serializer)}}] if [serializer.object].flatten.size > 1
|
41
41
|
|
42
42
|
serializer.root = false
|
43
|
-
|
43
|
+
out = serializer.object.try(:empty?) ? nil : MultiJson.dump(serializer)
|
44
|
+
%Q[{\"result\":{\"#{plural}\":[#{out}]}}]
|
44
45
|
else
|
45
46
|
Grape::Formatter::GarJsonSerializer.call serializer.object, env
|
46
47
|
end
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -27,4 +27,14 @@ describe API::V1::Monkeys do
|
|
27
27
|
expect(json_result[:monkeys].size).to eql 3
|
28
28
|
end
|
29
29
|
end
|
30
|
+
|
31
|
+
describe "GET /nothings" do
|
32
|
+
it "returns proper empty array [], using the ActiveModelSerializers" do
|
33
|
+
3.times { FactoryGirl.create :monkey }
|
34
|
+
req :get, "/nothing_monkeys"
|
35
|
+
expect(response.status).to eql 200
|
36
|
+
expect(json_result[:nothing_monkeys]).to eql([])
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
30
40
|
end
|