dm-parse 0.3.14 → 0.3.15
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/dm-parse.gemspec +2 -2
- data/lib/adapters/parse_adapter.rb +5 -3
- data/spec/parse_adapter_spec.rb +10 -5
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.15
|
data/dm-parse.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "dm-parse"
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.15"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Zhi-Qiang Lei"]
|
12
|
-
s.date = "2012-07-
|
12
|
+
s.date = "2012-07-25"
|
13
13
|
s.description = "An extension to make DataMapper working on Parse.com"
|
14
14
|
s.email = "zhiqiang.lei@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -207,6 +207,7 @@ module DataMapper
|
|
207
207
|
translate c, r
|
208
208
|
r
|
209
209
|
end
|
210
|
+
when ["0 = 1"] # workaround for cancan
|
210
211
|
else
|
211
212
|
raise NotImplementedError
|
212
213
|
end
|
@@ -272,9 +273,10 @@ module DataMapper
|
|
272
273
|
equals = groups[true]
|
273
274
|
others = groups[false]
|
274
275
|
|
275
|
-
|
276
|
-
|
277
|
-
|
276
|
+
# It's such a pity that js query cannot combine equal comparison
|
277
|
+
# with other comparisons, but DataMapper will construct query
|
278
|
+
# in that way.
|
279
|
+
if equals.present?
|
278
280
|
raise "can only use one EqualToComparison for a field" unless equals.size == 1
|
279
281
|
equals.first.as_json
|
280
282
|
elsif others.present?
|
data/spec/parse_adapter_spec.rb
CHANGED
@@ -102,6 +102,16 @@ describe DataMapper::Adapters::ParseAdapter do
|
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
|
+
context "when query has :eql and others of one field" do
|
106
|
+
let(:query) { model.all(:rank => 5, :rank.gt => 3).query }
|
107
|
+
it { should eq("rank" => 5) }
|
108
|
+
end
|
109
|
+
|
110
|
+
context "when query has [\"0 = 1\"]" do
|
111
|
+
let(:query) { model.all(conditions: ["0 = 1"]).query }
|
112
|
+
it { should eq({}) }
|
113
|
+
end
|
114
|
+
|
105
115
|
describe "exceptions" do
|
106
116
|
subject { -> { adapter.send :parse_conditions_for, query } }
|
107
117
|
|
@@ -109,11 +119,6 @@ describe DataMapper::Adapters::ParseAdapter do
|
|
109
119
|
let(:query) { (model.all("rank" => 5) & model.all("rank" => 3)).query }
|
110
120
|
it { should raise_error("can only use one EqualToComparison for a field") }
|
111
121
|
end
|
112
|
-
|
113
|
-
context "when query has :eql and others of one field" do
|
114
|
-
let(:query) { model.all(:rank => 5, :rank.gt => 3).query }
|
115
|
-
it { should raise_error }
|
116
|
-
end
|
117
122
|
end # exceptions
|
118
123
|
end # #parse_conditions_for
|
119
124
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-parse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dm-core
|
@@ -258,7 +258,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
258
258
|
version: '0'
|
259
259
|
segments:
|
260
260
|
- 0
|
261
|
-
hash:
|
261
|
+
hash: -4398516798532427400
|
262
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
263
263
|
none: false
|
264
264
|
requirements:
|