README.markdown in rails3-jquery-autocomplete-0.3.3 vs README.markdown in rails3-jquery-autocomplete-0.3.4
- old
+ new
@@ -18,11 +18,11 @@
## Installing
Include the gem on your Gemfile
- gem 'rails3-jquery-autocomplete', '0.3.2'
+ gem 'rails3-jquery-autocomplete'
Install it
bundle install
@@ -32,16 +32,18 @@
And include autocomplete-rails.js on your layouts
javascript_include_tag "autocomplete-rails.js"
-## Upgrading from 0.2.x
+## 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
+I'd recommend you do this every time you update to make sure you have the latest JS file.
+
## Usage
### Model Example
Assuming you have a Brand model:
@@ -139,20 +141,46 @@
f.autocomplete_field :brand_name, autocomplete_brand_name_products_path, :id_element => '#some_element'
This will update the field with id *#some_element with the id of the selected object. The value for this option can be any jQuery selector.
-## Development
+# Cucumber
+I have created a step to test your autocomplete with Cucumber and Capybara, all you have to do is add the following lines to your *env.rb* file:
+
+ require 'cucumber/autocomplete'
+
+Then you'll have access to the following step:
+
+ And I choose "Alpha" in the autocomplete list
+
+An example on how to use it:
+
+ @javascript
+ Scenario: Autocomplete
+ Given the following brands exists:
+ | name |
+ | Alpha |
+ | Beta |
+ | Gamma |
+ And I go to the home 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"
+
+I have only tested this using Capybara, no idea if it works with something else, to see it in action, check the [example app](http://github.com/crowdint/rails3-jquery-autocomplete-app).
+
+# Development
+
If you want to make changes to the gem, first install bundler 1.0.0:
gem install bundler
And then, install all your dependencies:
bundle install
-### Running the test suite
+## Running the test suite
rake test
# About the Author
\ No newline at end of file