Skip to content

Commit

Permalink
Merge remote-tracking branch 'main/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
kbaum committed Jul 9, 2012
2 parents 5772ee3 + abc6e3a commit 927970d
Show file tree
Hide file tree
Showing 20 changed files with 472 additions and 144 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
@@ -0,0 +1,3 @@
rvm:
- 1.9.2
- 1.9.3
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,5 +1,6 @@
# Changelog

* 1.0.6 Postgres or non-postgres queries are now determined at model level
* 1.0.3 Fixed Formtastic 2.0 + Ruby 1.8.7 compat issue
* 1.0.2 Fixed issue #93, #94
* 1.0.1 Formtastic 2.0 compatibility fix
Expand Down
8 changes: 8 additions & 0 deletions Guardfile
@@ -0,0 +1,8 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme

guard :test do
watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
watch(%r{^test/.+_test\.rb$})
watch('test/test_helper.rb') { "test" }
end
48 changes: 35 additions & 13 deletions README.md
@@ -1,5 +1,7 @@
# rails3-jquery-autocomplete

[![Build Status](https://secure.travis-ci.org/crowdint/rails3-jquery-autocomplete.png)](http://travis-ci.org/crowdint/rails3-jquery-autocomplete)

An easy way to use jQuery's autocomplete with Rails 3.

Supports both ActiveRecord, [mongoid](http://github.com/mongoid/mongoid), and [MongoMapper](https://github.com/jnunemaker/mongomapper).
Expand Down Expand Up @@ -50,29 +52,30 @@ And include autocomplete-rails.js on your layouts

javascript_include_tag "autocomplete-rails.js"

### Rails 3.1.x

Just add it to your app/assets/javascripts/application.js file

//= require jquery
//= require jquery_ujs
//= require autocomplete-rails

## Upgrading from older versions
#### Upgrading from older versions

If you are upgrading from a previous version, run the generator after installing to replace the javascript file.

rails generate autocomplete:install

I'd recommend you do this every time you update to make sure you have the latest JS file.

## Uncompressed Javascript file
#### Uncompressed Javascript file

If you want to make changes to the JS file, you can install the
uncompressed version by running:

rails generate autocomplete:uncompressed

### Rails 3.1.x

Just add it to your app/assets/javascripts/application.js file

//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require autocomplete-rails

## Usage

### Model Example
Expand Down Expand Up @@ -223,8 +226,8 @@ The previous example would fetch the extra attribute slogan and update jQuery('#
A javascript event named *railsAutocomplete.select* is fired on the input field when a value is selected from the autocomplete drop down. If you need to do something more complex than update fields with data, you can hook into this event, like so:

$('#my_autocomplete_field').bind('railsAutocomplete.select', function(event, data){
/* Do something here */
alert(data.item.id);
/* Do something here */
alert(data.item.id);
});

## Formtastic
Expand Down Expand Up @@ -315,10 +318,18 @@ And then, install all your dependencies:

## Running the test suite

You need to have an instance of MongoDB running on your computer or all the mongo tests will fail miserably.
<strike>You need to have an instance of MongoDB running on your computer or all the mongo tests will fail miserably.</strike>

To run all the tests once, simply use

rake test

while you're developing, it is recommended that you run

bundle exec guard

to have the relevent test run every time you save a file.

## Integration tests

If you make changes or add features to the jQuery part, please make sure
Expand All @@ -333,6 +344,17 @@ integration folder:
rake db:migrate
cucumber

## Where to test what

If you're making or tweaking a plugin (such as the formastic plugin or
simple\_form plugin), check out the simple\_form\_plugin\_test for an
example of how to test it as part of the main `rake test` run.
Historically, plugins like these had been tested (shoddily) as part of
the integration tests. Feel free to remove them from the integration
suite and move them into the main suite. Your tests will run much
faster, and there will be less likelihood of your feature breaking in
the future. Thanks!

# Thanks to

Everyone on [this list](https://github.com/crowdint/rails3-jquery-autocomplete/contributors)
Expand Down
7 changes: 0 additions & 7 deletions Rakefile
Expand Up @@ -2,7 +2,6 @@ require 'bundler'
Bundler::GemHelper.install_tasks

require 'rake/testtask'
require 'rcov/rcovtask'

task :default => [:uglify, :test]

Expand All @@ -20,9 +19,3 @@ task :uglify do
end
end

Rcov::RcovTask.new do |t|
t.libs << "test"
t.test_files = FileList['test/**/*_test.rb']
t.rcov_opts = %w{--exclude \/gems\/}
t.verbose = true
end
139 changes: 69 additions & 70 deletions integration/Gemfile.lock
@@ -1,155 +1,154 @@
PATH
remote: ../
specs:
rails3-jquery-autocomplete (1.0.3)
rails3-jquery-autocomplete (1.0.6)
rails (~> 3.0)

GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
actionmailer (3.0.10)
actionpack (= 3.0.10)
actionmailer (3.0.11)
actionpack (= 3.0.11)
mail (~> 2.2.19)
actionpack (3.0.10)
activemodel (= 3.0.10)
activesupport (= 3.0.10)
actionpack (3.0.11)
activemodel (= 3.0.11)
activesupport (= 3.0.11)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.5.0)
rack (~> 1.2.1)
rack-mount (~> 0.6.14)
rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
activemodel (3.0.10)
activesupport (= 3.0.10)
activemodel (3.0.11)
activesupport (= 3.0.11)
builder (~> 2.1.2)
i18n (~> 0.5.0)
activerecord (3.0.10)
activemodel (= 3.0.10)
activesupport (= 3.0.10)
activerecord (3.0.11)
activemodel (= 3.0.11)
activesupport (= 3.0.11)
arel (~> 2.0.10)
tzinfo (~> 0.3.23)
activeresource (3.0.10)
activemodel (= 3.0.10)
activesupport (= 3.0.10)
activesupport (3.0.10)
activeresource (3.0.11)
activemodel (= 3.0.11)
activesupport (= 3.0.11)
activesupport (3.0.11)
addressable (2.2.6)
annotate (2.4.0)
arel (2.0.10)
builder (2.1.2)
capybara (1.0.1)
capybara (1.1.2)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
childprocess (0.2.1)
childprocess (0.2.3)
ffi (~> 1.0.6)
cucumber (1.0.2)
cucumber (1.1.4)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
gherkin (~> 2.4.5)
gherkin (~> 2.7.1)
json (>= 1.4.6)
term-ansicolor (>= 1.0.5)
cucumber-rails (1.0.2)
capybara (>= 1.0.0)
cucumber (~> 1.0.0)
nokogiri (>= 1.4.6)
database_cleaner (0.6.7)
diff-lcs (1.1.2)
term-ansicolor (>= 1.0.6)
cucumber-rails (1.2.1)
capybara (>= 1.1.2)
cucumber (>= 1.1.3)
nokogiri (>= 1.5.0)
database_cleaner (0.7.0)
diff-lcs (1.1.3)
erubis (2.6.6)
abstract (>= 1.0.0)
ffi (1.0.9)
formtastic (1.2.4)
actionpack (>= 2.3.7)
activesupport (>= 2.3.7)
i18n (~> 0.4)
gherkin (2.4.15)
ffi (1.0.11)
formtastic (2.0.2)
rails (~> 3.0)
gherkin (2.7.1)
json (>= 1.4.6)
haml (3.1.2)
haml (3.1.4)
haml-rails (0.3.4)
actionpack (~> 3.0)
activesupport (~> 3.0)
haml (~> 3.0)
railties (~> 3.0)
i18n (0.5.0)
jquery-rails (1.0.13)
jquery-rails (1.0.19)
railties (~> 3.0)
thor (~> 0.14)
json (1.5.3)
json_pure (1.5.3)
json (1.6.3)
launchy (2.0.5)
addressable (~> 2.2.6)
mail (2.2.19)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
mime-types (1.17.2)
multi_json (1.0.4)
nifty-generators (0.4.6)
nokogiri (1.5.0)
pickle (0.4.8)
pickle (0.4.10)
cucumber (>= 0.8)
rake
polyglot (0.3.2)
rack (1.2.3)
polyglot (0.3.3)
rack (1.2.4)
rack-mount (0.6.14)
rack (>= 1.0.0)
rack-test (0.5.7)
rack (>= 1.0)
rails (3.0.10)
actionmailer (= 3.0.10)
actionpack (= 3.0.10)
activerecord (= 3.0.10)
activeresource (= 3.0.10)
activesupport (= 3.0.10)
rails (3.0.11)
actionmailer (= 3.0.11)
actionpack (= 3.0.11)
activerecord (= 3.0.11)
activeresource (= 3.0.11)
activesupport (= 3.0.11)
bundler (~> 1.0)
railties (= 3.0.10)
railties (3.0.10)
actionpack (= 3.0.10)
activesupport (= 3.0.10)
railties (= 3.0.11)
railties (3.0.11)
actionpack (= 3.0.11)
activesupport (= 3.0.11)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.4)
rake (0.9.2)
rdoc (3.9.2)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
rspec-mocks (~> 2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
rspec (2.7.0)
rspec-core (~> 2.7.0)
rspec-expectations (~> 2.7.0)
rspec-mocks (~> 2.7.0)
rspec-core (2.7.1)
rspec-expectations (2.7.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
rspec-rails (2.6.1)
rspec-mocks (2.7.0)
rspec-rails (2.7.0)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.6.0)
rubyzip (0.9.4)
sass (3.1.7)
selenium-webdriver (2.5.0)
rspec (~> 2.7.0)
rubyzip (0.9.5)
sass (3.1.11)
selenium-webdriver (2.15.0)
childprocess (>= 0.2.1)
ffi (>= 1.0.7)
json_pure
ffi (~> 1.0.9)
multi_json (~> 1.0.4)
rubyzip
simple_form (1.4.2)
simple_form (1.5.2)
actionpack (~> 3.0)
activemodel (~> 3.0)
sqlite3 (1.3.4)
sqlite3 (1.3.5)
sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3)
steak (2.0.0)
capybara (>= 1.0.0)
rspec-rails (>= 2.5.0)
term-ansicolor (1.0.6)
term-ansicolor (1.0.7)
thor (0.14.6)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.29)
tzinfo (0.3.31)
xpath (0.1.4)
nokogiri (~> 1.3)

Expand Down
7 changes: 0 additions & 7 deletions integration/features/autocomplete.feature
Expand Up @@ -57,13 +57,6 @@ Feature: Autocomplete
And I choose "Shiny" in the autocomplete list
Then the "Feature Name" field should contain "Glowy,Shiny"

@javascript
Scenario: Autocomplete with simple_form
Given I go to the new simple form page
And I fill in "Brand name" with "al"
And I choose "Alpha" in the autocomplete list
Then the "Brand name" field should contain "Alpha"

@javascript
Scenario: Autocomplete with scope
Given the "Kappa" brand has an address
Expand Down
@@ -1,6 +1,6 @@
Then /^the "([^"]*)" field should contain the "([^"]*)" brand id$/ do |field, name|
brand = Brand.where(:name => name).first
Then %{the "#{field}" field should contain "#{brand.id}"}
steps %{Then the "#{field}" field should contain "#{brand.id}"}
end

And /^I send (.*) to "(.*)"$/ do |key, element|
Expand Down

0 comments on commit 927970d

Please sign in to comment.