OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Modify `AuthenticationHelpers` to set the session cookie directly on the driver
Aaron Contreras4423ab5511fb
diff --git a/spec/support/authentication_helpers.rb b/spec/support/authentication_helpers.rbindex 1a632459aeb..a192e46ada1 100644--- a/spec/support/authentication_helpers.rb+++ b/spec/support/authentication_helpers.rb@@ -39,7 +39,14 @@ module AuthenticationHelpers# we must set the user_id in rack.session accordingly# Otherwise e.g. calls to Warden will behave unexpectantly# as they will login AnonymousUser- page.set_rack_session(user_id: user.id, updated_at: Time.now)+ if using_cuprite?+ page.driver.set_cookie(+ OpenProject::Configuration['session_cookie_name'],+ session_value_for(user).to_s+ )+ else+ page.set_rack_session(session_value_for(user))+ endendallow(User).to receive(:current).and_return(user)@@ -57,7 +64,21 @@ module AuthenticationHelpersenddef logout- visit signout_path+ if using_cuprite?+ page.driver.cookies.clear+ else+ visit signout_path+ end+ end++ private++ def using_cuprite?+ RSpec.current_example.metadata[:with_cuprite]+ end++ def session_value_for(user)+ { user_id: user.id, updated_at: Time.current }endmodule ClassMethods