Rails 3 and Rspec 2 turn off transactional fixtures for individual tests

前端 未结 3 544
感情败类
感情败类 2021-02-05 17:53

I am in the process of upgrading my application to Rails 3. I started using Rspec 2 with Rails 3. I need to turn off transactional fixtures for some of my rspec tests. Prior

3条回答
  •  自闭症患者
    2021-02-05 18:20

    You can disable transactional fixtures globally by putting config.use_transactional_fixtures = false on the spec_helper.rb. If you want to control them by test (e.g. use transactional just on some of them), you can set this behavior with DatabaseCleaner.

    I've had a related problem when testing pages with javascript on the browser (a scenario that does not work with transactional fixtures). Here's how I managed to work around it: http://github.com/lailsonbm/contact_manager_app

提交回复
热议问题