Skip to content
代码片段 群组 项目
未验证 提交 34e5bfea 编辑于 作者: Thong Kuah's avatar Thong Kuah 提交者: GitLab
浏览文件

Merge branch '474831-rest-api-current_organization' into 'master'

Ensure Current.organization is set in REST API

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/161008



Merged-by: default avatarThong Kuah <tkuah@gitlab.com>
Approved-by: default avatarAlex Pooley <apooley@gitlab.com>
Approved-by: default avatarThong Kuah <tkuah@gitlab.com>
Co-authored-by: default avatarRutger Wessels <rwessels@gitlab.com>
No related branches found
No related tags found
无相关合并请求
......@@ -90,6 +90,13 @@ def initialize(location_url)
)
end
before do
::Current.organization = Gitlab::Current::Organization.new(
params: {},
user: @current_user
).organization
end
before do
set_peek_enabled_for_current_request
end
......
......@@ -421,4 +421,22 @@
expect(response).to have_gitlab_http_status(:bad_request)
end
end
describe 'Current Organization' do
let_it_be(:current_organization) { create(:organization) }
before do
allow_next_instance_of(Gitlab::Current::Organization) do |instance|
allow(instance).to receive(:organization).and_return(current_organization)
end
end
it 'sets Current Organization' do
# Test for new value of Current.organization won't work because
# it will be reset after the request is processed.
expect(Current).to receive(:organization=).with(current_organization)
get api('/groups')
end
end
end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册