Zack
Zack

Reputation: 6606

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

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?

Upvotes: 0

Views: 14

Answers (0)

Related Questions