sql_search_n_sort 1.16 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sql_search_n_sort.rb +1 -0
- data/lib/sql_search_n_sort/exceptions.rb +8 -0
- data/lib/sql_search_n_sort/sql_searchable_sortable.rb +2 -0
- data/lib/sql_search_n_sort/version.rb +1 -1
- data/test/dummy/app/controllers/unsearchables_controller.rb +5 -0
- data/test/dummy/app/models/person.rb +3 -2
- data/test/dummy/app/models/unsearchable.rb +5 -0
- data/test/dummy/app/models/vehicle.rb +1 -1
- data/test/dummy/app/views/unsearchables/index.html.haml +1 -0
- data/test/dummy/config/routes.rb +1 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20141003015903_create_unsearchables.rb +17 -0
- data/test/dummy/db/schema.rb +15 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +582 -0
- data/test/dummy/log/test.log +138826 -0
- data/test/dummy/spec/models/person_spec.rb +18 -16
- data/test/dummy/spec/models/unsearchable_spec.rb +37 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/1a3c6a30280d9edd208e090bd63e93f3 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/1dc2824e4f69b5f787cc0b33a280e1f7 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/648c2e4578a1b3733059887e5541a92a +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/991d9baf4c0665d4114d00882965f72c +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- metadata +17 -2
@@ -44,22 +44,24 @@ describe Person do
|
|
44
44
|
Person.sql_search("new jersey devils").count.should == 2
|
45
45
|
end
|
46
46
|
end
|
47
|
-
describe "Date fields" do
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
47
|
+
# describe "Date fields" do
|
48
|
+
# it "returns records with an updated at containing '2001'" do
|
49
|
+
# pending "removed sort by date functionality"
|
50
|
+
# Person.all[0].update_attribute :dob, "2001-07-25"
|
51
|
+
# Person.all[1].update_attribute :dob, "2001-12-25"
|
52
|
+
# Person.all[2].update_attribute :dob, "2001-11-11"
|
53
|
+
# Person.sql_search("2001").count.should == 3
|
54
|
+
# end
|
55
|
+
# end
|
56
|
+
# describe "Integer fields" do
|
57
|
+
# it "returns records with a grade containing '26255'" do
|
58
|
+
# pending "removed sort by integer functionality"
|
59
|
+
# Person.all[0].update_attribute :grade, 2526255
|
60
|
+
# Person.all[1].update_attribute :grade, 12625525
|
61
|
+
# Person.all[2].update_attribute :grade, 125262550
|
62
|
+
# Person.sql_search("26255").count.should == 3
|
63
|
+
# end
|
64
|
+
# end
|
63
65
|
end
|
64
66
|
|
65
67
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Unsearchable, :type => :model do
|
4
|
+
describe "sql_searchable method doesn't allow unsearchable columns" do
|
5
|
+
it "raises an exception on integer type column" do
|
6
|
+
expect { Unsearchable.sql_searchable(:int) }.to raise_error(Exceptions::UnsearchableType)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "raises an exception on date type column" do
|
10
|
+
expect { Unsearchable.sql_searchable(:dt) }.to raise_error(Exceptions::UnsearchableType)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "raises an exception on time type column" do
|
14
|
+
expect { Unsearchable.sql_searchable(:tm) }.to raise_error(Exceptions::UnsearchableType)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "raises an exception on datetime type column" do
|
18
|
+
expect { Unsearchable.sql_searchable(:dtm) }.to raise_error(Exceptions::UnsearchableType)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "raises an exception on boolean type column" do
|
22
|
+
expect { Unsearchable.sql_searchable(:bool) }.to raise_error(Exceptions::UnsearchableType)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "raises an exception on float type column" do
|
26
|
+
expect { Unsearchable.sql_searchable(:flt) }.to raise_error(Exceptions::UnsearchableType)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "raises an exception on decimal type column" do
|
30
|
+
expect { Unsearchable.sql_searchable(:dec) }.to raise_error(Exceptions::UnsearchableType)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "raises an exception on binary type column" do
|
34
|
+
expect { Unsearchable.sql_searchable(:bn) }.to raise_error(Exceptions::UnsearchableType)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sql_search_n_sort
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John O'Malley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -193,6 +193,7 @@ files:
|
|
193
193
|
- lib/generators/sql_search_n_sort/views/application/_sort_form.html.haml
|
194
194
|
- lib/sql_search_n_sort.rb
|
195
195
|
- lib/sql_search_n_sort/app/helpers/sql_search_n_sort_helper.rb
|
196
|
+
- lib/sql_search_n_sort/exceptions.rb
|
196
197
|
- lib/sql_search_n_sort/railtie.rb
|
197
198
|
- lib/sql_search_n_sort/sql_searchable_sortable.rb
|
198
199
|
- lib/sql_search_n_sort/sql_sort_setup.rb
|
@@ -206,12 +207,14 @@ files:
|
|
206
207
|
- test/dummy/app/controllers/articles_controller.rb
|
207
208
|
- test/dummy/app/controllers/people_controller.rb
|
208
209
|
- test/dummy/app/controllers/products_controller.rb
|
210
|
+
- test/dummy/app/controllers/unsearchables_controller.rb
|
209
211
|
- test/dummy/app/controllers/vehicles_controller.rb
|
210
212
|
- test/dummy/app/helpers/application_helper.rb
|
211
213
|
- test/dummy/app/helpers/articles_helper.rb
|
212
214
|
- test/dummy/app/models/article.rb
|
213
215
|
- test/dummy/app/models/person.rb
|
214
216
|
- test/dummy/app/models/product.rb
|
217
|
+
- test/dummy/app/models/unsearchable.rb
|
215
218
|
- test/dummy/app/models/vehicle.rb
|
216
219
|
- test/dummy/app/views/articles/index.html.haml
|
217
220
|
- test/dummy/app/views/layouts/application.html.erb
|
@@ -219,6 +222,7 @@ files:
|
|
219
222
|
- test/dummy/app/views/people/search_only_index.html.haml
|
220
223
|
- test/dummy/app/views/people/sort_only_index.html.haml
|
221
224
|
- test/dummy/app/views/products/index.html.haml
|
225
|
+
- test/dummy/app/views/unsearchables/index.html.haml
|
222
226
|
- test/dummy/app/views/vehicles/index.html.haml
|
223
227
|
- test/dummy/app/views/vehicles/search_only_index.html.haml
|
224
228
|
- test/dummy/app/views/vehicles/sort_only_index.html.haml
|
@@ -250,6 +254,7 @@ files:
|
|
250
254
|
- test/dummy/db/migrate/20140723223003_create_products.rb
|
251
255
|
- test/dummy/db/migrate/20140725015524_create_articles.rb
|
252
256
|
- test/dummy/db/migrate/20140725161555_add_dob_and_grade_to_people.rb
|
257
|
+
- test/dummy/db/migrate/20141003015903_create_unsearchables.rb
|
253
258
|
- test/dummy/db/schema.rb
|
254
259
|
- test/dummy/db/test.sqlite3
|
255
260
|
- test/dummy/lib/tasks/sample_data.rake
|
@@ -262,6 +267,7 @@ files:
|
|
262
267
|
- test/dummy/spec/factories/factory.rb
|
263
268
|
- test/dummy/spec/models/person_spec.rb
|
264
269
|
- test/dummy/spec/models/product_spec.rb
|
270
|
+
- test/dummy/spec/models/unsearchable_spec.rb
|
265
271
|
- test/dummy/spec/models/vehicle_spec.rb
|
266
272
|
- test/dummy/spec/requests/articles_spec.rb
|
267
273
|
- test/dummy/spec/requests/people_spec.rb
|
@@ -283,9 +289,11 @@ files:
|
|
283
289
|
- test/dummy/tmp/cache/assets/development/sprockets/e8b18160729bab32f8368174bf32a9ce
|
284
290
|
- test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
285
291
|
- test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
|
292
|
+
- test/dummy/tmp/cache/assets/test/sprockets/1a3c6a30280d9edd208e090bd63e93f3
|
286
293
|
- test/dummy/tmp/cache/assets/test/sprockets/1dc2824e4f69b5f787cc0b33a280e1f7
|
287
294
|
- test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
|
288
295
|
- test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
|
296
|
+
- test/dummy/tmp/cache/assets/test/sprockets/648c2e4578a1b3733059887e5541a92a
|
289
297
|
- test/dummy/tmp/cache/assets/test/sprockets/7761773b21e56b187ef1ef0faed07f4c
|
290
298
|
- test/dummy/tmp/cache/assets/test/sprockets/991d9baf4c0665d4114d00882965f72c
|
291
299
|
- test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
|
@@ -329,12 +337,14 @@ test_files:
|
|
329
337
|
- test/dummy/app/controllers/articles_controller.rb
|
330
338
|
- test/dummy/app/controllers/people_controller.rb
|
331
339
|
- test/dummy/app/controllers/products_controller.rb
|
340
|
+
- test/dummy/app/controllers/unsearchables_controller.rb
|
332
341
|
- test/dummy/app/controllers/vehicles_controller.rb
|
333
342
|
- test/dummy/app/helpers/application_helper.rb
|
334
343
|
- test/dummy/app/helpers/articles_helper.rb
|
335
344
|
- test/dummy/app/models/article.rb
|
336
345
|
- test/dummy/app/models/person.rb
|
337
346
|
- test/dummy/app/models/product.rb
|
347
|
+
- test/dummy/app/models/unsearchable.rb
|
338
348
|
- test/dummy/app/models/vehicle.rb
|
339
349
|
- test/dummy/app/views/articles/index.html.haml
|
340
350
|
- test/dummy/app/views/layouts/application.html.erb
|
@@ -342,6 +352,7 @@ test_files:
|
|
342
352
|
- test/dummy/app/views/people/search_only_index.html.haml
|
343
353
|
- test/dummy/app/views/people/sort_only_index.html.haml
|
344
354
|
- test/dummy/app/views/products/index.html.haml
|
355
|
+
- test/dummy/app/views/unsearchables/index.html.haml
|
345
356
|
- test/dummy/app/views/vehicles/index.html.haml
|
346
357
|
- test/dummy/app/views/vehicles/search_only_index.html.haml
|
347
358
|
- test/dummy/app/views/vehicles/sort_only_index.html.haml
|
@@ -373,6 +384,7 @@ test_files:
|
|
373
384
|
- test/dummy/db/migrate/20140723223003_create_products.rb
|
374
385
|
- test/dummy/db/migrate/20140725015524_create_articles.rb
|
375
386
|
- test/dummy/db/migrate/20140725161555_add_dob_and_grade_to_people.rb
|
387
|
+
- test/dummy/db/migrate/20141003015903_create_unsearchables.rb
|
376
388
|
- test/dummy/db/schema.rb
|
377
389
|
- test/dummy/db/test.sqlite3
|
378
390
|
- test/dummy/lib/tasks/sample_data.rake
|
@@ -387,6 +399,7 @@ test_files:
|
|
387
399
|
- test/dummy/spec/factories/factory.rb
|
388
400
|
- test/dummy/spec/models/person_spec.rb
|
389
401
|
- test/dummy/spec/models/product_spec.rb
|
402
|
+
- test/dummy/spec/models/unsearchable_spec.rb
|
390
403
|
- test/dummy/spec/models/vehicle_spec.rb
|
391
404
|
- test/dummy/spec/requests/articles_spec.rb
|
392
405
|
- test/dummy/spec/requests/people_spec.rb
|
@@ -408,9 +421,11 @@ test_files:
|
|
408
421
|
- test/dummy/tmp/cache/assets/development/sprockets/e8b18160729bab32f8368174bf32a9ce
|
409
422
|
- test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
410
423
|
- test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
|
424
|
+
- test/dummy/tmp/cache/assets/test/sprockets/1a3c6a30280d9edd208e090bd63e93f3
|
411
425
|
- test/dummy/tmp/cache/assets/test/sprockets/1dc2824e4f69b5f787cc0b33a280e1f7
|
412
426
|
- test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
|
413
427
|
- test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
|
428
|
+
- test/dummy/tmp/cache/assets/test/sprockets/648c2e4578a1b3733059887e5541a92a
|
414
429
|
- test/dummy/tmp/cache/assets/test/sprockets/7761773b21e56b187ef1ef0faed07f4c
|
415
430
|
- test/dummy/tmp/cache/assets/test/sprockets/991d9baf4c0665d4114d00882965f72c
|
416
431
|
- test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
|