Commit fdabcf35 authored by Rémy Coutable's avatar Rémy Coutable

Fix a flaky 'Projects::TracingsController' test

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 07bd816e
...@@ -9,30 +9,36 @@ describe Projects::TracingsController do ...@@ -9,30 +9,36 @@ describe Projects::TracingsController do
shared_examples 'user with read access' do |visibility_level| shared_examples 'user with read access' do |visibility_level|
let(:project) { create(:project, visibility_level) } let(:project) { create(:project, visibility_level) }
before do %w[developer maintainer].each do |role|
project.add_maintainer(user) context "with a #{visibility_level} project and #{role} role" do
end before do
project.add_role(user, role)
end
it 'renders OK' do it 'renders OK' do
get :show, params: { namespace_id: project.namespace, project_id: project } get :show, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:show) expect(response).to render_template(:show)
end
end
end end
end end
shared_examples 'user without read access' do |visibility_level| shared_examples 'user without read access' do |visibility_level|
let(:project) { create(:project, visibility_level) } let(:project) { create(:project, visibility_level) }
%w[guest reporter developer].each do |role| %w[guest reporter].each do |role|
before do context "with a #{visibility_level} project and #{role} role" do
project.public_send("add_#{role}", user) before do
end project.add_role(user, role)
end
it 'returns 404' do it 'returns 404' do
get :show, params: { namespace_id: project.namespace, project_id: project } get :show, params: { namespace_id: project.namespace, project_id: project }
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
end
end end
end end
end end
......
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