parse-ruby-client 0.1.15 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/test_query.rb CHANGED
@@ -2,6 +2,8 @@ require 'helper'
2
2
 
3
3
  class TestQuery < ParseTestCase
4
4
 
5
+ EMPTY_QUERY_RESPONSE = {Parse::Protocol::KEY_RESULTS => []}
6
+
5
7
  def test_get
6
8
  VCR.use_cassette('test_get', :record => :new_episodes) do
7
9
  post = Parse::Object.new "Post"
@@ -64,7 +66,7 @@ class TestQuery < ParseTestCase
64
66
  q.limit = 2
65
67
  q.skip = 3
66
68
  query_matcher = has_entries(:limit => 2, :skip => 3)
67
- Parse::Client.any_instance.expects(:request).with(anything, :get, nil, query_matcher).returns({}.to_json)
69
+ Parse::Client.any_instance.expects(:request).with(anything, :get, nil, query_matcher).returns(EMPTY_QUERY_RESPONSE)
68
70
  q.get
69
71
  end
70
72
  end
@@ -74,8 +76,9 @@ class TestQuery < ParseTestCase
74
76
  q = Parse::Query.new "TestQuery"
75
77
  q.count = true
76
78
  query_matcher = has_entries(:count => true)
77
- Parse::Client.any_instance.expects(:request).with(anything, :get, nil, query_matcher).returns({}.to_json)
78
- q.get
79
+ Parse::Client.any_instance.expects(:request).with(anything, :get, nil, query_matcher).returns(EMPTY_QUERY_RESPONSE.merge("count" => 1000))
80
+ results = q.get
81
+ assert_equal 1000, results['count']
79
82
  end
80
83
  end
81
84
 
@@ -124,4 +127,25 @@ class TestQuery < ParseTestCase
124
127
  outer_query.in_query("inner", inner_query)
125
128
  assert_equal({"inner"=>{"$inQuery"=>{"className"=>"Inner", "where"=>{"foo"=>"bar"}}}}, outer_query.where)
126
129
  end
130
+
131
+ def test_large_value_in_xget
132
+ VCR.use_cassette('test_xget', :record => :new_episodes) do
133
+ post = Parse::Object.new("Post")
134
+ post.save
135
+
136
+ other_post = Parse::Object.new("Post")
137
+ other_post.save
138
+
139
+ assert_equal [post], Parse::Query.new("Post").value_in("objectId", [post.id] + 5000.times.map { "x" }).get
140
+ end
141
+ end
142
+
143
+ def test_bad_response
144
+ VCR.use_cassette('test_bad_response', :record => :new_episodes) do
145
+ Parse::Client.any_instance.expects(:request).returns("crap")
146
+ assert_raises do
147
+ Parse::Query.new("Post").get
148
+ end
149
+ end
150
+ end
127
151
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parse-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-05-22 00:00:00.000000000 Z
13
+ date: 2013-10-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: patron
@@ -113,17 +113,17 @@ dependencies:
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  none: false
115
115
  requirements:
116
- - - ! '>='
116
+ - - ~>
117
117
  - !ruby/object:Gem::Version
118
- version: '0'
118
+ version: 1.8.5
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  none: false
123
123
  requirements:
124
- - - ! '>='
124
+ - - ~>
125
125
  - !ruby/object:Gem::Version
126
- version: '0'
126
+ version: 1.8.5
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: simplecov
129
129
  requirement: !ruby/object:Gem::Requirement
@@ -197,8 +197,8 @@ files:
197
197
  - fixtures/vcr_cassettes/test_batch_create_object.yml
198
198
  - fixtures/vcr_cassettes/test_batch_delete_object.yml
199
199
  - fixtures/vcr_cassettes/test_batch_run.yml
200
+ - fixtures/vcr_cassettes/test_batch_update_nils_delete_keys.yml
200
201
  - fixtures/vcr_cassettes/test_batch_update_object.yml
201
- - fixtures/vcr_cassettes/test_circular_save.yml
202
202
  - fixtures/vcr_cassettes/test_created_at.yml
203
203
  - fixtures/vcr_cassettes/test_decrement.yml
204
204
  - fixtures/vcr_cassettes/test_deep_parse.yml
@@ -215,18 +215,21 @@ files:
215
215
  - fixtures/vcr_cassettes/test_pointer.yml
216
216
  - fixtures/vcr_cassettes/test_save_with_sub_objects.yml
217
217
  - fixtures/vcr_cassettes/test_saving_boolean_values.yml
218
+ - fixtures/vcr_cassettes/test_saving_nested_objects.yml
218
219
  - fixtures/vcr_cassettes/test_server_update.yml
219
220
  - fixtures/vcr_cassettes/test_simple_save.yml
220
221
  - fixtures/vcr_cassettes/test_text_file_save.yml
221
222
  - fixtures/vcr_cassettes/test_update.yml
222
223
  - fixtures/vcr_cassettes/test_updated_at.yml
223
224
  - fixtures/vcr_cassettes/test_user_save.yml
225
+ - fixtures/vcr_cassettes/test_xget.yml
224
226
  - lib/parse-ruby-client.rb
225
227
  - lib/parse/batch.rb
226
228
  - lib/parse/client.rb
227
229
  - lib/parse/cloud.rb
228
230
  - lib/parse/datatypes.rb
229
231
  - lib/parse/error.rb
232
+ - lib/parse/http_client.rb
230
233
  - lib/parse/model.rb
231
234
  - lib/parse/object.rb
232
235
  - lib/parse/protocol.rb
@@ -267,7 +270,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
267
270
  version: '0'
268
271
  segments:
269
272
  - 0
270
- hash: 4203389409759710267
273
+ hash: -2719138252462662058
271
274
  required_rubygems_version: !ruby/object:Gem::Requirement
272
275
  none: false
273
276
  requirements:
@@ -1,121 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://api.parse.com/1/classes/CircularBar
6
- body:
7
- encoding: UTF-8
8
- string: "{\"bar\":{\"__op\":\"Delete\"},\"text\":\"bar_2\"}"
9
- headers:
10
- Content-Type:
11
- - application/json
12
- Accept:
13
- - application/json
14
- User-Agent:
15
- - Parse for Ruby, 0.0
16
- X-Parse-Master-Key:
17
- - ""
18
- X-Parse-Rest-Api-Key:
19
- - <X-Parse-REST-API-Key>
20
- X-Parse-Application-Id:
21
- - <X-Parse-Application-Id>
22
- X-Parse-Session-Token:
23
- - ""
24
- Expect:
25
- - ""
26
- response:
27
- status:
28
- code: 201
29
- message: Created
30
- headers:
31
- Access-Control-Allow-Origin:
32
- - "*"
33
- Access-Control-Request-Method:
34
- - "*"
35
- Cache-Control:
36
- - no-cache
37
- Content-Type:
38
- - application/json; charset=utf-8
39
- Date:
40
- - Mon, 22 Apr 2013 16:03:17 GMT
41
- Location:
42
- - https://api.parse.com/1/classes/CircularBar/JyVRVNuOlB
43
- Server:
44
- - nginx/1.2.2
45
- Set-Cookie:
46
- - <COOKIE-KEY>
47
- Status:
48
- - 201 Created
49
- X-Runtime:
50
- - "0.026885"
51
- X-Ua-Compatible:
52
- - IE=Edge,chrome=1
53
- Content-Length:
54
- - "64"
55
- Connection:
56
- - keep-alive
57
- body:
58
- encoding: ASCII-8BIT
59
- string: "{\"createdAt\":\"2013-04-22T16:03:17.562Z\",\"objectId\":\"JyVRVNuOlB\"}"
60
- http_version:
61
- recorded_at: Mon, 22 Apr 2013 16:03:17 GMT
62
- - request:
63
- method: post
64
- uri: https://api.parse.com/1/classes/CircularBar
65
- body:
66
- encoding: UTF-8
67
- string: "{\"text\":\"bar\",\"bar\":{\"__type\":\"Pointer\",\"className\":\"CircularBar\",\"objectId\":\"JyVRVNuOlB\"}}"
68
- headers:
69
- Content-Type:
70
- - application/json
71
- Accept:
72
- - application/json
73
- User-Agent:
74
- - Parse for Ruby, 0.0
75
- X-Parse-Master-Key:
76
- - ""
77
- X-Parse-Rest-Api-Key:
78
- - <X-Parse-REST-API-Key>
79
- X-Parse-Application-Id:
80
- - <X-Parse-Application-Id>
81
- X-Parse-Session-Token:
82
- - ""
83
- Expect:
84
- - ""
85
- response:
86
- status:
87
- code: 201
88
- message: Created
89
- headers:
90
- Access-Control-Allow-Origin:
91
- - "*"
92
- Access-Control-Request-Method:
93
- - "*"
94
- Cache-Control:
95
- - no-cache
96
- Content-Type:
97
- - application/json; charset=utf-8
98
- Date:
99
- - Mon, 22 Apr 2013 16:03:17 GMT
100
- Location:
101
- - https://api.parse.com/1/classes/CircularBar/ozNdHHQrHP
102
- Server:
103
- - nginx/1.2.2
104
- Set-Cookie:
105
- - <COOKIE-KEY>
106
- Status:
107
- - 201 Created
108
- X-Runtime:
109
- - "0.033931"
110
- X-Ua-Compatible:
111
- - IE=Edge,chrome=1
112
- Content-Length:
113
- - "64"
114
- Connection:
115
- - keep-alive
116
- body:
117
- encoding: ASCII-8BIT
118
- string: "{\"createdAt\":\"2013-04-22T16:03:17.626Z\",\"objectId\":\"ozNdHHQrHP\"}"
119
- http_version:
120
- recorded_at: Mon, 22 Apr 2013 16:03:17 GMT
121
- recorded_with: VCR 2.4.0