dm-persevere-adapter 0.29.0 → 0.30.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/persevere_adapter.rb +2 -3
- data/spec/persevere_adapter_spec.rb +8 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.30.0
|
data/lib/persevere_adapter.rb
CHANGED
@@ -631,7 +631,7 @@ module DataMapper
|
|
631
631
|
# when :like then "RegExp(\"#{condition.value.gsub!('%', '*')}\").test(#{condition.subject.name})"
|
632
632
|
# when :regexp then "RegExp(\"#{condition.value.source}\").test(#{condition.subject.name})"
|
633
633
|
when DataMapper::Query::Conditions::RegexpComparison then []
|
634
|
-
when DataMapper::Query::Conditions::LikeComparison then
|
634
|
+
when DataMapper::Query::Conditions::LikeComparison then "#{condition.subject.name.to_s}='#{condition.loaded_value.gsub('%', '*')}'"
|
635
635
|
when DataMapper::Query::Conditions::AndOperation then "(#{condition.operands.map { |op| process_condition(op) }.join("&")})"
|
636
636
|
when DataMapper::Query::Conditions::OrOperation then "(#{condition.operands.map { |op| process_condition(op) }.join("|")})"
|
637
637
|
when DataMapper::Query::Conditions::NotOperation then
|
@@ -665,7 +665,7 @@ module DataMapper
|
|
665
665
|
query.fields.each do |field|
|
666
666
|
if field.respond_to?(:operator)
|
667
667
|
field_ops << case field.operator
|
668
|
-
when :count then
|
668
|
+
when :count then
|
669
669
|
if field.target.is_a?(DataMapper::Property)
|
670
670
|
"[?#{field.target.name}!=undefined].length"
|
671
671
|
else # field.target is all.
|
@@ -712,7 +712,6 @@ module DataMapper
|
|
712
712
|
end
|
713
713
|
# puts "#{query.inspect}"
|
714
714
|
# puts json_query, headers
|
715
|
-
|
716
715
|
return json_query, headers
|
717
716
|
end
|
718
717
|
end # class PersevereAdapter
|
@@ -76,6 +76,10 @@ describe DataMapper::Adapters::PersevereAdapter do
|
|
76
76
|
}
|
77
77
|
}
|
78
78
|
end
|
79
|
+
|
80
|
+
after :all do
|
81
|
+
DataMapper::Model.descendants.each{|cur_model| cur_model.auto_migrate_down! }
|
82
|
+
end
|
79
83
|
|
80
84
|
it_should_behave_like 'An Adapter'
|
81
85
|
|
@@ -170,6 +174,10 @@ describe DataMapper::Adapters::PersevereAdapter do
|
|
170
174
|
@countries = Country.all
|
171
175
|
end
|
172
176
|
it_should_behave_like 'An Aggregatable Class'
|
177
|
+
|
178
|
+
it "should count with like conditions" do
|
179
|
+
Country.count(:name.like => '%n%').should == 4
|
180
|
+
end
|
173
181
|
end
|
174
182
|
|
175
183
|
describe 'limiting and offsets' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-persevere-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.30.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan R. Judson
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-01
|
13
|
+
date: 2010-02-01 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|