|
| 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 | +require 'cucumber/rails' |
| 8 | + |
| 9 | +# Capybara defaults to CSS3 selectors rather than XPath. |
| 10 | +# If you'd prefer to use XPath, just uncomment this line and adjust any |
| 11 | +# selectors in your step definitions to use the XPath syntax. |
| 12 | +# Capybara.default_selector = :xpath |
| 13 | + |
| 14 | +# By default, any exception happening in your Rails application will bubble up |
| 15 | +# to Cucumber so that your scenario will fail. This is a different from how |
| 16 | +# your application behaves in the production environment, where an error page will |
| 17 | +# be rendered instead. |
| 18 | +# |
| 19 | +# Sometimes we want to override this default behaviour and allow Rails to rescue |
| 20 | +# exceptions and display an error page (just like when the app is running in production). |
| 21 | +# Typical scenarios where you want to do this is when you test your error pages. |
| 22 | +# There are two ways to allow Rails to rescue exceptions: |
| 23 | +# |
| 24 | +# 1) Tag your scenario (or feature) with @allow-rescue |
| 25 | +# |
| 26 | +# 2) Set the value below to true. Beware that doing this globally is not |
| 27 | +# recommended as it will mask a lot of errors for you! |
| 28 | +# |
| 29 | +ActionController::Base.allow_rescue = false |
| 30 | + |
| 31 | +# Remove/comment out the lines below if your app doesn't have a database. |
| 32 | +# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead. |
| 33 | +begin |
| 34 | + DatabaseCleaner.strategy = :transaction |
| 35 | +rescue NameError |
| 36 | + raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it." |
| 37 | +end |
| 38 | + |
| 39 | +# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios. |
| 40 | +# See the DatabaseCleaner documentation for details. Example: |
| 41 | +# |
| 42 | +# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do |
| 43 | +# # { :except => [:widgets] } may not do what you expect here |
| 44 | +# # as Cucumber::Rails::Database.javascript_strategy overrides |
| 45 | +# # this setting. |
| 46 | +# DatabaseCleaner.strategy = :truncation |
| 47 | +# end |
| 48 | +# |
| 49 | +# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do |
| 50 | +# DatabaseCleaner.strategy = :transaction |
| 51 | +# end |
| 52 | +# |
| 53 | + |
| 54 | +# Possible values are :truncation and :transaction |
| 55 | +# The :transaction strategy is faster, but might give you threading problems. |
| 56 | +# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature |
| 57 | +Cucumber::Rails::Database.javascript_strategy = :truncation |
| 58 | + |
0 commit comments