2019-10-17 02:07:30 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-01-30 17:42:02 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-01-16 16:13:14 -05:00
|
|
|
describe 'Projects (JavaScript fixtures)', type: :controller do
|
2017-01-30 17:42:02 -05:00
|
|
|
include JavaScriptFixturesHelpers
|
|
|
|
|
2019-02-21 11:55:14 -05:00
|
|
|
runners_token = 'runnerstoken:intabulasreferre'
|
|
|
|
|
2017-01-30 17:42:02 -05:00
|
|
|
let(:admin) { create(:admin) }
|
|
|
|
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
|
2019-02-21 11:55:14 -05:00
|
|
|
let(:project) { create(:project, namespace: namespace, path: 'builds-project', runners_token: runners_token) }
|
2018-09-06 03:27:39 -04:00
|
|
|
let(:project_with_repo) { create(:project, :repository, description: 'Code and stuff') }
|
2019-02-21 11:55:14 -05:00
|
|
|
let(:project_variable_populated) { create(:project, namespace: namespace, path: 'builds-project2', runners_token: runners_token) }
|
2017-01-30 17:42:02 -05:00
|
|
|
|
|
|
|
render_views
|
|
|
|
|
|
|
|
before(:all) do
|
|
|
|
clean_frontend_fixtures('projects/')
|
|
|
|
end
|
|
|
|
|
2017-08-10 18:31:42 -04:00
|
|
|
before do
|
2018-07-11 10:36:08 -04:00
|
|
|
project.add_maintainer(admin)
|
2017-01-30 17:42:02 -05:00
|
|
|
sign_in(admin)
|
2019-02-21 11:55:14 -05:00
|
|
|
allow(SecureRandom).to receive(:hex).and_return('securerandomhex:thereisnospoon')
|
2017-01-30 17:42:02 -05:00
|
|
|
end
|
|
|
|
|
2017-08-22 19:19:35 -04:00
|
|
|
after do
|
|
|
|
remove_repository(project)
|
|
|
|
end
|
|
|
|
|
2018-01-16 16:13:14 -05:00
|
|
|
describe ProjectsController, '(JavaScript fixtures)', type: :controller do
|
2019-04-21 06:58:07 -04:00
|
|
|
it 'projects/dashboard.html' do
|
2018-12-19 14:50:20 -05:00
|
|
|
get :show, params: {
|
2018-01-16 16:13:14 -05:00
|
|
|
namespace_id: project.namespace.to_param,
|
|
|
|
id: project
|
2018-12-19 14:50:20 -05:00
|
|
|
}
|
2017-01-30 17:42:02 -05:00
|
|
|
|
2019-07-17 18:15:53 -04:00
|
|
|
expect(response).to be_successful
|
2018-01-16 16:13:14 -05:00
|
|
|
end
|
|
|
|
|
2019-04-21 06:58:07 -04:00
|
|
|
it 'projects/overview.html' do
|
2018-12-19 14:50:20 -05:00
|
|
|
get :show, params: {
|
2018-09-06 03:27:39 -04:00
|
|
|
namespace_id: project_with_repo.namespace.to_param,
|
|
|
|
id: project_with_repo
|
2018-12-19 14:50:20 -05:00
|
|
|
}
|
2018-09-06 03:27:39 -04:00
|
|
|
|
2019-07-17 18:15:53 -04:00
|
|
|
expect(response).to be_successful
|
2018-09-06 03:27:39 -04:00
|
|
|
end
|
|
|
|
|
2019-04-21 06:58:07 -04:00
|
|
|
it 'projects/edit.html' do
|
2018-12-19 14:50:20 -05:00
|
|
|
get :edit, params: {
|
2018-01-16 16:13:14 -05:00
|
|
|
namespace_id: project.namespace.to_param,
|
|
|
|
id: project
|
2018-12-19 14:50:20 -05:00
|
|
|
}
|
2018-01-16 16:13:14 -05:00
|
|
|
|
2019-07-17 18:15:53 -04:00
|
|
|
expect(response).to be_successful
|
2018-01-16 16:13:14 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe Projects::Settings::CiCdController, '(JavaScript fixtures)', type: :controller do
|
2019-04-21 06:58:07 -04:00
|
|
|
it 'projects/ci_cd_settings.html' do
|
2018-12-19 14:50:20 -05:00
|
|
|
get :show, params: {
|
2018-01-16 16:13:14 -05:00
|
|
|
namespace_id: project.namespace.to_param,
|
|
|
|
project_id: project
|
2018-12-19 14:50:20 -05:00
|
|
|
}
|
2018-01-16 16:13:14 -05:00
|
|
|
|
2019-07-17 18:15:53 -04:00
|
|
|
expect(response).to be_successful
|
2018-01-16 16:13:14 -05:00
|
|
|
end
|
|
|
|
|
2019-04-21 06:58:07 -04:00
|
|
|
it 'projects/ci_cd_settings_with_variables.html' do
|
2019-02-21 11:55:14 -05:00
|
|
|
create(:ci_variable, project: project_variable_populated)
|
|
|
|
create(:ci_variable, project: project_variable_populated)
|
|
|
|
|
2018-12-19 14:50:20 -05:00
|
|
|
get :show, params: {
|
2018-01-16 16:13:14 -05:00
|
|
|
namespace_id: project_variable_populated.namespace.to_param,
|
|
|
|
project_id: project_variable_populated
|
2018-12-19 14:50:20 -05:00
|
|
|
}
|
2018-01-16 16:13:14 -05:00
|
|
|
|
2019-07-17 18:15:53 -04:00
|
|
|
expect(response).to be_successful
|
2018-01-16 16:13:14 -05:00
|
|
|
end
|
2017-01-30 17:42:02 -05:00
|
|
|
end
|
|
|
|
end
|