sql_search_n_sort 2.0.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sql_search_n_sort/sql_sort_setup.rb +3 -2
- data/lib/sql_search_n_sort/version.rb +1 -1
- data/test/dummy/app/controllers/admin/members_controller.rb +7 -0
- data/test/dummy/app/models/admin/member.rb +5 -0
- data/test/dummy/app/views/admin/members/index.html.haml +19 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20150306040113_create_members.rb +11 -0
- data/test/dummy/db/schema.rb +9 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +1641 -0
- data/test/dummy/log/test.log +47043 -0
- data/test/dummy/spec/factories/factory.rb +6 -0
- data/test/dummy/spec/models/member_spec.rb +5 -0
- data/test/dummy/spec/requests/members_spec.rb +60 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/1a3c6a30280d9edd208e090bd63e93f3 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/1dc2824e4f69b5f787cc0b33a280e1f7 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2e8fbe25c4d3ab5d0233fc6e0b34f944 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/648c2e4578a1b3733059887e5541a92a +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/991d9baf4c0665d4114d00882965f72c +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/f5e9a47f7b5b0c8b015b00f78ac9c128 +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 +24 -6
|
@@ -9,6 +9,12 @@ FactoryGirl.define do
|
|
|
9
9
|
sequence(:nickname) { |n| "nick_#{n}" }
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
factory :member, class: Admin::Member do
|
|
13
|
+
sequence(:first_name) { |n| "John_#{n}" }
|
|
14
|
+
sequence(:last_name) { |n| "Doe_#{n}" }
|
|
15
|
+
sequence(:email) { |n| "johndoesemail_#{n}@domain.com"}
|
|
16
|
+
end
|
|
17
|
+
|
|
12
18
|
factory :vehicle do
|
|
13
19
|
year 2010
|
|
14
20
|
manufacturer "Chevrolet"
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "Members" do
|
|
4
|
+
before(:all) do
|
|
5
|
+
run_generator
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
after(:all) do
|
|
9
|
+
run_destroy
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe "GET /members" do
|
|
13
|
+
|
|
14
|
+
describe "sort only" do
|
|
15
|
+
before(:each) do
|
|
16
|
+
(1..50).each do
|
|
17
|
+
FactoryGirl.create(:member, first_name: "John_#{Random.rand(1..99)}",
|
|
18
|
+
last_name: "Doe_#{Random.rand(1..99)}", email: "johndoesemail_#{Random.rand(1..99)}@domain.com")
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "sorts by first name when selected", :js => true do
|
|
23
|
+
visit admin_members_path
|
|
24
|
+
first("tbody").all("tr").count.should eq 50
|
|
25
|
+
select("Email", :from => "sort_by") #just to force onchange event for next line
|
|
26
|
+
select("First name", :from => "sort_by")
|
|
27
|
+
sleep 0.5
|
|
28
|
+
first_names = all(:xpath, "//table/tbody/tr/td[1]")
|
|
29
|
+
first_names.map(&:text).should == first_names.map(&:text).sort
|
|
30
|
+
end
|
|
31
|
+
it "sorts by last name when selected", :js => true do
|
|
32
|
+
visit admin_members_path
|
|
33
|
+
first("tbody").all("tr").count.should eq 50
|
|
34
|
+
select("Last name", :from => "sort_by")
|
|
35
|
+
sleep 0.5
|
|
36
|
+
last_names = all(:xpath, "//table/tbody/tr/td[2]")
|
|
37
|
+
last_names.map(&:text).should == last_names.map(&:text).sort
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
describe "perform searches", :js => true do
|
|
43
|
+
before(:each) do
|
|
44
|
+
FactoryGirl.create(:member, first_name: "Fred", last_name: "Bradley")
|
|
45
|
+
FactoryGirl.create(:member, first_name: "Brad", last_name: "Johnson")
|
|
46
|
+
FactoryGirl.create(:member, first_name: "John", last_name: "Williams")
|
|
47
|
+
FactoryGirl.create(:member, first_name: "Will", last_name: "Farley")
|
|
48
|
+
FactoryGirl.create(:member, first_name: "Joseph", email: "jo@brads.net")
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "returns only rows that have first or last name matching case-insensitive 'brad'" do
|
|
52
|
+
visit admin_members_path
|
|
53
|
+
first("tbody").all("tr").count.should eq 5
|
|
54
|
+
fill_in("search_for", :with => "brad")
|
|
55
|
+
click_button("submit-search")
|
|
56
|
+
first("tbody").all("tr").count.should eq 2 #not 3 because Joseph's email isn't searchable
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
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: 2.0
|
|
4
|
+
version: 2.1.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:
|
|
11
|
+
date: 2015-03-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nokogiri
|
|
@@ -154,16 +154,16 @@ dependencies:
|
|
|
154
154
|
name: selenium-webdriver
|
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
|
156
156
|
requirements:
|
|
157
|
-
- - "
|
|
157
|
+
- - "~>"
|
|
158
158
|
- !ruby/object:Gem::Version
|
|
159
|
-
version:
|
|
159
|
+
version: 2.45.0
|
|
160
160
|
type: :development
|
|
161
161
|
prerelease: false
|
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
163
163
|
requirements:
|
|
164
|
-
- - "
|
|
164
|
+
- - "~>"
|
|
165
165
|
- !ruby/object:Gem::Version
|
|
166
|
-
version:
|
|
166
|
+
version: 2.45.0
|
|
167
167
|
- !ruby/object:Gem::Dependency
|
|
168
168
|
name: faker
|
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -203,6 +203,7 @@ files:
|
|
|
203
203
|
- test/dummy/Rakefile
|
|
204
204
|
- test/dummy/app/assets/javascripts/application.js
|
|
205
205
|
- test/dummy/app/assets/stylesheets/application.css
|
|
206
|
+
- test/dummy/app/controllers/admin/members_controller.rb
|
|
206
207
|
- test/dummy/app/controllers/application_controller.rb
|
|
207
208
|
- test/dummy/app/controllers/articles_controller.rb
|
|
208
209
|
- test/dummy/app/controllers/people_controller.rb
|
|
@@ -211,11 +212,13 @@ files:
|
|
|
211
212
|
- test/dummy/app/controllers/vehicles_controller.rb
|
|
212
213
|
- test/dummy/app/helpers/application_helper.rb
|
|
213
214
|
- test/dummy/app/helpers/articles_helper.rb
|
|
215
|
+
- test/dummy/app/models/admin/member.rb
|
|
214
216
|
- test/dummy/app/models/article.rb
|
|
215
217
|
- test/dummy/app/models/person.rb
|
|
216
218
|
- test/dummy/app/models/product.rb
|
|
217
219
|
- test/dummy/app/models/unsearchable.rb
|
|
218
220
|
- test/dummy/app/models/vehicle.rb
|
|
221
|
+
- test/dummy/app/views/admin/members/index.html.haml
|
|
219
222
|
- test/dummy/app/views/articles/index.html.haml
|
|
220
223
|
- test/dummy/app/views/layouts/application.html.erb
|
|
221
224
|
- test/dummy/app/views/people/index.html.haml
|
|
@@ -255,6 +258,7 @@ files:
|
|
|
255
258
|
- test/dummy/db/migrate/20140725015524_create_articles.rb
|
|
256
259
|
- test/dummy/db/migrate/20140725161555_add_dob_and_grade_to_people.rb
|
|
257
260
|
- test/dummy/db/migrate/20141003015903_create_unsearchables.rb
|
|
261
|
+
- test/dummy/db/migrate/20150306040113_create_members.rb
|
|
258
262
|
- test/dummy/db/schema.rb
|
|
259
263
|
- test/dummy/db/test.sqlite3
|
|
260
264
|
- test/dummy/lib/tasks/sample_data.rake
|
|
@@ -265,11 +269,13 @@ files:
|
|
|
265
269
|
- test/dummy/public/500.html
|
|
266
270
|
- test/dummy/public/favicon.ico
|
|
267
271
|
- test/dummy/spec/factories/factory.rb
|
|
272
|
+
- test/dummy/spec/models/member_spec.rb
|
|
268
273
|
- test/dummy/spec/models/person_spec.rb
|
|
269
274
|
- test/dummy/spec/models/product_spec.rb
|
|
270
275
|
- test/dummy/spec/models/unsearchable_spec.rb
|
|
271
276
|
- test/dummy/spec/models/vehicle_spec.rb
|
|
272
277
|
- test/dummy/spec/requests/articles_spec.rb
|
|
278
|
+
- test/dummy/spec/requests/members_spec.rb
|
|
273
279
|
- test/dummy/spec/requests/people_spec.rb
|
|
274
280
|
- test/dummy/spec/requests/products_spec.rb
|
|
275
281
|
- test/dummy/spec/requests/vehicles_spec.rb
|
|
@@ -277,16 +283,19 @@ files:
|
|
|
277
283
|
- test/dummy/test/fixtures/people.yml
|
|
278
284
|
- test/dummy/test/models/person_test.rb
|
|
279
285
|
- test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705
|
|
286
|
+
- test/dummy/tmp/cache/assets/development/sprockets/1a3c6a30280d9edd208e090bd63e93f3
|
|
280
287
|
- test/dummy/tmp/cache/assets/development/sprockets/1dc2824e4f69b5f787cc0b33a280e1f7
|
|
281
288
|
- test/dummy/tmp/cache/assets/development/sprockets/2e8fbe25c4d3ab5d0233fc6e0b34f944
|
|
282
289
|
- test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af
|
|
283
290
|
- test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953
|
|
291
|
+
- test/dummy/tmp/cache/assets/development/sprockets/648c2e4578a1b3733059887e5541a92a
|
|
284
292
|
- test/dummy/tmp/cache/assets/development/sprockets/7761773b21e56b187ef1ef0faed07f4c
|
|
285
293
|
- test/dummy/tmp/cache/assets/development/sprockets/991d9baf4c0665d4114d00882965f72c
|
|
286
294
|
- test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994
|
|
287
295
|
- test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6
|
|
288
296
|
- test/dummy/tmp/cache/assets/development/sprockets/e6f3190c03c1c2b869d131e25d38eb7b
|
|
289
297
|
- test/dummy/tmp/cache/assets/development/sprockets/e8b18160729bab32f8368174bf32a9ce
|
|
298
|
+
- test/dummy/tmp/cache/assets/development/sprockets/f5e9a47f7b5b0c8b015b00f78ac9c128
|
|
290
299
|
- test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
|
291
300
|
- test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
|
|
292
301
|
- test/dummy/tmp/cache/assets/test/sprockets/1a3c6a30280d9edd208e090bd63e93f3
|
|
@@ -333,6 +342,7 @@ summary: Easily add search and sort functionality to list pages (e.g. index)
|
|
|
333
342
|
test_files:
|
|
334
343
|
- test/dummy/app/assets/javascripts/application.js
|
|
335
344
|
- test/dummy/app/assets/stylesheets/application.css
|
|
345
|
+
- test/dummy/app/controllers/admin/members_controller.rb
|
|
336
346
|
- test/dummy/app/controllers/application_controller.rb
|
|
337
347
|
- test/dummy/app/controllers/articles_controller.rb
|
|
338
348
|
- test/dummy/app/controllers/people_controller.rb
|
|
@@ -341,11 +351,13 @@ test_files:
|
|
|
341
351
|
- test/dummy/app/controllers/vehicles_controller.rb
|
|
342
352
|
- test/dummy/app/helpers/application_helper.rb
|
|
343
353
|
- test/dummy/app/helpers/articles_helper.rb
|
|
354
|
+
- test/dummy/app/models/admin/member.rb
|
|
344
355
|
- test/dummy/app/models/article.rb
|
|
345
356
|
- test/dummy/app/models/person.rb
|
|
346
357
|
- test/dummy/app/models/product.rb
|
|
347
358
|
- test/dummy/app/models/unsearchable.rb
|
|
348
359
|
- test/dummy/app/models/vehicle.rb
|
|
360
|
+
- test/dummy/app/views/admin/members/index.html.haml
|
|
349
361
|
- test/dummy/app/views/articles/index.html.haml
|
|
350
362
|
- test/dummy/app/views/layouts/application.html.erb
|
|
351
363
|
- test/dummy/app/views/people/index.html.haml
|
|
@@ -385,6 +397,7 @@ test_files:
|
|
|
385
397
|
- test/dummy/db/migrate/20140725015524_create_articles.rb
|
|
386
398
|
- test/dummy/db/migrate/20140725161555_add_dob_and_grade_to_people.rb
|
|
387
399
|
- test/dummy/db/migrate/20141003015903_create_unsearchables.rb
|
|
400
|
+
- test/dummy/db/migrate/20150306040113_create_members.rb
|
|
388
401
|
- test/dummy/db/schema.rb
|
|
389
402
|
- test/dummy/db/test.sqlite3
|
|
390
403
|
- test/dummy/lib/tasks/sample_data.rake
|
|
@@ -397,11 +410,13 @@ test_files:
|
|
|
397
410
|
- test/dummy/Rakefile
|
|
398
411
|
- test/dummy/README.rdoc
|
|
399
412
|
- test/dummy/spec/factories/factory.rb
|
|
413
|
+
- test/dummy/spec/models/member_spec.rb
|
|
400
414
|
- test/dummy/spec/models/person_spec.rb
|
|
401
415
|
- test/dummy/spec/models/product_spec.rb
|
|
402
416
|
- test/dummy/spec/models/unsearchable_spec.rb
|
|
403
417
|
- test/dummy/spec/models/vehicle_spec.rb
|
|
404
418
|
- test/dummy/spec/requests/articles_spec.rb
|
|
419
|
+
- test/dummy/spec/requests/members_spec.rb
|
|
405
420
|
- test/dummy/spec/requests/people_spec.rb
|
|
406
421
|
- test/dummy/spec/requests/products_spec.rb
|
|
407
422
|
- test/dummy/spec/requests/vehicles_spec.rb
|
|
@@ -409,16 +424,19 @@ test_files:
|
|
|
409
424
|
- test/dummy/test/fixtures/people.yml
|
|
410
425
|
- test/dummy/test/models/person_test.rb
|
|
411
426
|
- test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705
|
|
427
|
+
- test/dummy/tmp/cache/assets/development/sprockets/1a3c6a30280d9edd208e090bd63e93f3
|
|
412
428
|
- test/dummy/tmp/cache/assets/development/sprockets/1dc2824e4f69b5f787cc0b33a280e1f7
|
|
413
429
|
- test/dummy/tmp/cache/assets/development/sprockets/2e8fbe25c4d3ab5d0233fc6e0b34f944
|
|
414
430
|
- test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af
|
|
415
431
|
- test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953
|
|
432
|
+
- test/dummy/tmp/cache/assets/development/sprockets/648c2e4578a1b3733059887e5541a92a
|
|
416
433
|
- test/dummy/tmp/cache/assets/development/sprockets/7761773b21e56b187ef1ef0faed07f4c
|
|
417
434
|
- test/dummy/tmp/cache/assets/development/sprockets/991d9baf4c0665d4114d00882965f72c
|
|
418
435
|
- test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994
|
|
419
436
|
- test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6
|
|
420
437
|
- test/dummy/tmp/cache/assets/development/sprockets/e6f3190c03c1c2b869d131e25d38eb7b
|
|
421
438
|
- test/dummy/tmp/cache/assets/development/sprockets/e8b18160729bab32f8368174bf32a9ce
|
|
439
|
+
- test/dummy/tmp/cache/assets/development/sprockets/f5e9a47f7b5b0c8b015b00f78ac9c128
|
|
422
440
|
- test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
|
423
441
|
- test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
|
|
424
442
|
- test/dummy/tmp/cache/assets/test/sprockets/1a3c6a30280d9edd208e090bd63e93f3
|