Skip to content

Commit b10b257

Browse files
author
David Padilla
committed
Multiple selection integration test
1 parent 863cce6 commit b10b257

File tree

7 files changed

+39
-1
lines changed

7 files changed

+39
-1
lines changed

integration/Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ gem 'haml-rails'
1111
gem 'jquery-rails'
1212
gem 'pickle'
1313
gem 'database_cleaner'
14+
gem 'send-keys', :git => 'git@github.com:crowdint/send-keys.git'

integration/Gemfile.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
GIT
2+
remote: git@github.com:crowdint/send-keys.git
3+
revision: 23080296ce7f582c04a4818aec015fc854e2303d
4+
specs:
5+
send-keys (0.1.0)
6+
capybara
7+
18
PATH
29
remote: /Users/dab/gems/rails3-jquery-autocomplete
310
specs:
@@ -148,4 +155,5 @@ DEPENDENCIES
148155
pickle
149156
rails (~> 3.0.3)
150157
rails3-jquery-autocomplete!
158+
send-keys!
151159
sqlite3-ruby
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class MultipleSelectionsController < ApplicationController
2+
autocomplete :brand, :name
3+
4+
def new
5+
@product = Product.new
6+
end
7+
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
%h1 Multiple
2+
3+
= form_for @product do |form|
4+
%p
5+
= form.label :name
6+
= form.text_field :name
7+
%p
8+
= form.label :brand_name
9+
= form.autocomplete_field :brand_name, autocomplete_brand_name_multiple_selections_path, :"data-delimiter" => ','

integration/config/routes.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Integration::Application.routes.draw do
2+
23
root :to => 'autocomplete#new'
34
match 'autocomplete/autocomplete_brand_name' => 'autocomplete#autocomplete_brand_name'
45

@@ -10,4 +11,8 @@
1011
resources :sub_classes do
1112
get :autocomplete_foreign_brand_name, :on => :collection
1213
end
14+
15+
resources :multiple_selections do
16+
get :autocomplete_brand_name, :on => :collection
17+
end
1318
end

integration/features/autocomplete.feature

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,11 @@ Feature: Autocomplete
3535
And I choose "Omega" in the autocomplete list
3636
Then the "Brand name" field should contain "Omega"
3737

38-
38+
@javascript
39+
Scenario: Autocomplete
40+
Given I go to the new multiple selection page
41+
And I send al to "Brand name"
42+
And I choose "Alpha" in the autocomplete list
43+
And I send bet to "Brand name"
44+
And I choose "Beta" in the autocomplete list
45+
Then the "Brand name" field should contain "Alpha,Beta"

integration/features/support/env.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
# rails3-jquery-autocomplete cucumber steps
2121
require 'cucumber/autocomplete'
22+
require 'send-keys/step_definitions/send_keys_steps'
2223

2324
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
2425
# order to ease the transition to Capybara we set the default here. If you'd

0 commit comments

Comments
 (0)