Merge pull request #7971 from opf/fix/rspec_request_store

move request store clearing to after each
pull/7973/head
ulferts 5 years ago committed by GitHub
commit 25a810c589
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      spec/support/rspec_cleanup.rb

@ -4,8 +4,6 @@ RSpec.configure do |config|
# This happens automatically for :mailer specs # This happens automatically for :mailer specs
ActionMailer::Base.delivery_method = :test ActionMailer::Base.delivery_method = :test
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear
RequestStore.clear!
end end
config.append_after(:each) do config.append_after(:each) do
@ -13,9 +11,7 @@ RSpec.configure do |config|
# by calling code in the app setting changing the locale. # by calling code in the app setting changing the locale.
I18n.locale = :en unless I18n.locale == :en I18n.locale = :en unless I18n.locale == :en
# Set the class instance variable @current_user to nil RequestStore.clear!
# to avoid having users from one spec present in the next
::User.instance_variable_set(:@current_user, nil)
end end
# We don't want this to be reported on CI as it breaks the build # We don't want this to be reported on CI as it breaks the build

Loading…
Cancel
Save