rails-jquery-autocomplete 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +28 -46
- data/lib/assets/javascripts/autocomplete-rails-uncompressed.js +14 -2
- data/lib/assets/javascripts/autocomplete-rails.js +1 -1
- data/lib/rails-jquery-autocomplete/version.rb +1 -1
- data/test/form_helper_test.rb +25 -0
- data/test/generators/autocomplete/install_generator_test.rb +25 -0
- data/test/generators/autocomplete/uncompressed_generator_test.rb +25 -0
- data/test/lib/rails-jquery-autocomplete/autocomplete_test.rb +82 -0
- data/test/lib/rails-jquery-autocomplete/orm/active_record_test.rb +190 -0
- data/test/lib/rails-jquery-autocomplete/orm/mongo_mapper_test.rb +60 -0
- data/test/lib/rails-jquery-autocomplete/orm/mongoid_test.rb +60 -0
- data/test/lib/rails-jquery-autocomplete/simple_form_plugin_test.rb +33 -0
- data/test/lib/rails-jquery-autocomplete_test.rb +38 -0
- data/test/test_helper.rb +36 -0
- data/test/view_test_helper.rb +108 -0
- metadata +46 -39
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YTQyYjQyYjk2MTg1ZWYwOTZiMGMwYzNmMDE0ZWM5ZjJhMTI3NmFiZQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bf8cc770234ad7b4dc2e5f40ce94eeef32f8d863
|
4
|
+
data.tar.gz: db3cdccdece71ac86dbe930c2ddfdf1978520651
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
YjEwNjI0ZWU4YWFmZGExNmNiYjJiMjlhMmY3ZWU5YzM0Y2RhZjMxMGM0MTYy
|
11
|
-
Y2Y2MjBkMWI0YzY3MzBhNGFiZDRjYTlhMWEyZmVkMzI0OGEwNDU=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZmM5YWNmNWUwMDQyZDZkNGQzY2RjYTU2OGY1OWZmYWRlMTI1ZWYzZmE4NDhl
|
14
|
-
ZWViNzY5ZmRmMTQyYWY3Y2ZjODFiNGNjYWMwZmRlYTUxNzJkMTA2OGVmZmRl
|
15
|
-
NjllYWIwYTgxOWQ5NTQ3NTBiM2Q0ZDM2MTBhMmM1ZjNiNzAyMGI=
|
6
|
+
metadata.gz: 5d9890a5fa77fa0067d4d8ccb8669ea04622c11a645da8e7e01861a18bd5ad45a86b155756fa1a6db8762304e2c95ab0873a8930c0f4d28bcb9f28393b45439d
|
7
|
+
data.tar.gz: 3a6deefdc47513cdcd6830a4349f64972791de3d6f6536dee5d53c2f68d43c2fe0d37691161d9f3dcb2499467cca82630b2b0d0e2d6bcfbe426364b6a4fa85ac
|
data/README.md
CHANGED
@@ -1,52 +1,17 @@
|
|
1
1
|
## Status
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
are going to be a lot of changes going on here and while we will do our best; there will probably
|
10
|
-
be some breakage on master in the short term. Use at your discretion!
|
11
|
-
3. Some pull requests have been submitted to address the same functionality; in those cases we will try
|
12
|
-
to pick the best/optimal solution, accept that and close out the other tickets.
|
13
|
-
4. Backwards compatibility is considered a high priority, so if a pull request is a great idea,
|
14
|
-
but it breaks backwards compatibility, it will be closed and noted that it causes breakage
|
15
|
-
to backwards compatibility. If anyone passionately wants the feature they are welcome to update
|
16
|
-
in a way that maintiains backwards compatibility and issue new pull reqs.
|
17
|
-
5. Performance is critical. If a feature is a nice to have, but has been implemented in such a way that it causes
|
18
|
-
performance degradation to existing searches; it will be rejected.
|
19
|
-
6. Thanks to everyone who is submitting pull requests, issues, comments, etc... I appreciate the help
|
20
|
-
from each one of you. Sometimes it has to get worse before it gets better. But I promise,
|
21
|
-
it will get better!
|
22
|
-
|
23
|
-
-------
|
24
|
-
|
25
|
-
Thanks to David @ crowdint for creating this gem and all of his hard
|
26
|
-
work on it in the past.
|
27
|
-
|
28
|
-
Just posting this update to let everyone know this project is still
|
29
|
-
alive and has a new maintainer. Over the next couple of weeks we will
|
30
|
-
be reviewing existing pull requests and you will see updates shortly.
|
31
|
-
|
32
|
-
Thanks for your patience.
|
33
|
-
|
34
|
-
joiey-seeley@uiowa.edu
|
35
|
-
|
36
|
-
-------
|
37
|
-
|
38
|
-
Unfortunately, I don't have much time to work on this gem, I'm looking for
|
39
|
-
someone to help with its maintenance. Send me an email if you are interested in
|
40
|
-
getting push privileges to this repo.
|
41
|
-
|
42
|
-
david@crowdint.com
|
43
|
-
|
3
|
+
1. This is the officially maintained fork of
|
4
|
+
[rails3-jquery-autocomplete](http://github.com/crowdint/rails3-jquery-autocomplete)
|
5
|
+
2. All new features and support of Rails 4 and above will occur here
|
6
|
+
going forward. If you are still using Rails 3 please continue to use
|
7
|
+
the previous fork. No new features will be added there, but bug fixes &
|
8
|
+
security patches will continue until Rails 3 is EOL.
|
44
9
|
|
45
10
|
# rails-jquery-autocomplete
|
46
11
|
|
47
|
-
[![Build Status](https://secure.travis-ci.org/
|
12
|
+
[![Build Status](https://secure.travis-ci.org/bigtunacan/rails-jquery-autocomplete.png)](http://travis-ci.org/bigtunacan/rails-jquery-autocomplete) [![Gem Version](https://badge.fury.io/rb/rails-jquery-autocomplete.png)](http://badge.fury.io/rb/rails-jquery-autocomplete)
|
48
13
|
|
49
|
-
An easy way to use jQuery's autocomplete with Rails
|
14
|
+
An easy way to use jQuery's autocomplete with Rails.
|
50
15
|
|
51
16
|
Supports both ActiveRecord, [mongoid](http://github.com/mongoid/mongoid), and [MongoMapper](https://github.com/jnunemaker/mongomapper).
|
52
17
|
|
@@ -86,7 +51,7 @@ Install it
|
|
86
51
|
|
87
52
|
bundle install
|
88
53
|
|
89
|
-
### Rails
|
54
|
+
### Rails 4.x.x
|
90
55
|
|
91
56
|
Run the generator
|
92
57
|
|
@@ -111,7 +76,7 @@ uncompressed version by running:
|
|
111
76
|
|
112
77
|
rails generate autocomplete:uncompressed
|
113
78
|
|
114
|
-
### Rails
|
79
|
+
### Rails 4 and higher
|
115
80
|
|
116
81
|
Just add it to your app/assets/javascripts/application.js file
|
117
82
|
|
@@ -273,7 +238,23 @@ To have the first item be automatically focused on when the autocomplete menu is
|
|
273
238
|
'data-auto-focus' => true
|
274
239
|
end
|
275
240
|
|
276
|
-
Now your autocomplete code is unobtrusive, Rails
|
241
|
+
Now your autocomplete code is unobtrusive, Rails style.
|
242
|
+
|
243
|
+
#### Client-side config
|
244
|
+
|
245
|
+
To configure the behaviour if no matches are found, you can set the following options:
|
246
|
+
|
247
|
+
jQuery.railsAutocomplete.options.showNoMatches //default true
|
248
|
+
jQuery.railsAutocomplete.options.noMatchesLabel //default 'no existing match'
|
249
|
+
|
250
|
+
These will change the behaviour globally. To set them on a single input field use:
|
251
|
+
|
252
|
+
f.autocomplete_field :brand_names, autocomplete_brand_name_products_path,
|
253
|
+
'data-showNoMatches' => false
|
254
|
+
#or
|
255
|
+
f.autocomplete_field :brand_names, autocomplete_brand_name_products_path,
|
256
|
+
'data-noMatchesLabel' => 'no brands found'
|
257
|
+
|
277
258
|
|
278
259
|
### Getting the object id
|
279
260
|
|
@@ -474,3 +455,4 @@ Everyone on [this list](https://github.com/crowdint/rails3-jquery-autocomplete/c
|
|
474
455
|
We specialize in building and growing online retail stores. We don’t work with everyone – just companies we believe in. Call us today to see if there’s a fit.
|
475
456
|
Find more info [here](http://www.crowdint.com)!
|
476
457
|
|
458
|
+
|
@@ -35,6 +35,10 @@
|
|
35
35
|
var _e = e;
|
36
36
|
this.init(_e);
|
37
37
|
};
|
38
|
+
jQuery.railsAutocomplete.options = {
|
39
|
+
showNoMatches: true,
|
40
|
+
noMatchesLabel: 'no existing match'
|
41
|
+
}
|
38
42
|
|
39
43
|
jQuery.railsAutocomplete.fn = jQuery.railsAutocomplete.prototype = {
|
40
44
|
railsAutocomplete: '0.0.1'
|
@@ -67,9 +71,17 @@
|
|
67
71
|
});
|
68
72
|
}
|
69
73
|
jQuery.getJSON( jQuery(e).attr('data-autocomplete'), params, function() {
|
70
|
-
|
74
|
+
var options = {};
|
75
|
+
jQuery.extend(options, jQuery.railsAutocomplete.options);
|
76
|
+
jQuery.each(options, function(key, value) {
|
77
|
+
if(options.hasOwnProperty(key)) {
|
78
|
+
var attrVal = jQuery(e).attr('data-' + key);
|
79
|
+
options[key] = attrVal ? attrVal : value;
|
80
|
+
}
|
81
|
+
});
|
82
|
+
if(arguments[0].length == 0 && options.showNoMatches) {
|
71
83
|
arguments[0] = [];
|
72
|
-
arguments[0][0] = { id: "", label:
|
84
|
+
arguments[0][0] = { id: "", label: options.noMatchesLabel };
|
73
85
|
}
|
74
86
|
jQuery(arguments[0]).each(function(i, el) {
|
75
87
|
var obj = {};
|
@@ -1 +1 @@
|
|
1
|
-
!function(t){t.fn.railsAutocomplete=function(){var e=function(){this.railsAutoCompleter||(this.railsAutoCompleter=new t.railsAutocomplete(this))};return void 0!==t.fn.on?t(document).on("focus",this.selector,e):this.live("focus",e)},t.railsAutocomplete=function(t){var e=t;this.init(e)},t.railsAutocomplete.fn=t.railsAutocomplete.prototype={railsAutocomplete:"0.0.1"},t.railsAutocomplete.fn.extend=t.railsAutocomplete.extend=t.extend,t.railsAutocomplete.fn.extend({init:function(e){function a(t){return t.split(e.delimiter)}function i(t){return a(t).pop().replace(/^\s+/,"")}e.delimiter=t(e).attr("data-delimiter")||null,e.min_length=t(e).attr("min-length")||2,e.append_to=t(e).attr("data-append-to")||null,e.autoFocus=t(e).attr("data-auto-focus")||!1,t(e).autocomplete({appendTo:e.append_to,autoFocus:e.autoFocus,delay:t(e).attr("delay")||0,source:function(a,n){var
|
1
|
+
!function(t){t.fn.railsAutocomplete=function(){var e=function(){this.railsAutoCompleter||(this.railsAutoCompleter=new t.railsAutocomplete(this))};return void 0!==t.fn.on?t(document).on("focus",this.selector,e):this.live("focus",e)},t.railsAutocomplete=function(t){var e=t;this.init(e)},t.railsAutocomplete.options={showNoMatches:!0,noMatchesLabel:"no existing match"},t.railsAutocomplete.fn=t.railsAutocomplete.prototype={railsAutocomplete:"0.0.1"},t.railsAutocomplete.fn.extend=t.railsAutocomplete.extend=t.extend,t.railsAutocomplete.fn.extend({init:function(e){function a(t){return t.split(e.delimiter)}function i(t){return a(t).pop().replace(/^\s+/,"")}e.delimiter=t(e).attr("data-delimiter")||null,e.min_length=t(e).attr("min-length")||2,e.append_to=t(e).attr("data-append-to")||null,e.autoFocus=t(e).attr("data-auto-focus")||!1,t(e).autocomplete({appendTo:e.append_to,autoFocus:e.autoFocus,delay:t(e).attr("delay")||0,source:function(a,n){var o=this.element[0],r={term:i(a.term)};t(e).attr("data-autocomplete-fields")&&t.each(t.parseJSON(t(e).attr("data-autocomplete-fields")),function(e,a){r[e]=t(a).val()}),t.getJSON(t(e).attr("data-autocomplete"),r,function(){var a={};t.extend(a,t.railsAutocomplete.options),t.each(a,function(i,n){if(a.hasOwnProperty(i)){var o=t(e).attr("data-"+i);a[i]=o?o:n}}),0==arguments[0].length&&a.showNoMatches&&(arguments[0]=[],arguments[0][0]={id:"",label:a.noMatchesLabel}),t(arguments[0]).each(function(a,i){var n={};n[i.id]=i,t(e).data(n)}),n.apply(null,arguments),t(o).trigger("railsAutocomplete.source",arguments)})},change:function(e,a){if(t(this).is("[data-id-element]")&&""!==t(t(this).attr("data-id-element")).val()&&(t(t(this).attr("data-id-element")).val(a.item?a.item.id:""),t(this).attr("data-update-elements"))){var i=t.parseJSON(t(this).attr("data-update-elements")),n=a.item?t(this).data(a.item.id.toString()):{};if(i&&""===t(i.id).val())return;for(var o in i){var r=t(i[o]);r.is(":checkbox")?null!=n[o]&&r.prop("checked",n[o]):r.val(a.item?n[o]:"")}}},search:function(){var t=i(this.value);return t.length<e.min_length?!1:void 0},focus:function(){return!1},select:function(i,n){if(-1!=n.item.value.toLowerCase().indexOf("no match")||-1!=n.item.value.toLowerCase().indexOf("too many results"))return t(this).trigger("railsAutocomplete.noMatch",n),!1;var o=a(this.value);if(o.pop(),o.push(n.item.value),null!=e.delimiter)o.push(""),this.value=o.join(e.delimiter);else if(this.value=o.join(""),t(this).attr("data-id-element")&&t(t(this).attr("data-id-element")).val(n.item.id),t(this).attr("data-update-elements")){var r=n.item,l=-1!=n.item.value.indexOf("Create New")?!0:!1,u=t.parseJSON(t(this).attr("data-update-elements"));for(var s in u)"checkbox"===t(u[s]).attr("type")?r[s]===!0||1===r[s]?t(u[s]).attr("checked","checked"):t(u[s]).removeAttr("checked"):t(u[s]).val(l&&r[s]&&-1==r[s].indexOf("Create New")||!l?r[s]:"")}var c=this.value;return t(this).bind("keyup.clearId",function(){t.trim(t(this).val())!=t.trim(c)&&(t(t(this).attr("data-id-element")).val(""),t(this).unbind("keyup.clearId"))}),t(e).trigger("railsAutocomplete.select",n),!1}})}}),t(document).ready(function(){t("input[data-autocomplete]").railsAutocomplete()})}(jQuery);
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class Post
|
4
|
+
attr_accessor :author
|
5
|
+
end
|
6
|
+
|
7
|
+
class FormHelperTest < ActionView::TestCase
|
8
|
+
def test_text_field_tag
|
9
|
+
assert_match(/autocomplete=\"some\/path\"/, text_field_tag('field_name', '', :autocomplete => 'some/path'))
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_text_field
|
13
|
+
post = Post.new
|
14
|
+
assert_match(/autocomplete=\"some\/path\"/, text_field(:post, :author, :autocomplete => 'some/path'))
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_autocomplete_field_tag
|
18
|
+
assert_match(/data-autocomplete=\"some\/path\"/, autocomplete_field_tag('field_name', '', 'some/path'))
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_autocomplete_field
|
22
|
+
post= Post.new
|
23
|
+
assert_match(/data-autocomplete=\"some\/path\"/, autocomplete_field(:post, :author, 'some/path'))
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'generators/autocomplete/install_generator'
|
3
|
+
|
4
|
+
module Autocomplete
|
5
|
+
class InstallGeneratorTest < Test::Unit::TestCase
|
6
|
+
def setup
|
7
|
+
@destination = File.join('tmp', 'test_app')
|
8
|
+
@source = InstallGenerator.source_root
|
9
|
+
@filename = File.join(@destination, 'public', 'javascripts', 'autocomplete-rails.js')
|
10
|
+
|
11
|
+
File.unlink(@filename) if File.exists?(@filename)
|
12
|
+
|
13
|
+
InstallGenerator.start([], :destination_root => @destination)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_install
|
17
|
+
assert File.exists?(@filename)
|
18
|
+
|
19
|
+
assert_equal(
|
20
|
+
File.read(File.join(@source, 'autocomplete-rails.js')),
|
21
|
+
File.read(@filename)
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'generators/autocomplete/uncompressed_generator'
|
3
|
+
|
4
|
+
module Autocomplete
|
5
|
+
class UncompressedGeneratorTest < Test::Unit::TestCase
|
6
|
+
def setup
|
7
|
+
@destination = File.join('tmp', 'test_app')
|
8
|
+
@source = UncompressedGenerator.source_root
|
9
|
+
@filename = File.join(@destination, 'public', 'javascripts', 'autocomplete-rails.js')
|
10
|
+
|
11
|
+
File.unlink(@filename) if File.exists?(@filename)
|
12
|
+
|
13
|
+
UncompressedGenerator.start([], :destination_root => @destination)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_install
|
17
|
+
assert File.exists?(@filename)
|
18
|
+
|
19
|
+
assert_equal(
|
20
|
+
File.read(File.join(@source, 'autocomplete-rails-uncompressed.js')),
|
21
|
+
File.read(@filename)
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module RailsJQueryAutocomplete
|
4
|
+
class AutocompleteTest < Test::Unit::TestCase
|
5
|
+
include RailsJQueryAutocomplete::Autocomplete
|
6
|
+
|
7
|
+
context 'ClassMethods' do
|
8
|
+
context '#autocomplete' do
|
9
|
+
context '#get_prefix' do
|
10
|
+
context 'Mongoid and MongoMapper is not defined' do
|
11
|
+
setup do
|
12
|
+
ActorsController = Class.new(ActionController::Base)
|
13
|
+
ActorsController.autocomplete(:movie, :name)
|
14
|
+
@controller = ActorsController.new
|
15
|
+
|
16
|
+
@model = Class.new(ActiveRecord::Base)
|
17
|
+
|
18
|
+
Object.send(:remove_const, :Mongoid)
|
19
|
+
Object.send(:remove_const, :MongoMapper)
|
20
|
+
end
|
21
|
+
|
22
|
+
should 'not raise exception' do
|
23
|
+
@controller.get_prefix(@model)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context '#get_autocomplete_limit' do
|
31
|
+
context 'the limit option was specified' do
|
32
|
+
should "return the limit option" do
|
33
|
+
assert_equal 99, get_autocomplete_limit({:limit => 99})
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'the limit option is not specified' do
|
38
|
+
should 'return 10' do
|
39
|
+
assert_equal 10, get_autocomplete_limit({})
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context '#get_object' do
|
45
|
+
should 'return the specified sym as a class name' do
|
46
|
+
symbol = Object.new
|
47
|
+
class_object = Class.new
|
48
|
+
mock(symbol).to_s.mock!.camelize.mock!.constantize { class_object }
|
49
|
+
assert_equal class_object, get_object(symbol)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context '#json_for_autocomplete' do
|
54
|
+
should 'parse items to JSON' do
|
55
|
+
item = mock(Object)
|
56
|
+
mock(item).send(:name).times(2) { 'Object Name' }
|
57
|
+
mock(item).id { 1 }
|
58
|
+
items = [item]
|
59
|
+
response = self.json_for_autocomplete(items, :name).first
|
60
|
+
assert_equal response["id"], "1"
|
61
|
+
assert_equal response["value"], "Object Name"
|
62
|
+
assert_equal response["label"], "Object Name"
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'with extra data' do
|
66
|
+
should 'add that extra data to result' do
|
67
|
+
item = mock(Object)
|
68
|
+
mock(item).send(:name).times(2) { 'Object Name' }
|
69
|
+
mock(item).id { 1 }
|
70
|
+
mock(item).send("extra") { 'Object Extra ' }
|
71
|
+
|
72
|
+
items = [item]
|
73
|
+
response = self.json_for_autocomplete(items, :name, ["extra"]).first
|
74
|
+
|
75
|
+
assert_equal "1" , response["id"]
|
76
|
+
assert_equal "Object Name" , response["value"]
|
77
|
+
assert_equal "Object Name" , response["label"]
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,190 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module RailsJQueryAutocomplete
|
4
|
+
module Orm
|
5
|
+
class ActiveRecordTest < Test::Unit::TestCase
|
6
|
+
include RailsJQueryAutocomplete::Orm::ActiveRecord
|
7
|
+
|
8
|
+
context "#get_autocomplete_order" do
|
9
|
+
context 'order is specified' do
|
10
|
+
should 'returns that order option' do
|
11
|
+
assert_equal "field ASC", active_record_get_autocomplete_order(:field, {:order => 'field ASC'})
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'no order is specified' do
|
16
|
+
should 'return the order clause by the LOWER(table_name.field) ASC' do
|
17
|
+
assert_equal "LOWER(field) ASC", active_record_get_autocomplete_order(:field, {})
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'a different model is specified' do
|
21
|
+
should 'return the order clause by the LOWER(table_name.field) ASC' do
|
22
|
+
model = Object.new
|
23
|
+
mock(model).table_name { 'table_name' }
|
24
|
+
assert_equal "LOWER(table_name.field) ASC", active_record_get_autocomplete_order(:field, {}, model)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context '#active_record_get_autocomplete_items' do
|
31
|
+
should 'retrieve the items from ActiveRecord' do
|
32
|
+
class Dog ; end
|
33
|
+
|
34
|
+
model = Dog
|
35
|
+
scoped = []
|
36
|
+
whered = []
|
37
|
+
term = 'query'
|
38
|
+
method = :field
|
39
|
+
|
40
|
+
options = {
|
41
|
+
:model => model,
|
42
|
+
:term => term,
|
43
|
+
:method => method,
|
44
|
+
:options => {}
|
45
|
+
}
|
46
|
+
|
47
|
+
mock(self).get_autocomplete_limit(anything) { 10 }
|
48
|
+
mock(self).active_record_get_autocomplete_order(anything, anything, anything) { "order ASC" }
|
49
|
+
mock(self).get_autocomplete_select_clause(model, method, {}) { ["field"] }
|
50
|
+
mock(self).get_autocomplete_where_clause(model, term, method, {}) { ["WHERE something"] }
|
51
|
+
mock(model).table_name.times(any_times) { 'model_table_name' }
|
52
|
+
|
53
|
+
mock(model).scoped { model }
|
54
|
+
mock(model).select(["field"]) { model }
|
55
|
+
mock(model).where(["WHERE something"]).mock!.limit(10).mock!.
|
56
|
+
order("order ASC") { 1 }
|
57
|
+
|
58
|
+
assert_equal 1, active_record_get_autocomplete_items(options)
|
59
|
+
end
|
60
|
+
|
61
|
+
should 'use hstore method if present' do
|
62
|
+
class Dog ; end
|
63
|
+
|
64
|
+
model = Dog
|
65
|
+
scoped = []
|
66
|
+
whered = []
|
67
|
+
term = 'query'
|
68
|
+
method = :field
|
69
|
+
hsmethod = :hsfield
|
70
|
+
|
71
|
+
options = {
|
72
|
+
:model => model,
|
73
|
+
:term => term,
|
74
|
+
:method => method,
|
75
|
+
:options => {hstore: {method: hsmethod}}
|
76
|
+
}
|
77
|
+
|
78
|
+
mock(self).get_autocomplete_limit(anything) { 10 }
|
79
|
+
mock(self).active_record_get_autocomplete_order(anything, anything, anything) { "order ASC" }
|
80
|
+
mock(self).get_autocomplete_select_clause(model, hsmethod, options[:options]) { ["hsfield"] }
|
81
|
+
mock(self).get_autocomplete_where_clause(model, term, hsmethod, options[:options]) { ["WHERE something"] }
|
82
|
+
mock(model).table_name.times(any_times) { 'model_table_name' }
|
83
|
+
|
84
|
+
mock(model).scoped { model }
|
85
|
+
mock(model).select(["hsfield"]) { model }
|
86
|
+
mock(model).where(["WHERE something"]).mock!.limit(10).mock!.
|
87
|
+
order("order ASC") { 1 }
|
88
|
+
|
89
|
+
assert_equal 1, active_record_get_autocomplete_items(options)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
context '#get_autocomplete_select_clause' do
|
94
|
+
setup do
|
95
|
+
@model = Object.new
|
96
|
+
mock(@model).table_name { 'table_name' }
|
97
|
+
mock(@model).primary_key { 'id' }
|
98
|
+
end
|
99
|
+
|
100
|
+
should 'create a select clause' do
|
101
|
+
assert_equal ["table_name.id", "table_name.method"],
|
102
|
+
get_autocomplete_select_clause(@model, :method, {})
|
103
|
+
end
|
104
|
+
|
105
|
+
should 'create a select clause with hstore method' do
|
106
|
+
assert_equal ["table_name.id", "table_name.hsmethod"],
|
107
|
+
get_autocomplete_select_clause(@model, :hsmethod, {hstore: {method: :hsmethod}})
|
108
|
+
end
|
109
|
+
|
110
|
+
context 'with extra options' do
|
111
|
+
should 'return those extra fields on the clause' do
|
112
|
+
options = {:extra_data => ['table_name.created_at']}
|
113
|
+
|
114
|
+
assert_equal ["table_name.id", "table_name.method", "table_name.created_at"],
|
115
|
+
get_autocomplete_select_clause(@model, :method, options)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
context '#get_autocomplete_where_clause' do
|
121
|
+
setup do
|
122
|
+
@model = Object.new
|
123
|
+
mock(@model).table_name { 'table_name' }
|
124
|
+
|
125
|
+
@term = 'query'
|
126
|
+
@options = {}
|
127
|
+
@method = :method
|
128
|
+
end
|
129
|
+
|
130
|
+
context 'Not Postgres' do
|
131
|
+
should 'return options for where' do
|
132
|
+
mock(self).postgres?(@model) { false }
|
133
|
+
assert_equal ["LOWER(table_name.method) LIKE ?", "query%"], get_autocomplete_where_clause(@model, @term, @method, @options)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
context 'Postgres' do
|
138
|
+
should 'return options for where with ILIKE' do
|
139
|
+
mock(self).postgres?(@model) { true }
|
140
|
+
assert_equal ["LOWER(table_name.method) ILIKE ?", "query%"], get_autocomplete_where_clause(@model, @term, @method, @options)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
context 'HStore' do
|
145
|
+
should 'return options for where from hstore options' do
|
146
|
+
mock(self).postgres?(@model) { true }
|
147
|
+
@options[:hstore] = {method: :hsmethod, key: :hskey}
|
148
|
+
@method = :hsmethod
|
149
|
+
assert_equal ["LOWER(table_name.hsmethod -> 'hskey') LIKE ?", "query%"], get_autocomplete_where_clause(@model, @term, @method, @options)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
context 'full search' do
|
154
|
+
should 'return options for where with the term sourrounded by %%' do
|
155
|
+
mock(self).postgres?(@model) { false }
|
156
|
+
@options[:full] = true
|
157
|
+
assert_equal ["LOWER(table_name.method) LIKE ?", "%query%"], get_autocomplete_where_clause(@model, @term, @method, @options)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
context '#postgres?' do
|
163
|
+
setup do
|
164
|
+
@model = stub
|
165
|
+
end
|
166
|
+
|
167
|
+
context 'the connection class is not postgres' do
|
168
|
+
setup do
|
169
|
+
mock(@model).connection { stub }
|
170
|
+
end
|
171
|
+
|
172
|
+
should 'return nil if the connection class matches PostgreSQLAdapter' do
|
173
|
+
assert_nil self.postgres?(@model)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
context 'the connection class matches PostgreSQLAdapter' do
|
178
|
+
setup do
|
179
|
+
class PostgreSQLAdapter; end
|
180
|
+
mock(@model).connection { PostgreSQLAdapter.new }
|
181
|
+
end
|
182
|
+
|
183
|
+
should 'return true' do
|
184
|
+
assert self.postgres?(@model)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module RailsJQueryAutocomplete
|
4
|
+
module Orm
|
5
|
+
class MongoMapperTest < Test::Unit::TestCase
|
6
|
+
include RailsJQueryAutocomplete::Orm::MongoMapper
|
7
|
+
|
8
|
+
context "#mongo_mapper_get_autocomplete_order" do
|
9
|
+
context "order is specified" do
|
10
|
+
should 'returns the parametrized order for Mongoid' do
|
11
|
+
assert_equal [[:field, :asc], [:state, :desc]],
|
12
|
+
mongo_mapper_get_autocomplete_order(:method, :order => 'field ASC, state DESC')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'order is not specified' do
|
17
|
+
should 'return the method ordered ASC by default' do
|
18
|
+
assert_equal [[:method, :asc]],
|
19
|
+
mongo_mapper_get_autocomplete_order(:method, {})
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "#mongo_mapper_get_autocomplete_items" do
|
25
|
+
setup do
|
26
|
+
@model = mock(Object)
|
27
|
+
|
28
|
+
@parameters = {
|
29
|
+
:model => @model,
|
30
|
+
:method => :field,
|
31
|
+
:term => 'query',
|
32
|
+
:options => {:full => false}
|
33
|
+
}
|
34
|
+
mock(self).get_autocomplete_limit(anything) { 10 }
|
35
|
+
mock(self).mongo_mapper_get_autocomplete_order(anything, anything) { [[:order, :asc]] }
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'not a full search' do
|
39
|
+
should 'do stuff' do
|
40
|
+
mock(@model).where({:field=>/^query.*/i}).mock!.limit(10).
|
41
|
+
mock!.sort([[:order, :asc]])
|
42
|
+
|
43
|
+
mongo_mapper_get_autocomplete_items(@parameters)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'full search' do
|
48
|
+
should 'return a full search query' do
|
49
|
+
@parameters[:options] = {:full => true}
|
50
|
+
|
51
|
+
mock(@model).where({:field => /.*query.*/i}).mock!.limit(10).
|
52
|
+
mock!.sort([[:order, :asc]])
|
53
|
+
|
54
|
+
mongo_mapper_get_autocomplete_items(@parameters)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module RailsJQueryAutocomplete
|
4
|
+
module Orm
|
5
|
+
class MongoidTest < Test::Unit::TestCase
|
6
|
+
include RailsJQueryAutocomplete::Orm::Mongoid
|
7
|
+
|
8
|
+
context "#mongoid_get_autocomplete_order" do
|
9
|
+
context "order is specified" do
|
10
|
+
should 'returns the parametrized order for Mongoid' do
|
11
|
+
assert_equal [[:field, :asc], [:state, :desc]],
|
12
|
+
mongoid_get_autocomplete_order(:method, :order => 'field ASC, state DESC')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'order is not specified' do
|
17
|
+
should 'return the method ordered ASC by default' do
|
18
|
+
assert_equal [[:method, :asc]],
|
19
|
+
mongoid_get_autocomplete_order(:method, {})
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "#mongoid_get_autocomplete_items" do
|
25
|
+
setup do
|
26
|
+
@model = mock(Object)
|
27
|
+
|
28
|
+
@parameters = {
|
29
|
+
:model => @model,
|
30
|
+
:method => :field,
|
31
|
+
:term => 'query',
|
32
|
+
:options => {:full => false}
|
33
|
+
}
|
34
|
+
mock(self).get_autocomplete_limit(anything) { 10 }
|
35
|
+
mock(self).mongoid_get_autocomplete_order(anything, anything) { [[:order, :asc]] }
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'not a full search' do
|
39
|
+
should 'do stuff' do
|
40
|
+
mock(@model).where({:field=>/^query/i}).mock!.limit(10).
|
41
|
+
mock!.order_by([[:order, :asc]])
|
42
|
+
|
43
|
+
mongoid_get_autocomplete_items(@parameters)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'full search' do
|
48
|
+
should 'return a full search query' do
|
49
|
+
@parameters[:options] = {:full => true}
|
50
|
+
|
51
|
+
mock(@model).where({:field=>/.*query.*/i}).mock!.limit(10).
|
52
|
+
mock!.order_by([[:order, :asc]])
|
53
|
+
|
54
|
+
mongoid_get_autocomplete_items(@parameters)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'view_test_helper'
|
3
|
+
|
4
|
+
module RailsJQueryAutocomplete
|
5
|
+
class SimpleFormPluginTest < ActionView::TestCase
|
6
|
+
|
7
|
+
should "apply a class of 'autocomplete'" do
|
8
|
+
with_input_for @user, :name, :autocomplete
|
9
|
+
assert_select "input#user_name.autocomplete[type=text][name='user[name]']"
|
10
|
+
end
|
11
|
+
|
12
|
+
should "add a data-autocomplete attribute with the provided :url" do
|
13
|
+
with_input_for @user, :name, :autocomplete, :url => '/test'
|
14
|
+
assert_select "input#user_name[data-autocomplete=/test]"
|
15
|
+
end
|
16
|
+
|
17
|
+
should "add a data-update-elements attribute with encoded data if passed an :update_elements option" do
|
18
|
+
with_input_for @user, :name, :autocomplete, :update_elements => { :id => '#this', :ego => '#that' }
|
19
|
+
assert_select "input#user_name[data-update-elements='{"id":"#this","ego":"#that"}']"
|
20
|
+
end
|
21
|
+
|
22
|
+
should "not add a data-update-elements attribute if not passed an :update_elements option" do
|
23
|
+
with_input_for @user, :name, :autocomplete, :url => '/test'
|
24
|
+
assert_no_select "input#user_name[data-update-elements]"
|
25
|
+
end
|
26
|
+
|
27
|
+
should "add arbitrary html options, if specified" do
|
28
|
+
with_input_for @user, :name, :autocomplete, :input_html => { :class => "superego" }
|
29
|
+
assert_select "input#user_name.superego"
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module RailsJQueryAutocomplete
|
4
|
+
class RailsJQueryAutocompleteTest < ActionController::TestCase
|
5
|
+
ActorsController = Class.new(ActionController::Base)
|
6
|
+
ActorsController.autocomplete(:movie, :name)
|
7
|
+
|
8
|
+
class ::Movie ; end
|
9
|
+
|
10
|
+
context '#autocomplete_object_method' do
|
11
|
+
setup do
|
12
|
+
@controller = ActorsController.new
|
13
|
+
@items = {}
|
14
|
+
@options = { :display_value => :name }
|
15
|
+
end
|
16
|
+
|
17
|
+
should 'respond to the action' do
|
18
|
+
assert_respond_to @controller, :autocomplete_movie_name
|
19
|
+
end
|
20
|
+
|
21
|
+
should 'render the JSON items' do
|
22
|
+
mock(@controller).get_autocomplete_items({
|
23
|
+
:model => Movie, :method => :name, :options => @options, :term => "query"
|
24
|
+
}) { @items }
|
25
|
+
|
26
|
+
mock(@controller).json_for_autocomplete(@items, :name, nil)
|
27
|
+
get :autocomplete_movie_name, :term => 'query'
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'no term is specified' do
|
31
|
+
should "render an empty hash" do
|
32
|
+
mock(@controller).json_for_autocomplete({}, :name, nil)
|
33
|
+
get :autocomplete_movie_name
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
5
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
6
|
+
|
7
|
+
ENV["RAILS_ENV"] = "test"
|
8
|
+
module Rails
|
9
|
+
def self.env
|
10
|
+
ActiveSupport::StringInquirer.new("test")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'rails/all'
|
15
|
+
require 'mongoid'
|
16
|
+
require 'mongo_mapper'
|
17
|
+
require 'shoulda'
|
18
|
+
require 'rr'
|
19
|
+
require 'rails/test_help'
|
20
|
+
require 'rails-jquery-autocomplete'
|
21
|
+
|
22
|
+
module RailsJQueryAutocomplete
|
23
|
+
class Application < ::Rails::Application
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
RailsJQueryAutocomplete::Application.routes.draw do
|
28
|
+
match '/:controller(/:action(/:id))'
|
29
|
+
end
|
30
|
+
|
31
|
+
ActionController::Base.send :include, RailsJQueryAutocomplete::Application.routes.url_helpers
|
32
|
+
|
33
|
+
class Test::Unit::TestCase
|
34
|
+
|
35
|
+
end
|
36
|
+
|
@@ -0,0 +1,108 @@
|
|
1
|
+
class User
|
2
|
+
extend ActiveModel::Naming
|
3
|
+
include ActiveModel::Conversion
|
4
|
+
|
5
|
+
attr_accessor :id, :name, :description, :created_at, :updated_at
|
6
|
+
|
7
|
+
def initialize(options={})
|
8
|
+
@new_record = false
|
9
|
+
options.each do |key, value|
|
10
|
+
send("#{key}=", value)
|
11
|
+
end if options
|
12
|
+
end
|
13
|
+
|
14
|
+
def new_record!
|
15
|
+
@new_record = true
|
16
|
+
end
|
17
|
+
|
18
|
+
def persisted?
|
19
|
+
!@new_record
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class MockController
|
24
|
+
attr_writer :action_name
|
25
|
+
|
26
|
+
def _routes
|
27
|
+
self
|
28
|
+
end
|
29
|
+
|
30
|
+
def action_name
|
31
|
+
defined?(@action_name) ? @action_name : "edit"
|
32
|
+
end
|
33
|
+
|
34
|
+
def url_for(*args)
|
35
|
+
"http://example.com"
|
36
|
+
end
|
37
|
+
|
38
|
+
def url_helpers
|
39
|
+
self
|
40
|
+
end
|
41
|
+
|
42
|
+
def hash_for_user_path(*args); end
|
43
|
+
def hash_for_users_path(*args); end
|
44
|
+
end
|
45
|
+
|
46
|
+
class MockResponse
|
47
|
+
|
48
|
+
def initialize(test_case)
|
49
|
+
@test_case = test_case
|
50
|
+
end
|
51
|
+
|
52
|
+
def content_type
|
53
|
+
'text/html'
|
54
|
+
end
|
55
|
+
|
56
|
+
def body
|
57
|
+
@test_case.send :output_buffer
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
class ActionView::TestCase
|
62
|
+
include RailsJQueryAutocomplete::Autocomplete
|
63
|
+
include SimpleForm::ActionViewExtensions::FormHelper
|
64
|
+
|
65
|
+
setup :set_controller
|
66
|
+
setup :set_response
|
67
|
+
setup :setup_new_user
|
68
|
+
|
69
|
+
def assert_no_select(selector, value = nil)
|
70
|
+
assert_select(selector, :text => value, :count => 0)
|
71
|
+
end
|
72
|
+
|
73
|
+
def with_concat_form_for(*args, &block)
|
74
|
+
concat simple_form_for(*args, &block)
|
75
|
+
end
|
76
|
+
|
77
|
+
def with_input_for(object, attribute_name, type, options={})
|
78
|
+
with_concat_form_for(object) do |f|
|
79
|
+
f.input(attribute_name, options.merge(:as => type))
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def set_controller
|
84
|
+
@controller = MockController.new
|
85
|
+
end
|
86
|
+
|
87
|
+
def set_response
|
88
|
+
@response = MockResponse.new(self)
|
89
|
+
end
|
90
|
+
|
91
|
+
def setup_new_user
|
92
|
+
@user = User.new(
|
93
|
+
:id => 1,
|
94
|
+
:name => 'New in SimpleForm!',
|
95
|
+
:description => 'Hello!',
|
96
|
+
:created_at => Time.now
|
97
|
+
)
|
98
|
+
end
|
99
|
+
|
100
|
+
def protect_against_forgery?
|
101
|
+
false
|
102
|
+
end
|
103
|
+
|
104
|
+
def user_path(*args)
|
105
|
+
'/users'
|
106
|
+
end
|
107
|
+
alias :users_path :user_path
|
108
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-jquery-autocomplete
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Padilla
|
@@ -10,78 +10,64 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-06-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
21
|
+
version: '3.2'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - '>='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: '
|
28
|
+
version: '3.2'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: sqlite3-ruby
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- -
|
33
|
+
- - '>='
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: '0'
|
36
36
|
type: :development
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - '>='
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '0'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: mongoid
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - '>='
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: 2.0.0
|
50
50
|
type: :development
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - '>='
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: 2.0.0
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: mongo_mapper
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - '>='
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '0.9'
|
64
64
|
type: :development
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - '>='
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0.9'
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: mongo
|
73
|
-
requirement: !ruby/object:Gem::Requirement
|
74
|
-
requirements:
|
75
|
-
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: 1.6.2
|
78
|
-
type: :development
|
79
|
-
prerelease: false
|
80
|
-
version_requirements: !ruby/object:Gem::Requirement
|
81
|
-
requirements:
|
82
|
-
- - ~>
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
version: 1.6.2
|
85
71
|
- !ruby/object:Gem::Dependency
|
86
72
|
name: bson_ext
|
87
73
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,28 +86,28 @@ dependencies:
|
|
100
86
|
name: guard
|
101
87
|
requirement: !ruby/object:Gem::Requirement
|
102
88
|
requirements:
|
103
|
-
- -
|
89
|
+
- - '>='
|
104
90
|
- !ruby/object:Gem::Version
|
105
91
|
version: '0'
|
106
92
|
type: :development
|
107
93
|
prerelease: false
|
108
94
|
version_requirements: !ruby/object:Gem::Requirement
|
109
95
|
requirements:
|
110
|
-
- -
|
96
|
+
- - '>='
|
111
97
|
- !ruby/object:Gem::Version
|
112
98
|
version: '0'
|
113
99
|
- !ruby/object:Gem::Dependency
|
114
100
|
name: guard-test
|
115
101
|
requirement: !ruby/object:Gem::Requirement
|
116
102
|
requirements:
|
117
|
-
- -
|
103
|
+
- - '>='
|
118
104
|
- !ruby/object:Gem::Version
|
119
105
|
version: '0'
|
120
106
|
type: :development
|
121
107
|
prerelease: false
|
122
108
|
version_requirements: !ruby/object:Gem::Requirement
|
123
109
|
requirements:
|
124
|
-
- -
|
110
|
+
- - '>='
|
125
111
|
- !ruby/object:Gem::Version
|
126
112
|
version: '0'
|
127
113
|
- !ruby/object:Gem::Dependency
|
@@ -156,28 +142,28 @@ dependencies:
|
|
156
142
|
name: uglifier
|
157
143
|
requirement: !ruby/object:Gem::Requirement
|
158
144
|
requirements:
|
159
|
-
- -
|
145
|
+
- - '>='
|
160
146
|
- !ruby/object:Gem::Version
|
161
147
|
version: '0'
|
162
148
|
type: :development
|
163
149
|
prerelease: false
|
164
150
|
version_requirements: !ruby/object:Gem::Requirement
|
165
151
|
requirements:
|
166
|
-
- -
|
152
|
+
- - '>='
|
167
153
|
- !ruby/object:Gem::Version
|
168
154
|
version: '0'
|
169
155
|
- !ruby/object:Gem::Dependency
|
170
156
|
name: rr
|
171
157
|
requirement: !ruby/object:Gem::Requirement
|
172
158
|
requirements:
|
173
|
-
- -
|
159
|
+
- - '>='
|
174
160
|
- !ruby/object:Gem::Version
|
175
161
|
version: '0'
|
176
162
|
type: :development
|
177
163
|
prerelease: false
|
178
164
|
version_requirements: !ruby/object:Gem::Requirement
|
179
165
|
requirements:
|
180
|
-
- -
|
166
|
+
- - '>='
|
181
167
|
- !ruby/object:Gem::Version
|
182
168
|
version: '0'
|
183
169
|
- !ruby/object:Gem::Dependency
|
@@ -222,7 +208,18 @@ files:
|
|
222
208
|
- LICENSE
|
223
209
|
- README.md
|
224
210
|
- Rakefile
|
225
|
-
|
211
|
+
- test/form_helper_test.rb
|
212
|
+
- test/generators/autocomplete/install_generator_test.rb
|
213
|
+
- test/generators/autocomplete/uncompressed_generator_test.rb
|
214
|
+
- test/lib/rails-jquery-autocomplete/autocomplete_test.rb
|
215
|
+
- test/lib/rails-jquery-autocomplete/orm/active_record_test.rb
|
216
|
+
- test/lib/rails-jquery-autocomplete/orm/mongo_mapper_test.rb
|
217
|
+
- test/lib/rails-jquery-autocomplete/orm/mongoid_test.rb
|
218
|
+
- test/lib/rails-jquery-autocomplete/simple_form_plugin_test.rb
|
219
|
+
- test/lib/rails-jquery-autocomplete_test.rb
|
220
|
+
- test/test_helper.rb
|
221
|
+
- test/view_test_helper.rb
|
222
|
+
homepage: https://github.com/bigtunacan/rails-jquery-autocomplete/
|
226
223
|
licenses:
|
227
224
|
- MIT
|
228
225
|
metadata: {}
|
@@ -232,12 +229,12 @@ require_paths:
|
|
232
229
|
- lib
|
233
230
|
required_ruby_version: !ruby/object:Gem::Requirement
|
234
231
|
requirements:
|
235
|
-
- -
|
232
|
+
- - '>='
|
236
233
|
- !ruby/object:Gem::Version
|
237
234
|
version: '0'
|
238
235
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
239
236
|
requirements:
|
240
|
-
- -
|
237
|
+
- - '>='
|
241
238
|
- !ruby/object:Gem::Version
|
242
239
|
version: '0'
|
243
240
|
requirements: []
|
@@ -246,5 +243,15 @@ rubygems_version: 2.1.11
|
|
246
243
|
signing_key:
|
247
244
|
specification_version: 4
|
248
245
|
summary: Use jQuery's autocomplete plugin with Rails 4+.
|
249
|
-
test_files:
|
250
|
-
|
246
|
+
test_files:
|
247
|
+
- test/form_helper_test.rb
|
248
|
+
- test/generators/autocomplete/install_generator_test.rb
|
249
|
+
- test/generators/autocomplete/uncompressed_generator_test.rb
|
250
|
+
- test/lib/rails-jquery-autocomplete/autocomplete_test.rb
|
251
|
+
- test/lib/rails-jquery-autocomplete/orm/active_record_test.rb
|
252
|
+
- test/lib/rails-jquery-autocomplete/orm/mongo_mapper_test.rb
|
253
|
+
- test/lib/rails-jquery-autocomplete/orm/mongoid_test.rb
|
254
|
+
- test/lib/rails-jquery-autocomplete/simple_form_plugin_test.rb
|
255
|
+
- test/lib/rails-jquery-autocomplete_test.rb
|
256
|
+
- test/test_helper.rb
|
257
|
+
- test/view_test_helper.rb
|