2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen# It is recommended to regenerate this file in the future when you upgrade to a
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen# newer version of cucumber-rails. Consider adding your own code to a new file
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen# instead of editing this one. Cucumber will automatically load all features/**/*.rb
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenrequire 'simplecov'
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenrequire 'webmock'
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen require Rails.root.join('spec', 'support', 'common_helper_methods.rb')
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen require Rails.root.join('spec', 'support', 'scenario_progress_formatter.rb')
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen require Rails.root.join('spec', 'support', 'shared_helper.rb')
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen # Capybara is smart enough to wait for ajax when not finding elements.
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen # In some situations the element is already existent, but has not been updated
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen # yet. This is where you need to manually use wait_for_ajax.
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen # The condition only works with poltergeist/phantomjs.
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen while page.evaluate_script("jQuery.active").to_i > 0
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen if counter >= 10 * Capybara.default_max_wait_time
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen raise "AJAX request took longer than 5 seconds."
300e4e43ed1ca46d0614459161ca2fb460ef661aTimo Sirainen# Capybara defaults to CSS3 selectors rather than XPath.
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen# If you'd prefer to use XPath, just uncomment this line and adjust any
00e7c3010f7da4a49881a7feb05e413af353af0aTimo Sirainen# selectors in your step definitions to use the XPath syntax.
00e7c3010f7da4a49881a7feb05e413af353af0aTimo Sirainen# Capybara.default_selector = :xpath
00e7c3010f7da4a49881a7feb05e413af353af0aTimo Sirainen# By default, any exception happening in your Rails application will bubble up
00e7c3010f7da4a49881a7feb05e413af353af0aTimo Sirainen# to Cucumber so that your scenario will fail. This is a different from how
00e7c3010f7da4a49881a7feb05e413af353af0aTimo Sirainen# your application behaves in the production environment, where an error page will
00e7c3010f7da4a49881a7feb05e413af353af0aTimo Sirainen# be rendered instead.
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
# # as Cucumber::Rails::Database.javascript_strategy overrides
# DatabaseCleaner.strategy = :truncation
# DatabaseCleaner.strategy = :transaction