Commit 406444b4 authored by Darby Frey's avatar Darby Frey

Updated secure_files_controller specs

parent 972a96d1
......@@ -11,6 +11,6 @@ class Projects::Ci::SecureFilesController < Projects::ApplicationController
private
def check_can_collaborate!
render_404 unless can_collaborate_with_project?(@project)
render_404 unless can_collaborate_with_project?(project)
end
end
......@@ -3,18 +3,15 @@
require 'spec_helper'
RSpec.describe Projects::Ci::SecureFilesController do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) }
subject(:show_request) { get :show, params: { namespace_id: project.namespace, project_id: project } }
before do
sign_in(user)
end
describe 'GET #show' do
context 'with enough privileges' do
before do
sign_in(user)
project.add_developer(user)
show_request
end
......@@ -28,6 +25,7 @@ RSpec.describe Projects::Ci::SecureFilesController do
context 'without enough privileges' do
before do
sign_in(user)
project.add_reporter(user)
show_request
end
......@@ -36,5 +34,16 @@ RSpec.describe Projects::Ci::SecureFilesController do
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'an unauthenticated user' do
before do
show_request
end
it 'redirects to sign in' do
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to('/users/sign_in')
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Secure Files', :js do
let(:project) { create(:project) }
let(:user) { create(:user) }
before do
project.add_maintainer(user)
sign_in(user)
visit project_ci_secure_files_path(project)
end
it 'user sees the Secure Files list component' do
expect(page).to have_content('There are no records to show')
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