How do I get cucumber and databasecleaner to leave my seed data in my rails test db?

后端 未结 1 1463
梦谈多话
梦谈多话 2021-02-13 10:22

I have several database tables that have data that is for display purposes only, it never changes. It takes a long time to load all the seed data. I am using cucumber which se

1条回答
  •  太阳男子
    2021-02-13 11:00

    If you are using ActiveRecord or DataMapper you should be able to use the :transaction strategy instead of :truncation.

    DatabaseCleaner.strategy = :transaction
    

    Or as @traday points out, you can use an exclusion list with truncation.

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

    The DatabaseCleaner docs are worth reading. Look in features/support/env.rb for where this is typically set up with Cucumber.

    0 讨论(0)
提交回复
热议问题