searchlogic 1.5.4 → 1.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +13 -0
- data/Manifest +7 -1
- data/README.rdoc +78 -11
- data/Rakefile +15 -11
- data/lib/searchlogic/condition/base.rb +5 -1
- data/lib/searchlogic/condition/keywords.rb +2 -2
- data/lib/searchlogic/conditions/any_or_all.rb +42 -0
- data/lib/searchlogic/conditions/base.rb +36 -312
- data/lib/searchlogic/conditions/groups.rb +37 -0
- data/lib/searchlogic/conditions/magic_methods.rb +268 -0
- data/lib/searchlogic/conditions/protection.rb +1 -1
- data/lib/searchlogic/config/helpers.rb +77 -28
- data/lib/searchlogic/helpers/control_types/links.rb +1 -0
- data/lib/searchlogic/helpers/form.rb +1 -1
- data/lib/searchlogic/shared/utilities.rb +9 -2
- data/lib/searchlogic/version.rb +1 -1
- data/lib/searchlogic.rb +6 -0
- data/searchlogic.gemspec +9 -7
- data/test/active_record_tests/base_test.rb +13 -13
- data/test/condition_tests/{keyswords_test.rb → keywords_test.rb} +4 -0
- data/test/conditions_tests/any_or_all_test.rb +23 -0
- data/test/conditions_tests/base_test.rb +45 -88
- data/test/conditions_tests/groups_test.rb +51 -0
- data/test/conditions_tests/magic_methods_test.rb +24 -0
- data/test/search_tests/base_test.rb +7 -3
- data/test/test_helper.rb +12 -28
- metadata +17 -5
data/test/test_helper.rb
CHANGED
@@ -49,6 +49,13 @@ ActiveRecord::Schema.define(:version => 1) do
|
|
49
49
|
t.binary :receipt
|
50
50
|
end
|
51
51
|
|
52
|
+
create_table :line_items do |t|
|
53
|
+
t.datetime :created_at
|
54
|
+
t.datetime :updated_at
|
55
|
+
t.integer :order_id
|
56
|
+
t.string :name
|
57
|
+
end
|
58
|
+
|
52
59
|
create_table :animals do |t|
|
53
60
|
t.datetime :created_at
|
54
61
|
t.datetime :updated_at
|
@@ -81,6 +88,11 @@ end
|
|
81
88
|
|
82
89
|
class Order < ActiveRecord::Base
|
83
90
|
belongs_to :user
|
91
|
+
has_many :line_items
|
92
|
+
end
|
93
|
+
|
94
|
+
class LineItem < ActiveRecord::Base
|
95
|
+
belongs_to :order
|
84
96
|
end
|
85
97
|
|
86
98
|
# STI
|
@@ -99,32 +111,4 @@ class Test::Unit::TestCase
|
|
99
111
|
self.use_instantiated_fixtures = false
|
100
112
|
self.pre_loaded_fixtures = true
|
101
113
|
fixtures :all
|
102
|
-
|
103
|
-
private
|
104
|
-
def assert_equal_find_options(find_options, result)
|
105
|
-
find_options_conditions = find_options.delete(:conditions)
|
106
|
-
result_conditions = result.delete(:conditions)
|
107
|
-
|
108
|
-
assert_equal find_options, result
|
109
|
-
if find_options_conditions.blank? || result_conditions.blank?
|
110
|
-
assert_equal find_options_conditions, result_conditions
|
111
|
-
else
|
112
|
-
assert_equal_sql find_options_conditions, result_conditions
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
def assert_equal_sql(sql, result)
|
117
|
-
sql_parts = breakdown_sql(sql)
|
118
|
-
result_parts = breakdown_sql(sql)
|
119
|
-
|
120
|
-
assert_equal sql_parts.size, result_parts.size
|
121
|
-
sql_parts.each { |part| assert result_parts.include?(part) }
|
122
|
-
end
|
123
|
-
|
124
|
-
def breakdown_sql(sql)
|
125
|
-
sanitized_sql = ActiveRecord::Base.send(:sanitize_sql, sql)
|
126
|
-
sanitized_sql.gsub!(/(\(|\))/, "")
|
127
|
-
sql_parts = sanitized_sql.split(/or/i)
|
128
|
-
sql_parts.collect { |part| part.split(/ and /i) }.flatten
|
129
|
-
end
|
130
114
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: searchlogic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Johnson of Binary Logic
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-11-
|
12
|
+
date: 2008-11-29 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -79,7 +79,10 @@ extra_rdoc_files:
|
|
79
79
|
- lib/searchlogic/condition/not_nil.rb
|
80
80
|
- lib/searchlogic/condition/sibling_of.rb
|
81
81
|
- lib/searchlogic/condition/tree.rb
|
82
|
+
- lib/searchlogic/conditions/any_or_all.rb
|
82
83
|
- lib/searchlogic/conditions/base.rb
|
84
|
+
- lib/searchlogic/conditions/groups.rb
|
85
|
+
- lib/searchlogic/conditions/magic_methods.rb
|
83
86
|
- lib/searchlogic/conditions/protection.rb
|
84
87
|
- lib/searchlogic/config/helpers.rb
|
85
88
|
- lib/searchlogic/config/search.rb
|
@@ -177,7 +180,10 @@ files:
|
|
177
180
|
- lib/searchlogic/condition/not_nil.rb
|
178
181
|
- lib/searchlogic/condition/sibling_of.rb
|
179
182
|
- lib/searchlogic/condition/tree.rb
|
183
|
+
- lib/searchlogic/conditions/any_or_all.rb
|
180
184
|
- lib/searchlogic/conditions/base.rb
|
185
|
+
- lib/searchlogic/conditions/groups.rb
|
186
|
+
- lib/searchlogic/conditions/magic_methods.rb
|
181
187
|
- lib/searchlogic/conditions/protection.rb
|
182
188
|
- lib/searchlogic/config/helpers.rb
|
183
189
|
- lib/searchlogic/config/search.rb
|
@@ -257,7 +263,7 @@ files:
|
|
257
263
|
- test/condition_tests/greater_than_or_equal_to_test.rb
|
258
264
|
- test/condition_tests/greater_than_test.rb
|
259
265
|
- test/condition_tests/inclusive_descendant_of_test.rb
|
260
|
-
- test/condition_tests/
|
266
|
+
- test/condition_tests/keywords_test.rb
|
261
267
|
- test/condition_tests/less_than_or_equal_to_test.rb
|
262
268
|
- test/condition_tests/less_than_test.rb
|
263
269
|
- test/condition_tests/like_test.rb
|
@@ -270,7 +276,10 @@ files:
|
|
270
276
|
- test/condition_tests/not_like_test.rb
|
271
277
|
- test/condition_tests/not_nil_test.rb
|
272
278
|
- test/condition_tests/sibling_of_test.rb
|
279
|
+
- test/conditions_tests/any_or_all_test.rb
|
273
280
|
- test/conditions_tests/base_test.rb
|
281
|
+
- test/conditions_tests/groups_test.rb
|
282
|
+
- test/conditions_tests/magic_methods_test.rb
|
274
283
|
- test/conditions_tests/protection_test.rb
|
275
284
|
- test/config_test.rb
|
276
285
|
- test/fixtures/accounts.yml
|
@@ -316,7 +325,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
325
|
requirements: []
|
317
326
|
|
318
327
|
rubyforge_project: searchlogic
|
319
|
-
rubygems_version: 1.
|
328
|
+
rubygems_version: 1.3.1
|
320
329
|
signing_key:
|
321
330
|
specification_version: 2
|
322
331
|
summary: Object based ActiveRecord searching, ordering, pagination, and more!
|
@@ -333,7 +342,7 @@ test_files:
|
|
333
342
|
- test/condition_tests/greater_than_or_equal_to_test.rb
|
334
343
|
- test/condition_tests/greater_than_test.rb
|
335
344
|
- test/condition_tests/inclusive_descendant_of_test.rb
|
336
|
-
- test/condition_tests/
|
345
|
+
- test/condition_tests/keywords_test.rb
|
337
346
|
- test/condition_tests/less_than_or_equal_to_test.rb
|
338
347
|
- test/condition_tests/less_than_test.rb
|
339
348
|
- test/condition_tests/like_test.rb
|
@@ -346,7 +355,10 @@ test_files:
|
|
346
355
|
- test/condition_tests/not_like_test.rb
|
347
356
|
- test/condition_tests/not_nil_test.rb
|
348
357
|
- test/condition_tests/sibling_of_test.rb
|
358
|
+
- test/conditions_tests/any_or_all_test.rb
|
349
359
|
- test/conditions_tests/base_test.rb
|
360
|
+
- test/conditions_tests/groups_test.rb
|
361
|
+
- test/conditions_tests/magic_methods_test.rb
|
350
362
|
- test/conditions_tests/protection_test.rb
|
351
363
|
- test/config_test.rb
|
352
364
|
- test/modifier_tests/day_of_month_test.rb
|