query-interface-server 0.1.2 → 0.1.3
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: fed8b7439d3f2e04a839c1ba53a70b7571a90d17
|
4
|
+
data.tar.gz: 3baa596556cff58beee39a24b581694ea5a8166c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dcbd75eff1e6b87cf0865e28a36596fa313f6661af0cc7573c8974544689820e75d96fe9c6b9277eb059719a47fec8489030ffeef1b36a78e14db316c8fece2
|
7
|
+
data.tar.gz: 2e37f8e37a7e9fb64a771d650dd231d8c70fd2112e9afbe483eacbe7fa790b29d1d2617a120b329f9001c2dafd4b273746e4ca2ba6e4ae5061bacd92379ec2b3
|
@@ -124,7 +124,11 @@ module QueryInterface
|
|
124
124
|
self.context = self.send(method, param)
|
125
125
|
end
|
126
126
|
self.context = self.default_order if self.context_type == :dataset
|
127
|
-
|
127
|
+
unless self.context.nil?
|
128
|
+
respond_with(self.context)
|
129
|
+
else
|
130
|
+
render text: "", status: :not_found
|
131
|
+
end
|
128
132
|
end
|
129
133
|
end
|
130
134
|
end
|
@@ -149,12 +149,23 @@ describe QueryInterface, type: :controller do
|
|
149
149
|
controller.query_model.should_receive(:filter).and_return(foos)
|
150
150
|
controller.stub(:default_order).and_return(context)
|
151
151
|
foos.should_receive(:select_all).with(:foo_table).and_return(context)
|
152
|
-
|
153
152
|
get :query, transformations: [], format: :json
|
154
153
|
controller.context.should eq(context)
|
155
154
|
assigns(:context).should eq(context)
|
156
155
|
response.should be_ok
|
157
156
|
end
|
157
|
+
|
158
|
+
it "should respond with 404 when no result can be reached" do
|
159
|
+
context = double("context")
|
160
|
+
controller.query_model.should_receive(:filter).and_return(foos)
|
161
|
+
controller.stub(:default_order).and_return(nil)
|
162
|
+
foos.should_receive(:select_all).with(:foo_table).and_return(nil)
|
163
|
+
get :query, transformations: [], format: :json
|
164
|
+
controller.context.should eq(nil)
|
165
|
+
assigns(:context).should eq(nil)
|
166
|
+
response.should_not be_ok
|
167
|
+
response.status.should eq(404)
|
168
|
+
end
|
158
169
|
end
|
159
170
|
|
160
171
|
|
@@ -212,6 +223,7 @@ describe QueryInterface, type: :controller do
|
|
212
223
|
assigns(:context).should == [1, 2]
|
213
224
|
end
|
214
225
|
|
226
|
+
|
215
227
|
end
|
216
228
|
end
|
217
229
|
end
|