Testing jQuery autocomplete with Capybara
page.execute_script %Q{ $('"#{location}"').val('"#{text}"').keydown(); }
sleep(3)
page.execute_script %Q{ $('.ui-menu-item a:contains("#{target}")').trigger('mouseenter').click(); }
page.should have_field(localtion, :with => completed_text)
rspec, machinist and database_cleaner
Configure
spec/spec_helper.rb
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end
config/environments/test.rb
Machinist.configure do |config|
config.cache_objects = false
end
Spork on JRuby on Windows
Apply this patch to Spork and this fix problem with child processes
cucumber on jruby
Configure gems
Add to Gemfile
"gem ‘gherkin’, :platform => :jruby" (with out quotes) just before cucumber gem
Precompile rails assets on jruby
Configure gems
Add to Gemfile
"gem 'therubyrhino', :platform => :jruby" (without quotes)