Rails - Losing session with Integration Tests and Capybara - CSRF related?

前端 未结 4 373
执念已碎
执念已碎 2020-12-29 09:19

I\'m using Rails 3.1.0.rc4 and I\'m working on doing integration tests with capybara\'s new Steak-like DSL and Rspec (using Devise authentication)

The issue I\'m hav

4条回答
  •  天涯浪人
    2020-12-29 09:50

    I was able to fix this error by setting this value to true in config/initializers/test.rb

    # Disable request forgery protection in test environment
    config.action_controller.allow_forgery_protection = true
    

    Beforehand, the CSRF tags were not printing out to the . After changing this value they finally appear.

提交回复
热议问题