Skip to content

Commit

Permalink
Set dummy app forgery protection to false
Browse files Browse the repository at this point in the history
This reverts a previous change setting dummy app forgery protection to true. Rails prefers testing to be performed with forgery protection set to false.

This change will also allow for use of system specs in Solidus frontend.
  • Loading branch information
Francesco Aiello committed Jan 8, 2021
1 parent 7b15fbf commit 97647ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions core/lib/generators/spree/dummy/templates/rails/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
# Raise exceptions instead of rendering exception templates
config.action_dispatch.show_exceptions = false

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

# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
Expand Down
5 changes: 3 additions & 2 deletions core/lib/spree/testing_support/dummy_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

# @private
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
end

# @private
Expand Down Expand Up @@ -52,8 +53,8 @@ class Application < ::Rails::Application
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
config.whiny_nils = true
config.consider_all_requests_local = true
config.action_controller.allow_forgery_protection = true
config.action_controller.default_protect_from_forgery = true
config.action_controller.allow_forgery_protection = false
config.action_controller.default_protect_from_forgery = false
config.action_controller.perform_caching = false
config.action_dispatch.show_exceptions = false
config.active_support.deprecation = :stderr
Expand Down

0 comments on commit 97647ec

Please sign in to comment.