test/basepack_test_app/features/support/env.rb in netzke-basepack-0.7.4 vs test/basepack_test_app/features/support/env.rb in netzke-basepack-0.7.5
- old
+ new
@@ -21,14 +21,19 @@
require 'capybara/rails'
require 'capybara/cucumber'
require 'capybara/session'
# require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript
-# Capybara.register_driver :selenium do |app|
-# Capybara::Driver::Selenium.new(app, {:profile => 'selenium' } )
-# end
+# resynchronize after ajax call
+# from README at (https://github.com/jnicklas/capybara)
+Capybara.register_driver :selenium do |app|
+ Capybara::Selenium::Driver.new(app, {:resynchronize => true } )
+end
+# wait a bit longer (default 2s)
+Capybara.default_wait_time = 5
+
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
# order to ease the transition to Capybara we set the default here. If you'd
# prefer to use XPath just remove this line and adjust any selectors in your
# steps to use the XPath syntax.
Capybara.default_selector = :css
@@ -54,15 +59,23 @@
#
# Beware that turning transactions off will leave data in your database
# after each scenario, which can lead to hard-to-debug failures in
# subsequent scenarios. If you do this, we recommend you create a Before
# block that will explicitly put your database in a known state.
-Cucumber::Rails::World.use_transactional_fixtures = true
# How to clean your database when transactions are turned off. See
# http://github.com/bmabey/database_cleaner for more info.
if defined?(ActiveRecord::Base)
begin
require 'database_cleaner'
DatabaseCleaner.strategy = :truncation
+ Cucumber::Rails::World.use_transactional_fixtures = true
+ rescue LoadError => ignore_if_database_cleaner_not_present
+ end
+end
+
+if defined?(DataMapper::Resource)
+ begin
+ require 'database_cleaner'
+ DatabaseCleaner[:data_mapper].strategy = :truncation
rescue LoadError => ignore_if_database_cleaner_not_present
end
end