Skip to content

Instantly share code, notes, and snippets.

@abidvf
Last active December 29, 2017 07:23
Show Gist options
  • Save abidvf/c0e1c9458025bfb4a164db5c5ea454a7 to your computer and use it in GitHub Desktop.
Save abidvf/c0e1c9458025bfb4a164db5c5ea454a7 to your computer and use it in GitHub Desktop.
Cucumber rails env.rb file
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.
require 'cucumber/rails'
require 'capybara'
require 'capybara/cucumber'
require 'capybara/poltergeist'
require 'selenium-webdriver'
require 'byebug'
require 'cucumber/rails/world'
Cucumber::Rails::World.use_transactional_fixtures = false
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'database_cleaner'
require 'database_cleaner/cucumber'
begin
require 'database_cleaner'
require 'database_cleaner/cucumber'
DatabaseCleaner.strategy = :deletion, {:except => %w[users statuses roles users_roles]}
# DatabaseCleaner.clean_with(:deletion) # clean suite now up-front
rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end
After do |sc|
DatabaseCleaner.start
DatabaseCleaner.clean
end
# ********headless browser config below*********
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(
app,
:phantomjs => Phantomjs.path,
js_errors: false,
timeout: 60
)
end
Capybara.default_driver = :poltergeist
Capybara.default_host = 'http://localhost:3000'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment