开发者

Cucumber prevent from clearing database

开发者 https://www.devze.com 2023-01-12 21:46 出处:网络
due to a heavy growing project 开发者_开发问答I\'m running into the trouble that the database rebuild process of cucumber really takes a long time.

due to a heavy growing project 开发者_开发问答I'm running into the trouble that the database rebuild process of cucumber really takes a long time.

Since it is a application where the actual content of the table doesn't matter, I'd like to skip the rebuild process.

Unfortunately wether cucumber nor database_cleaner seem to support this, doesn't they?

My cucumber env settings may be found below

Thanks and many regards,

Joe

ENV["RAILS_ENV"] ||= "cucumber"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')

require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
require 'cucumber/rails/world'
require 'cucumber/rails/active_record'
require 'cucumber/web/tableish'

require 'capybara/rails'
require 'capybara/cucumber'
require 'capybara/session'
require 'cucumber/rails/capybara_javascript_emulation'

Capybara.default_selector = :css

ActionController::Base.allow_rescue = false

Cucumber::Rails::World.use_transactional_fixtures = false

Capybara.default_driver = :selenium

if defined?(ActiveRecord::Base)
  begin
    require 'database_cleaner'
    DatabaseCleaner.strategy = :truncation
  rescue LoadError => ignore_if_database_cleaner_not_present
  end
end


An easy way to stop database_cleaner from cleaning one of your tables is to configure it like this:

DatabaseCleaner.strategy = :truncation, {:except => %w[states]}

In this example, once the table states is loaded with information, it doesn't clean it.

0

精彩评论

暂无评论...
验证码 换一张
取 消