rails3-jquery-autocomplete 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/{CHANGELOG.md → CHANGELOG.MD} +1 -0
- data/README.markdown +4 -1
- data/lib/generators/templates/autocomplete-rails-uncompressed.js +1 -1
- data/lib/generators/templates/autocomplete-rails.js +1 -1
- data/lib/rails3-jquery-autocomplete.rb +1 -1
- data/lib/rails3-jquery-autocomplete/form_helper.rb +1 -0
- data/lib/rails3-jquery-autocomplete/formtastic_plugin.rb +3 -4
- data/lib/rails3-jquery-autocomplete/version.rb +1 -1
- metadata +10 -104
- data/.document +0 -5
- data/.gitignore +0 -26
- data/Gemfile +0 -18
- data/integration/.gitignore +0 -2
- data/integration/.rspec +0 -1
- data/integration/Gemfile +0 -18
- data/integration/README +0 -256
- data/integration/Rakefile +0 -7
- data/integration/app/controllers/application_controller.rb +0 -3
- data/integration/app/controllers/autocomplete_controller.rb +0 -7
- data/integration/app/controllers/id_elements_controller.rb +0 -8
- data/integration/app/controllers/multiple_selections_controller.rb +0 -7
- data/integration/app/controllers/nested_models_controller.rb +0 -8
- data/integration/app/controllers/scoped_autocompletes_controller.rb +0 -7
- data/integration/app/controllers/simple_forms_controller.rb +0 -7
- data/integration/app/controllers/sub_classes_controller.rb +0 -7
- data/integration/app/helpers/application_helper.rb +0 -2
- data/integration/app/helpers/autocomplete_helper.rb +0 -2
- data/integration/app/helpers/error_messages_helper.rb +0 -23
- data/integration/app/helpers/id_elements_helper.rb +0 -2
- data/integration/app/helpers/layout_helper.rb +0 -22
- data/integration/app/helpers/sub_classes_helper.rb +0 -2
- data/integration/app/models/address.rb +0 -2
- data/integration/app/models/brand.rb +0 -18
- data/integration/app/models/feature.rb +0 -13
- data/integration/app/models/foreign_brand.rb +0 -15
- data/integration/app/models/product.rb +0 -17
- data/integration/app/views/autocomplete/new.html.haml +0 -10
- data/integration/app/views/id_elements/new.html.haml +0 -12
- data/integration/app/views/layouts/application.html.haml +0 -21
- data/integration/app/views/multiple_selections/new.html.haml +0 -9
- data/integration/app/views/nested_models/new.html.haml +0 -11
- data/integration/app/views/scoped_autocompletes/new.html.haml +0 -10
- data/integration/app/views/simple_forms/new.html.haml +0 -8
- data/integration/app/views/sub_classes/new.html.haml +0 -9
- data/integration/autotest/discover.rb +0 -2
- data/integration/config.ru +0 -4
- data/integration/config/application.rb +0 -42
- data/integration/config/boot.rb +0 -13
- data/integration/config/cucumber.yml +0 -8
- data/integration/config/database.yml +0 -25
- data/integration/config/environment.rb +0 -5
- data/integration/config/environments/development.rb +0 -26
- data/integration/config/environments/production.rb +0 -49
- data/integration/config/environments/test.rb +0 -35
- data/integration/config/initializers/backtrace_silencers.rb +0 -7
- data/integration/config/initializers/inflections.rb +0 -10
- data/integration/config/initializers/mime_types.rb +0 -5
- data/integration/config/initializers/secret_token.rb +0 -7
- data/integration/config/initializers/session_store.rb +0 -8
- data/integration/config/locales/en.yml +0 -5
- data/integration/config/routes.rb +0 -90
- data/integration/db/migrate/20101209014338_create_brands.rb +0 -13
- data/integration/db/migrate/20101209014355_create_products.rb +0 -14
- data/integration/db/migrate/20101209053936_add_type_to_brand.rb +0 -9
- data/integration/db/migrate/20110209020136_create_features.rb +0 -14
- data/integration/db/migrate/20110423000347_add_state_to_brands.rb +0 -9
- data/integration/db/migrate/20110512153732_create_addresses.rb +0 -13
- data/integration/db/migrate/20110512153811_add_address_id_to_brand.rb +0 -9
- data/integration/db/schema.rb +0 -44
- data/integration/db/seeds.rb +0 -3
- data/integration/doc/README_FOR_APP +0 -2
- data/integration/features/autocomplete.feature +0 -73
- data/integration/features/step_definitions/autocomplete_steps.rb +0 -15
- data/integration/features/step_definitions/pickle_steps.rb +0 -100
- data/integration/features/step_definitions/web_steps.rb +0 -219
- data/integration/features/support/env.rb +0 -61
- data/integration/features/support/paths.rb +0 -33
- data/integration/features/support/pickle.rb +0 -24
- data/integration/lib/tasks/cucumber.rake +0 -53
- data/integration/public/404.html +0 -26
- data/integration/public/422.html +0 -26
- data/integration/public/500.html +0 -26
- data/integration/public/favicon.ico +0 -0
- data/integration/public/images/rails.png +0 -0
- data/integration/public/javascripts/application.js +0 -0
- data/integration/public/javascripts/autocomplete-rails.js +0 -16
- data/integration/public/javascripts/jquery-1.5.1.min.js +0 -17
- data/integration/public/javascripts/jquery-ui.min.js +0 -97
- data/integration/public/javascripts/jquery.min.js +0 -167
- data/integration/public/javascripts/rails.js +0 -137
- data/integration/public/robots.txt +0 -5
- data/integration/public/stylesheets/application.css +0 -61
- data/integration/public/stylesheets/jquery-ui-1.8.2.custom.css +0 -489
- data/integration/public/stylesheets/sass/application.sass +0 -66
- data/integration/script/cucumber +0 -10
- data/integration/script/rails +0 -6
- data/integration/spec/acceptance/acceptance_helper.rb +0 -15
- data/integration/spec/acceptance/autocomplete_spec.rb +0 -81
- data/integration/spec/acceptance/support/helpers.rb +0 -12
- data/integration/spec/acceptance/support/paths.rb +0 -33
- data/integration/spec/spec_helper.rb +0 -37
- data/rails3-jquery-autocomplete.gemspec +0 -31
@@ -1,15 +0,0 @@
|
|
1
|
-
Then /^the "([^"]*)" field should contain the "([^"]*)" brand id$/ do |field, name|
|
2
|
-
brand = Brand.where(:name => name).first
|
3
|
-
Then %{the "#{field}" field should contain "#{brand.id}"}
|
4
|
-
end
|
5
|
-
|
6
|
-
And /^I send (.*) to "(.*)"$/ do |key, element|
|
7
|
-
find_field(element).native.send_keys(key)
|
8
|
-
end
|
9
|
-
|
10
|
-
Given /^the "([^"]*)" brand has an address$/ do |brand_name|
|
11
|
-
brand = Brand.find_by_name(brand_name)
|
12
|
-
brand.address = Address.create
|
13
|
-
brand.save!
|
14
|
-
end
|
15
|
-
|
@@ -1,100 +0,0 @@
|
|
1
|
-
# this file generated by script/generate pickle
|
2
|
-
|
3
|
-
# create a model
|
4
|
-
Given(/^#{capture_model} exists?(?: with #{capture_fields})?$/) do |name, fields|
|
5
|
-
create_model(name, fields)
|
6
|
-
end
|
7
|
-
|
8
|
-
# create n models
|
9
|
-
Given(/^(\d+) #{capture_plural_factory} exist(?: with #{capture_fields})?$/) do |count, plural_factory, fields|
|
10
|
-
count.to_i.times { create_model(plural_factory.singularize, fields) }
|
11
|
-
end
|
12
|
-
|
13
|
-
# create models from a table
|
14
|
-
Given(/^the following #{capture_plural_factory} exists?:?$/) do |plural_factory, table|
|
15
|
-
create_models_from_table(plural_factory, table)
|
16
|
-
end
|
17
|
-
|
18
|
-
# find a model
|
19
|
-
Then(/^#{capture_model} should exist(?: with #{capture_fields})?$/) do |name, fields|
|
20
|
-
find_model!(name, fields)
|
21
|
-
end
|
22
|
-
|
23
|
-
# not find a model
|
24
|
-
Then(/^#{capture_model} should not exist(?: with #{capture_fields})?$/) do |name, fields|
|
25
|
-
find_model(name, fields).should be_nil
|
26
|
-
end
|
27
|
-
|
28
|
-
# find models with a table
|
29
|
-
Then(/^the following #{capture_plural_factory} should exists?:?$/) do |plural_factory, table|
|
30
|
-
find_models_from_table(plural_factory, table).should_not be_any(&:nil?)
|
31
|
-
end
|
32
|
-
|
33
|
-
# find exactly n models
|
34
|
-
Then(/^(\d+) #{capture_plural_factory} should exist(?: with #{capture_fields})?$/) do |count, plural_factory, fields|
|
35
|
-
find_models(plural_factory.singularize, fields).size.should == count.to_i
|
36
|
-
end
|
37
|
-
|
38
|
-
# assert equality of models
|
39
|
-
Then(/^#{capture_model} should be #{capture_model}$/) do |a, b|
|
40
|
-
model!(a).should == model!(b)
|
41
|
-
end
|
42
|
-
|
43
|
-
# assert model is in another model's has_many assoc
|
44
|
-
Then(/^#{capture_model} should be (?:in|one of|amongst) #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
|
45
|
-
model!(owner).send(association).should include(model!(target))
|
46
|
-
end
|
47
|
-
|
48
|
-
# assert model is not in another model's has_many assoc
|
49
|
-
Then(/^#{capture_model} should not be (?:in|one of|amongst) #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
|
50
|
-
model!(owner).send(association).should_not include(model!(target))
|
51
|
-
end
|
52
|
-
|
53
|
-
# assert model is another model's has_one/belongs_to assoc
|
54
|
-
Then(/^#{capture_model} should be #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
|
55
|
-
model!(owner).send(association).should == model!(target)
|
56
|
-
end
|
57
|
-
|
58
|
-
# assert model is not another model's has_one/belongs_to assoc
|
59
|
-
Then(/^#{capture_model} should not be #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
|
60
|
-
model!(owner).send(association).should_not == model!(target)
|
61
|
-
end
|
62
|
-
|
63
|
-
# assert model.predicate?
|
64
|
-
Then(/^#{capture_model} should (?:be|have) (?:an? )?#{capture_predicate}$/) do |name, predicate|
|
65
|
-
if model!(name).respond_to?("has_#{predicate.gsub(' ', '_')}")
|
66
|
-
model!(name).should send("have_#{predicate.gsub(' ', '_')}")
|
67
|
-
else
|
68
|
-
model!(name).should send("be_#{predicate.gsub(' ', '_')}")
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
# assert not model.predicate?
|
73
|
-
Then(/^#{capture_model} should not (?:be|have) (?:an? )?#{capture_predicate}$/) do |name, predicate|
|
74
|
-
if model!(name).respond_to?("has_#{predicate.gsub(' ', '_')}")
|
75
|
-
model!(name).should_not send("have_#{predicate.gsub(' ', '_')}")
|
76
|
-
else
|
77
|
-
model!(name).should_not send("be_#{predicate.gsub(' ', '_')}")
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
# model.attribute.should eql(value)
|
82
|
-
# model.attribute.should_not eql(value)
|
83
|
-
Then(/^#{capture_model}'s (\w+) (should(?: not)?) be #{capture_value}$/) do |name, attribute, expectation, expected|
|
84
|
-
actual_value = model(name).send(attribute)
|
85
|
-
expectation = expectation.gsub(' ', '_')
|
86
|
-
|
87
|
-
case expected
|
88
|
-
when 'nil', 'true', 'false'
|
89
|
-
actual_value.send(expectation, send("be_#{expected}"))
|
90
|
-
when /^[+-]?[0-9_]+(\.\d+)?$/
|
91
|
-
actual_value.send(expectation, eql(expected.to_f))
|
92
|
-
else
|
93
|
-
actual_value.to_s.send(expectation, eql(eval(expected)))
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
# assert size of association
|
98
|
-
Then /^#{capture_model} should have (\d+) (\w+)$/ do |name, size, association|
|
99
|
-
model!(name).send(association).size.should == size.to_i
|
100
|
-
end
|
@@ -1,219 +0,0 @@
|
|
1
|
-
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
|
-
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
-
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
|
-
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
|
-
# files.
|
6
|
-
|
7
|
-
|
8
|
-
require 'uri'
|
9
|
-
require 'cgi'
|
10
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
11
|
-
|
12
|
-
module WithinHelpers
|
13
|
-
def with_scope(locator)
|
14
|
-
locator ? within(locator) { yield } : yield
|
15
|
-
end
|
16
|
-
end
|
17
|
-
World(WithinHelpers)
|
18
|
-
|
19
|
-
Given /^(?:|I )am on (.+)$/ do |page_name|
|
20
|
-
visit path_to(page_name)
|
21
|
-
end
|
22
|
-
|
23
|
-
When /^(?:|I )go to (.+)$/ do |page_name|
|
24
|
-
visit path_to(page_name)
|
25
|
-
end
|
26
|
-
|
27
|
-
When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector|
|
28
|
-
with_scope(selector) do
|
29
|
-
click_button(button)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
|
34
|
-
with_scope(selector) do
|
35
|
-
click_link(link)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
When /^(?:|I )fill in "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector|
|
40
|
-
with_scope(selector) do
|
41
|
-
fill_in(field, :with => value)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
When /^(?:|I )fill in "([^"]*)" for "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
|
46
|
-
with_scope(selector) do
|
47
|
-
fill_in(field, :with => value)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# Use this to fill in an entire form with data from a table. Example:
|
52
|
-
#
|
53
|
-
# When I fill in the following:
|
54
|
-
# | Account Number | 5002 |
|
55
|
-
# | Expiry date | 2009-11-01 |
|
56
|
-
# | Note | Nice guy |
|
57
|
-
# | Wants Email? | |
|
58
|
-
#
|
59
|
-
# TODO: Add support for checkbox, select og option
|
60
|
-
# based on naming conventions.
|
61
|
-
#
|
62
|
-
When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, fields|
|
63
|
-
with_scope(selector) do
|
64
|
-
fields.rows_hash.each do |name, value|
|
65
|
-
When %{I fill in "#{name}" with "#{value}"}
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
When /^(?:|I )select "([^"]*)" from "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
|
71
|
-
with_scope(selector) do
|
72
|
-
select(value, :from => field)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
When /^(?:|I )check "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
|
77
|
-
with_scope(selector) do
|
78
|
-
check(field)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
When /^(?:|I )uncheck "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
|
83
|
-
with_scope(selector) do
|
84
|
-
uncheck(field)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
When /^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
|
89
|
-
with_scope(selector) do
|
90
|
-
choose(field)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"(?: within "([^"]*)")?$/ do |path, field, selector|
|
95
|
-
with_scope(selector) do
|
96
|
-
attach_file(field, path)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
Then /^(?:|I )should see JSON:$/ do |expected_json|
|
101
|
-
require 'json'
|
102
|
-
expected = JSON.pretty_generate(JSON.parse(expected_json))
|
103
|
-
actual = JSON.pretty_generate(JSON.parse(response.body))
|
104
|
-
expected.should == actual
|
105
|
-
end
|
106
|
-
|
107
|
-
Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
|
108
|
-
with_scope(selector) do
|
109
|
-
if page.respond_to? :should
|
110
|
-
page.should have_content(text)
|
111
|
-
else
|
112
|
-
assert page.has_content?(text)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
|
118
|
-
regexp = Regexp.new(regexp)
|
119
|
-
with_scope(selector) do
|
120
|
-
if page.respond_to? :should
|
121
|
-
page.should have_xpath('//*', :text => regexp)
|
122
|
-
else
|
123
|
-
assert page.has_xpath?('//*', :text => regexp)
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
Then /^(?:|I )should not see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
|
129
|
-
with_scope(selector) do
|
130
|
-
if page.respond_to? :should
|
131
|
-
page.should have_no_content(text)
|
132
|
-
else
|
133
|
-
assert page.has_no_content?(text)
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
|
139
|
-
regexp = Regexp.new(regexp)
|
140
|
-
with_scope(selector) do
|
141
|
-
if page.respond_to? :should
|
142
|
-
page.should have_no_xpath('//*', :text => regexp)
|
143
|
-
else
|
144
|
-
assert page.has_no_xpath?('//*', :text => regexp)
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
Then /^the "([^"]*)" field(?: within "([^"]*)")? should contain "([^"]*)"$/ do |field, selector, value|
|
150
|
-
with_scope(selector) do
|
151
|
-
field = find_field(field)
|
152
|
-
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
153
|
-
if field_value.respond_to? :should
|
154
|
-
field_value.should =~ /#{value}/
|
155
|
-
else
|
156
|
-
assert_match(/#{value}/, field_value)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
Then /^the "([^"]*)" field(?: within "([^"]*)")? should not contain "([^"]*)"$/ do |field, selector, value|
|
162
|
-
with_scope(selector) do
|
163
|
-
field = find_field(field)
|
164
|
-
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
165
|
-
if field_value.respond_to? :should_not
|
166
|
-
field_value.should_not =~ /#{value}/
|
167
|
-
else
|
168
|
-
assert_no_match(/#{value}/, field_value)
|
169
|
-
end
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |label, selector|
|
174
|
-
with_scope(selector) do
|
175
|
-
field_checked = find_field(label)['checked']
|
176
|
-
if field_checked.respond_to? :should
|
177
|
-
field_checked.should be_true
|
178
|
-
else
|
179
|
-
assert field_checked
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |label, selector|
|
185
|
-
with_scope(selector) do
|
186
|
-
field_checked = find_field(label)['checked']
|
187
|
-
if field_checked.respond_to? :should
|
188
|
-
field_checked.should be_false
|
189
|
-
else
|
190
|
-
assert !field_checked
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
Then /^(?:|I )should be on (.+)$/ do |page_name|
|
196
|
-
current_path = URI.parse(current_url).path
|
197
|
-
if current_path.respond_to? :should
|
198
|
-
current_path.should == path_to(page_name)
|
199
|
-
else
|
200
|
-
assert_equal path_to(page_name), current_path
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
205
|
-
query = URI.parse(current_url).query
|
206
|
-
actual_params = query ? CGI.parse(query) : {}
|
207
|
-
expected_params = {}
|
208
|
-
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
|
209
|
-
|
210
|
-
if actual_params.respond_to? :should
|
211
|
-
actual_params.should == expected_params
|
212
|
-
else
|
213
|
-
assert_equal expected_params, actual_params
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
Then /^show me the page$/ do
|
218
|
-
save_and_open_page
|
219
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
|
-
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
-
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
|
-
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
|
-
# files.
|
6
|
-
|
7
|
-
ENV["RAILS_ENV"] ||= "test"
|
8
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
9
|
-
|
10
|
-
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
|
11
|
-
require 'cucumber/rails/world'
|
12
|
-
require 'cucumber/rails/active_record'
|
13
|
-
require 'cucumber/web/tableish'
|
14
|
-
|
15
|
-
require 'capybara/rails'
|
16
|
-
require 'capybara/cucumber'
|
17
|
-
require 'capybara/session'
|
18
|
-
require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript
|
19
|
-
|
20
|
-
# rails3-jquery-autocomplete cucumber steps
|
21
|
-
require 'cucumber/autocomplete'
|
22
|
-
|
23
|
-
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
|
24
|
-
# order to ease the transition to Capybara we set the default here. If you'd
|
25
|
-
# prefer to use XPath just remove this line and adjust any selectors in your
|
26
|
-
# steps to use the XPath syntax.
|
27
|
-
Capybara.default_selector = :css
|
28
|
-
|
29
|
-
# If you set this to false, any error raised from within your app will bubble
|
30
|
-
# up to your step definition and out to cucumber unless you catch it somewhere
|
31
|
-
# on the way. You can make Rails rescue errors and render error pages on a
|
32
|
-
# per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
|
33
|
-
#
|
34
|
-
# If you set this to true, Rails will rescue all errors and render error
|
35
|
-
# pages, more or less in the same way your application would behave in the
|
36
|
-
# default production environment. It's not recommended to do this for all
|
37
|
-
# of your scenarios, as this makes it hard to discover errors in your application.
|
38
|
-
ActionController::Base.allow_rescue = false
|
39
|
-
|
40
|
-
# If you set this to true, each scenario will run in a database transaction.
|
41
|
-
# You can still turn off transactions on a per-scenario basis, simply tagging
|
42
|
-
# a feature or scenario with the @no-txn tag. If you are using Capybara,
|
43
|
-
# tagging with @culerity or @javascript will also turn transactions off.
|
44
|
-
#
|
45
|
-
# If you set this to false, transactions will be off for all scenarios,
|
46
|
-
# regardless of whether you use @no-txn or not.
|
47
|
-
#
|
48
|
-
# Beware that turning transactions off will leave data in your database
|
49
|
-
# after each scenario, which can lead to hard-to-debug failures in
|
50
|
-
# subsequent scenarios. If you do this, we recommend you create a Before
|
51
|
-
# block that will explicitly put your database in a known state.
|
52
|
-
Cucumber::Rails::World.use_transactional_fixtures = true
|
53
|
-
# How to clean your database when transactions are turned off. See
|
54
|
-
# http://github.com/bmabey/database_cleaner for more info.
|
55
|
-
if defined?(ActiveRecord::Base)
|
56
|
-
begin
|
57
|
-
require 'database_cleaner'
|
58
|
-
DatabaseCleaner.strategy = :truncation
|
59
|
-
rescue LoadError => ignore_if_database_cleaner_not_present
|
60
|
-
end
|
61
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module NavigationHelpers
|
2
|
-
# Maps a name to a path. Used by the
|
3
|
-
#
|
4
|
-
# When /^I go to (.+)$/ do |page_name|
|
5
|
-
#
|
6
|
-
# step definition in web_steps.rb
|
7
|
-
#
|
8
|
-
def path_to(page_name)
|
9
|
-
case page_name
|
10
|
-
|
11
|
-
when /the home\s?page/
|
12
|
-
'/'
|
13
|
-
|
14
|
-
# Add more mappings here.
|
15
|
-
# Here is an example that pulls values out of the Regexp:
|
16
|
-
#
|
17
|
-
# when /^(.*)'s profile page$/i
|
18
|
-
# user_profile_path(User.find_by_login($1))
|
19
|
-
|
20
|
-
else
|
21
|
-
begin
|
22
|
-
page_name =~ /the (.*) page/
|
23
|
-
path_components = $1.split(/\s+/)
|
24
|
-
self.send(path_components.push('path').join('_').to_sym)
|
25
|
-
rescue Object => e
|
26
|
-
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
27
|
-
"Now, go and add a mapping in #{__FILE__}"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
World(NavigationHelpers)
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# this file generated by script/generate pickle [paths] [email]
|
2
|
-
#
|
3
|
-
# Make sure that you are loading your factory of choice in your cucumber environment
|
4
|
-
#
|
5
|
-
# For machinist add: features/support/machinist.rb
|
6
|
-
#
|
7
|
-
# require 'machinist/active_record' # or your chosen adaptor
|
8
|
-
# require File.dirname(__FILE__) + '/../../spec/blueprints' # or wherever your blueprints are
|
9
|
-
# Before { Sham.reset } # to reset Sham's seed between scenarios so each run has same random sequences
|
10
|
-
#
|
11
|
-
# For FactoryGirl add: features/support/factory_girl.rb
|
12
|
-
#
|
13
|
-
# require 'factory_girl'
|
14
|
-
# require File.dirname(__FILE__) + '/../../spec/factories' # or wherever your factories are
|
15
|
-
#
|
16
|
-
# You may also need to add gem dependencies on your factory of choice in <tt>config/environments/cucumber.rb</tt>
|
17
|
-
|
18
|
-
require 'pickle/world'
|
19
|
-
# Example of configuring pickle:
|
20
|
-
#
|
21
|
-
# Pickle.configure do |config|
|
22
|
-
# config.adapters = [:machinist]
|
23
|
-
# config.map 'I', 'myself', 'me', 'my', :to => 'user: "me"'
|
24
|
-
# end
|