Commit 613f64a0 authored by Lin Jen-Shin's avatar Lin Jen-Shin

RegistrationsController#create cannot record the user

This is because `auth_user` is memoized as `nil` and even
after the new user is created, there's no easy way to update
the current context with the newly created user.

It's passing before because rspec-retry will post again,
which then it memoized the current user from previous request.
parent 5e37b060
...@@ -499,13 +499,12 @@ RSpec.describe RegistrationsController do ...@@ -499,13 +499,12 @@ RSpec.describe RegistrationsController do
expect(User.last.name).to eq("#{base_user_params[:first_name]} #{base_user_params[:last_name]}") expect(User.last.name).to eq("#{base_user_params[:first_name]} #{base_user_params[:last_name]}")
end end
it 'sets the username and caller_id in the context' do it 'sets the caller_id in the context' do
expect(controller).to receive(:create).and_wrap_original do |m, *args| expect(controller).to receive(:create).and_wrap_original do |m, *args|
m.call(*args) m.call(*args)
expect(Gitlab::ApplicationContext.current) expect(Gitlab::ApplicationContext.current)
.to include('meta.user' => base_user_params[:username], .to include('meta.caller_id' => 'RegistrationsController#create')
'meta.caller_id' => 'RegistrationsController#create')
end end
subject subject
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment