2021-01-29 00:20:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe Projects::TerraformController do
|
2021-02-22 17:27:13 +05:30
|
|
|
let_it_be(:project) { create(:project, :public) }
|
2021-01-29 00:20:46 +05:30
|
|
|
|
|
|
|
describe 'GET index' do
|
|
|
|
subject { get :index, params: { namespace_id: project.namespace, project_id: project } }
|
|
|
|
|
|
|
|
context 'when user is authorized' do
|
|
|
|
let(:user) { project.creator }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'renders content' do
|
|
|
|
expect(response).to be_successful
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when user is unauthorized' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.add_guest(user)
|
|
|
|
sign_in(user)
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows 404' do
|
|
|
|
expect(response).to have_gitlab_http_status(:not_found)
|
|
|
|
end
|
|
|
|
end
|
2021-02-22 17:27:13 +05:30
|
|
|
|
|
|
|
context 'when no user is present' do
|
|
|
|
before do
|
|
|
|
subject
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows 404' do
|
|
|
|
expect(response).to have_gitlab_http_status(:not_found)
|
|
|
|
end
|
|
|
|
end
|
2021-01-29 00:20:46 +05:30
|
|
|
end
|
|
|
|
end
|