How to configure Rails test environment for both controller unit tests and system tests that require forgery protection

19 views Asked by At

How do I configure my Rails test environment so I can both

  1. Run integration tests on my controllers (which require forgery protection turned off), and
  2. Run system tests that require forgery protection turned on?

(The system tests need forgery protection turned on because my application contains JavaScript that requests additional data as the user navigates the page.)

Do I need to create two separate environments? Or is there a way for test.rb to recognize which type of tests I'm about to run and set config.action_controller.allow_forgery_protection accordingly?

0

There are 0 answers