Order-dependent spec failure in 11-9-stable-ee: ee/spec/features/users/login_spec.rb
As seen in 11-9-stable-ee in https://dev.gitlab.org/gitlab/gitlab-ee/-/jobs/4480142:
Failures:
1) Login creates a security event for an invalid OAuth login
Failure/Error:
context.env_config.deep_dup.tap do |env|
allow(context).to receive(:env_config).and_return(env)
end
#<InstanceDouble(OneLogin::RubySaml::Response) (anonymous)> was originally created in one example but has leaked into another example and can no longer be used. rspec-mocks' doubles are designed to only last for one example, and you need to create a new one in each example you wish to use it for.
# ./spec/support/helpers/devise_helpers.rb:15:in `env_from_context'
# ./spec/support/helpers/devise_helpers.rb:5:in `set_devise_mapping'
# ./spec/support/helpers/login_helpers.rb:164:in `stub_omniauth_saml_config'
# ./ee/spec/features/users/login_spec.rb:19:in `block (2 levels) in <top (required)>'
Finished in 14 minutes 30 seconds (files took 15.26 seconds to load)
1155 examples, 1 failure, 53 pending
Failed examples:
rspec ./ee/spec/features/users/login_spec.rb:18 # Login creates a security event for an invalid OAuth login
This can be reproduced via:
bundle exec rspec ee/spec/controllers/groups/omniauth_callbacks_controller_spec.rb ./ee/spec/features/users/login_spec.rb
Edited by Stan Hu