Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
30c78e70
Commit
30c78e70
authored
Sep 28, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP
parent
1530f68c
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
154 additions
and
135 deletions
+154
-135
app/controllers/ci/application_controller.rb
app/controllers/ci/application_controller.rb
+4
-4
app/models/ci/build.rb
app/models/ci/build.rb
+1
-2
app/models/ci/commit.rb
app/models/ci/commit.rb
+5
-5
app/models/ci/project.rb
app/models/ci/project.rb
+16
-13
app/models/project.rb
app/models/project.rb
+1
-0
db/schema.rb
db/schema.rb
+43
-37
spec/controllers/ci/commits_controller_spec.rb
spec/controllers/ci/commits_controller_spec.rb
+4
-8
spec/factories/ci/commits.rb
spec/factories/ci/commits.rb
+2
-0
spec/factories/ci/projects.rb
spec/factories/ci/projects.rb
+1
-1
spec/features/ci/admin/builds_spec.rb
spec/features/ci/admin/builds_spec.rb
+1
-2
spec/features/ci/builds_spec.rb
spec/features/ci/builds_spec.rb
+10
-9
spec/features/ci/commits_spec.rb
spec/features/ci/commits_spec.rb
+6
-5
spec/mailers/ci/notify_spec.rb
spec/mailers/ci/notify_spec.rb
+1
-2
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+2
-1
spec/models/ci/commit_spec.rb
spec/models/ci/commit_spec.rb
+13
-10
spec/models/ci/mail_service_spec.rb
spec/models/ci/mail_service_spec.rb
+12
-6
spec/models/ci/project_services/hip_chat_service_spec.rb
spec/models/ci/project_services/hip_chat_service_spec.rb
+1
-2
spec/models/ci/project_services/slack_service_spec.rb
spec/models/ci/project_services/slack_service_spec.rb
+1
-2
spec/models/ci/project_spec.rb
spec/models/ci/project_spec.rb
+2
-1
spec/models/ci/service_spec.rb
spec/models/ci/service_spec.rb
+1
-2
spec/requests/ci/api/builds_spec.rb
spec/requests/ci/api/builds_spec.rb
+9
-7
spec/requests/ci/api/commits_spec.rb
spec/requests/ci/api/commits_spec.rb
+2
-1
spec/requests/ci/api/triggers_spec.rb
spec/requests/ci/api/triggers_spec.rb
+2
-1
spec/requests/ci/builds_spec.rb
spec/requests/ci/builds_spec.rb
+1
-2
spec/requests/ci/commits_spec.rb
spec/requests/ci/commits_spec.rb
+1
-2
spec/services/ci/create_trigger_request_service_spec.rb
spec/services/ci/create_trigger_request_service_spec.rb
+6
-5
spec/services/ci/image_for_build_service_spec.rb
spec/services/ci/image_for_build_service_spec.rb
+2
-1
spec/services/ci/register_build_service_spec.rb
spec/services/ci/register_build_service_spec.rb
+2
-3
spec/services/ci/web_hook_service_spec.rb
spec/services/ci/web_hook_service_spec.rb
+2
-1
No files found.
app/controllers/ci/application_controller.rb
View file @
30c78e70
...
...
@@ -11,10 +11,10 @@ module Ci
private
def
check_enable_flag!
unless
current_application_settings
.
ci_enabled
redirect_to
(
disabled_ci_projects_path
)
return
end
#
unless current_application_settings.ci_enabled
#
redirect_to(disabled_ci_projects_path)
#
return
#
end
end
def
authenticate_public_page!
...
...
app/models/ci/build.rb
View file @
30c78e70
...
...
@@ -79,7 +79,6 @@ module Ci
new_build
.
commands
=
build
.
commands
new_build
.
tag_list
=
build
.
tag_list
new_build
.
commit_id
=
build
.
commit_id
new_build
.
project_id
=
build
.
project_id
new_build
.
name
=
build
.
name
new_build
.
allow_failure
=
build
.
allow_failure
new_build
.
stage
=
build
.
stage
...
...
@@ -187,7 +186,7 @@ module Ci
end
def
project_id
commit
.
project
_id
commit
.
gl_project
.
gitlab
_id
end
def
project_name
...
...
app/models/ci/commit.rb
View file @
30c78e70
...
...
@@ -32,14 +32,15 @@ module Ci
sha
[
0
...
8
]
end
def
project
@project
||=
gl_project
.
gitlab_ci_project
end
def
to_param
sha
end
def
project
@project
||=
gl_project
.
gitlab_ci_project
@project
||=
gl_project
.
create_gitlab_ci_project
end
def
last_build
builds
.
order
(
:id
).
last
end
...
...
@@ -115,7 +116,6 @@ module Ci
builds_attrs
=
config_processor
.
builds_for_stage_and_ref
(
stage
,
ref
,
tag
)
builds_attrs
.
map
do
|
build_attrs
|
builds
.
create!
({
project:
project
,
name:
build_attrs
[
:name
],
commands:
build_attrs
[
:script
],
tag_list:
build_attrs
[
:tags
],
...
...
app/models/ci/project.rb
View file @
30c78e70
...
...
@@ -33,15 +33,12 @@ module Ci
belongs_to
:gl_project
,
class_name:
'::Project'
,
foreign_key: :gitlab_id
has_many
:commits
,
through: :gl_project
,
class_name:
'Ci::Commit'
,
foreign_key: :gl_project_id
has_many
:builds
,
through: :commits
,
dependent: :destroy
,
class_name:
'Ci::Build'
has_many
:runner_projects
,
dependent: :destroy
,
class_name:
'Ci::RunnerProject'
has_many
:runners
,
through: :runner_projects
,
class_name:
'Ci::Runner'
has_many
:web_hooks
,
dependent: :destroy
,
class_name:
'Ci::WebHook'
has_many
:events
,
dependent: :destroy
,
class_name:
'Ci::Event'
has_many
:variables
,
dependent: :destroy
,
class_name:
'Ci::Variable'
has_many
:triggers
,
dependent: :destroy
,
class_name:
'Ci::Trigger'
has_one
:last_commit
,
through: :gl_project
,
class_name:
'Ci::Commit'
# Project services
has_many
:services
,
dependent: :destroy
,
class_name:
'Ci::Service'
...
...
@@ -51,17 +48,19 @@ module Ci
accepts_nested_attributes_for
:variables
,
allow_destroy:
true
delegate
:commits
,
:builds
,
:last_commit
,
to: :gl_project
#
# Validations
#
validates_presence_of
:name
,
:timeout
,
:token
,
:default_ref
,
:path
,
:ssh_url_to_repo
,
:gitlab_id
:path
,
:ssh_url_to_repo
,
:gitlab_id
validates_uniqueness_of
:gitlab_id
validates
:polling_interval
,
presence:
true
,
if:
->
(
project
)
{
project
.
always_build
.
present?
}
presence:
true
,
if:
->
(
project
)
{
project
.
always_build
.
present?
}
scope
:public_only
,
->
()
{
where
(
public:
true
)
}
...
...
@@ -79,12 +78,12 @@ module Ci
def
parse
(
project
)
params
=
{
name:
project
.
name_with_namespace
,
gitlab_id:
project
.
id
,
path:
project
.
path_with_namespace
,
default_ref:
project
.
default_branch
||
'master'
,
ssh_url_to_repo:
project
.
ssh_url_to_repo
,
email_add_pusher:
current_application_settings
.
add_pusher
,
name:
project
.
name_with_namespace
,
gitlab_id:
project
.
id
,
path:
project
.
path_with_namespace
,
default_ref:
project
.
default_branch
||
'master'
,
ssh_url_to_repo:
project
.
ssh_url_to_repo
,
email_add_pusher:
current_application_settings
.
add_pusher
,
email_only_broken_builds:
current_application_settings
.
all_broken_builds
,
}
...
...
@@ -125,10 +124,14 @@ module Ci
def
set_default_values
self
.
token
=
SecureRandom
.
hex
(
15
)
if
self
.
token
.
blank?
self
.
default_ref
||=
'master'
self
.
name
||=
gl_project
.
name_with_namespace
self
.
path
||=
gl_project
.
path_with_namespace
self
.
ssh_url_to_repo
||=
gl_project
.
ssh_url_to_repo
end
def
tracked_refs
@tracked_refs
||=
default_ref
.
split
(
","
).
map
{
|
ref
|
ref
.
strip
}
@tracked_refs
||=
default_ref
.
split
(
","
).
map
{
|
ref
|
ref
.
strip
}
end
def
valid_token?
token
...
...
app/models/project.rb
View file @
30c78e70
...
...
@@ -119,6 +119,7 @@ class Project < ActiveRecord::Base
has_many
:users_star_projects
,
dependent: :destroy
has_many
:starrers
,
through: :users_star_projects
,
source: :user
has_many
:commits
,
->
()
{
order
(
'CASE WHEN ci_commits.committed_at IS NULL THEN 0 ELSE 1 END'
,
:committed_at
,
:id
)
},
dependent: :destroy
,
class_name:
'Ci::Commit'
,
foreign_key: :gl_project_id
has_many
:builds
,
through: :commits
,
dependent: :destroy
,
class_name:
'Ci::Build'
has_one
:last_commit
,
->
{
order
'ci_commits.created_at DESC'
},
class_name:
'Ci::Commit'
,
foreign_key: :gl_project_id
has_one
:import_data
,
dependent: :destroy
,
class_name:
"ProjectImportData"
...
...
db/schema.rb
View file @
30c78e70
...
...
@@ -11,10 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
20150920161119
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
ActiveRecord
::
Schema
.
define
(
version:
20150924131004
)
do
create_table
"abuse_reports"
,
force:
true
do
|
t
|
t
.
integer
"reporter_id"
...
...
@@ -45,8 +42,8 @@ ActiveRecord::Schema.define(version: 20150920161119) do
t
.
string
"after_sign_out_path"
t
.
integer
"session_expire_delay"
,
default:
10080
,
null:
false
t
.
text
"import_sources"
t
.
text
"help_page_text"
t
.
boolean
"ci_enabled"
,
default:
true
,
null:
false
t
.
text
"help_page_text"
end
create_table
"audit_events"
,
force:
true
do
|
t
|
...
...
@@ -85,21 +82,22 @@ ActiveRecord::Schema.define(version: 20150920161119) do
t
.
integer
"project_id"
t
.
string
"status"
t
.
datetime
"finished_at"
t
.
text
"trace"
t
.
text
"trace"
,
limit:
2147483647
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
datetime
"started_at"
t
.
integer
"runner_id"
t
.
float
"coverage"
t
.
float
"coverage"
,
limit:
24
t
.
integer
"commit_id"
t
.
text
"commands"
t
.
integer
"job_id"
t
.
string
"name"
t
.
boolean
"deploy"
,
default:
false
t
.
boolean
"deploy"
,
default:
false
t
.
text
"options"
t
.
boolean
"allow_failure"
,
default:
false
,
null:
false
t
.
boolean
"allow_failure"
,
default:
false
,
null:
false
t
.
string
"stage"
t
.
integer
"trigger_request_id"
t
.
integer
"gl_project_id"
end
add_index
"ci_builds"
,
[
"commit_id"
],
name:
"index_ci_builds_on_commit_id"
,
using: :btree
...
...
@@ -112,12 +110,13 @@ ActiveRecord::Schema.define(version: 20150920161119) do
t
.
string
"ref"
t
.
string
"sha"
t
.
string
"before_sha"
t
.
text
"push_data"
t
.
text
"push_data"
,
limit:
16777215
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
boolean
"tag"
,
default:
false
t
.
boolean
"tag"
,
default:
false
t
.
text
"yaml_errors"
t
.
datetime
"committed_at"
t
.
integer
"gl_project_id"
end
add_index
"ci_commits"
,
[
"project_id"
,
"committed_at"
,
"id"
],
name:
"index_ci_commits_on_project_id_and_committed_at_and_id"
,
using: :btree
...
...
@@ -133,6 +132,7 @@ ActiveRecord::Schema.define(version: 20150920161119) do
t
.
text
"description"
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
integer
"gl_project_id"
end
add_index
"ci_events"
,
[
"created_at"
],
name:
"index_ci_events_on_created_at"
,
using: :btree
...
...
@@ -180,10 +180,11 @@ ActiveRecord::Schema.define(version: 20150920161119) do
end
create_table
"ci_runner_projects"
,
force:
true
do
|
t
|
t
.
integer
"runner_id"
,
null:
false
t
.
integer
"project_id"
,
null:
false
t
.
integer
"runner_id"
,
null:
false
t
.
integer
"project_id"
,
null:
false
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
integer
"gl_project_id"
end
add_index
"ci_runner_projects"
,
[
"project_id"
],
name:
"index_ci_runner_projects_on_project_id"
,
using: :btree
...
...
@@ -207,11 +208,12 @@ ActiveRecord::Schema.define(version: 20150920161119) do
create_table
"ci_services"
,
force:
true
do
|
t
|
t
.
string
"type"
t
.
string
"title"
t
.
integer
"project_id"
,
null:
false
t
.
integer
"project_id"
,
null:
false
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
boolean
"active"
,
default:
false
,
null:
false
t
.
boolean
"active"
,
default:
false
,
null:
false
t
.
text
"properties"
t
.
integer
"gl_project_id"
end
add_index
"ci_services"
,
[
"project_id"
],
name:
"index_ci_services_on_project_id"
,
using: :btree
...
...
@@ -256,10 +258,11 @@ ActiveRecord::Schema.define(version: 20150920161119) do
create_table
"ci_triggers"
,
force:
true
do
|
t
|
t
.
string
"token"
t
.
integer
"project_id"
,
null:
false
t
.
integer
"project_id"
,
null:
false
t
.
datetime
"deleted_at"
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
integer
"gl_project_id"
end
add_index
"ci_triggers"
,
[
"deleted_at"
],
name:
"index_ci_triggers_on_deleted_at"
,
using: :btree
...
...
@@ -271,15 +274,17 @@ ActiveRecord::Schema.define(version: 20150920161119) do
t
.
text
"encrypted_value"
t
.
string
"encrypted_value_salt"
t
.
string
"encrypted_value_iv"
t
.
integer
"gl_project_id"
end
add_index
"ci_variables"
,
[
"project_id"
],
name:
"index_ci_variables_on_project_id"
,
using: :btree
create_table
"ci_web_hooks"
,
force:
true
do
|
t
|
t
.
string
"url"
,
null:
false
t
.
integer
"project_id"
,
null:
false
t
.
string
"url"
,
null:
false
t
.
integer
"project_id"
,
null:
false
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
integer
"gl_project_id"
end
create_table
"deploy_keys_projects"
,
force:
true
do
|
t
|
...
...
@@ -425,9 +430,9 @@ ActiveRecord::Schema.define(version: 20150920161119) do
create_table
"merge_request_diffs"
,
force:
true
do
|
t
|
t
.
string
"state"
t
.
text
"st_commits"
t
.
text
"st_diffs"
t
.
integer
"merge_request_id"
,
null:
false
t
.
text
"st_commits"
,
limit:
2147483647
t
.
text
"st_diffs"
,
limit:
2147483647
t
.
integer
"merge_request_id"
,
null:
false
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
end
...
...
@@ -509,8 +514,8 @@ ActiveRecord::Schema.define(version: 20150920161119) do
t
.
string
"line_code"
t
.
string
"commit_id"
t
.
integer
"noteable_id"
t
.
boolean
"system"
,
default:
false
,
null:
false
t
.
text
"st_diff"
t
.
boolean
"system"
,
default:
false
,
null:
false
t
.
text
"st_diff"
,
limit:
2147483647
t
.
integer
"updated_by_id"
end
...
...
@@ -579,25 +584,26 @@ ActiveRecord::Schema.define(version: 20150920161119) do
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
integer
"creator_id"
t
.
boolean
"issues_enabled"
,
default:
true
,
null:
false
t
.
boolean
"wall_enabled"
,
default:
true
,
null:
false
t
.
boolean
"merge_requests_enabled"
,
default:
true
,
null:
false
t
.
boolean
"wiki_enabled"
,
default:
true
,
null:
false
t
.
boolean
"issues_enabled"
,
default:
true
,
null:
false
t
.
boolean
"wall_enabled"
,
default:
true
,
null:
false
t
.
boolean
"merge_requests_enabled"
,
default:
true
,
null:
false
t
.
boolean
"wiki_enabled"
,
default:
true
,
null:
false
t
.
integer
"namespace_id"
t
.
string
"issues_tracker"
,
default:
"gitlab"
,
null:
false
t
.
string
"issues_tracker"
,
default:
"gitlab"
,
null:
false
t
.
string
"issues_tracker_id"
t
.
boolean
"snippets_enabled"
,
default:
true
,
null:
false
t
.
boolean
"snippets_enabled"
,
default:
true
,
null:
false
t
.
datetime
"last_activity_at"
t
.
string
"import_url"
t
.
integer
"visibility_level"
,
default:
0
,
null:
false
t
.
boolean
"archived"
,
default:
false
,
null:
false
t
.
integer
"visibility_level"
,
default:
0
,
null:
false
t
.
boolean
"archived"
,
default:
false
,
null:
false
t
.
string
"avatar"
t
.
string
"import_status"
t
.
float
"repository_size"
,
default:
0.0
t
.
integer
"star_count"
,
default:
0
,
null:
false
t
.
float
"repository_size"
,
limit:
24
,
default:
0.0
t
.
integer
"star_count"
,
default:
0
,
null:
false
t
.
string
"import_type"
t
.
string
"import_source"
t
.
integer
"commit_count"
,
default:
0
t
.
integer
"commit_count"
,
default:
0
t
.
boolean
"shared_runners_enabled"
,
default:
false
end
add_index
"projects"
,
[
"created_at"
,
"id"
],
name:
"index_projects_on_created_at_and_id"
,
using: :btree
...
...
@@ -649,15 +655,15 @@ ActiveRecord::Schema.define(version: 20150920161119) do
create_table
"snippets"
,
force:
true
do
|
t
|
t
.
string
"title"
t
.
text
"content"
t
.
integer
"author_id"
,
null:
false
t
.
text
"content"
,
limit:
2147483647
t
.
integer
"author_id"
,
null:
false
t
.
integer
"project_id"
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
string
"file_name"
t
.
datetime
"expires_at"
t
.
string
"type"
t
.
integer
"visibility_level"
,
default:
0
,
null:
false
t
.
integer
"visibility_level"
,
default:
0
,
null:
false
end
add_index
"snippets"
,
[
"author_id"
],
name:
"index_snippets_on_author_id"
,
using: :btree
...
...
spec/controllers/ci/commits_controller_spec.rb
View file @
30c78e70
require
"spec_helper"
describe
Ci
::
CommitsController
do
before
do
@project
=
FactoryGirl
.
create
:ci_project
end
describe
"GET /status"
do
it
"returns status of commit"
do
commit
=
FactoryGirl
.
create
:ci_commit
,
project:
@project
get
:status
,
id:
commit
.
sha
,
ref_id:
commit
.
ref
,
project_id:
@
project
.
id
commit
=
FactoryGirl
.
create
:ci_commit
get
:status
,
id:
commit
.
sha
,
ref_id:
commit
.
ref
,
project_id:
commit
.
project
.
id
expect
(
response
).
to
be_success
expect
(
response
.
code
).
to
eq
(
'200'
)
...
...
@@ -16,8 +12,8 @@ describe Ci::CommitsController do
end
it
"returns not_found status"
do
commit
=
FactoryGirl
.
create
:ci_commit
,
project:
@project
get
:status
,
id:
commit
.
sha
,
ref_id:
"deploy"
,
project_id:
@
project
.
id
commit
=
FactoryGirl
.
create
:ci_commit
get
:status
,
id:
commit
.
sha
,
ref_id:
"deploy"
,
project_id:
commit
.
project
.
id
expect
(
response
).
to
be_success
expect
(
response
.
code
).
to
eq
(
'200'
)
...
...
spec/factories/ci/commits.rb
View file @
30c78e70
...
...
@@ -51,6 +51,8 @@ FactoryGirl.define do
}
end
gl_project
factory: :empty_project
factory
:ci_commit_without_jobs
do
after
(
:create
)
do
|
commit
,
evaluator
|
commit
.
push_data
[
:ci_yaml_file
]
=
YAML
.
dump
({})
...
...
spec/factories/ci/projects.rb
View file @
30c78e70
...
...
@@ -43,7 +43,7 @@ FactoryGirl.define do
"git@demo.gitlab.com:gitlab/gitlab-shell
#{
n
}
.git"
end
gl_project
factory: :project
gl_project
factory: :
empty_
project
factory
:ci_project
do
token
'iPWx6WM4lhHNedGfBpPJNP'
...
...
spec/features/ci/admin/builds_spec.rb
View file @
30c78e70
require
'spec_helper'
describe
"Admin Builds"
do
let
(
:project
)
{
FactoryGirl
.
create
:ci_project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
}
let
(
:build
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
}
before
do
...
...
spec/features/ci/builds_spec.rb
View file @
30c78e70
...
...
@@ -3,16 +3,15 @@ require 'spec_helper'
describe
"Builds"
do
context
:private_project
do
before
do
@project
=
FactoryGirl
.
create
:ci_project
@commit
=
FactoryGirl
.
create
:ci_commit
,
project:
@project
@commit
=
FactoryGirl
.
create
:ci_commit
@build
=
FactoryGirl
.
create
:ci_build
,
commit:
@commit
login_as
:user
@project
.
gl_project
.
team
<<
[
@user
,
:master
]
@
commit
.
project
.
gl_project
.
team
<<
[
@user
,
:master
]
end
describe
"GET /:project/builds/:id"
do
before
do
visit
ci_project_build_path
(
@project
,
@build
)
visit
ci_project_build_path
(
@
commit
.
project
,
@build
)
end
it
{
expect
(
page
).
to
have_content
@commit
.
sha
[
0
..
7
]
}
...
...
@@ -23,7 +22,7 @@ describe "Builds" do
describe
"GET /:project/builds/:id/cancel"
do
before
do
@build
.
run!
visit
cancel_ci_project_build_path
(
@project
,
@build
)
visit
cancel_ci_project_build_path
(
@
commit
.
project
,
@build
)
end
it
{
expect
(
page
).
to
have_content
'canceled'
}
...
...
@@ -33,7 +32,7 @@ describe "Builds" do
describe
"POST /:project/builds/:id/retry"
do
before
do
@build
.
cancel!
visit
ci_project_build_path
(
@project
,
@build
)
visit
ci_project_build_path
(
@
commit
.
project
,
@build
)
click_link
'Retry'
end
...
...
@@ -45,13 +44,15 @@ describe "Builds" do
context
:public_project
do
describe
"Show page public accessible"
do
before
do
@project
=
FactoryGirl
.
create
:ci_public_project
@commit
=
FactoryGirl
.
create
:ci_commit
,
project:
@project
@commit
=
FactoryGirl
.
create
:ci_commit
@commit
.
project
.
public
=
true
@commit
.
project
.
save
@runner
=
FactoryGirl
.
create
:ci_specific_runner
@build
=
FactoryGirl
.
create
:ci_build
,
commit:
@commit
,
runner:
@runner
stub_gitlab_calls
visit
ci_project_build_path
(
@project
,
@build
)
visit
ci_project_build_path
(
@
commit
.
project
,
@build
)
end
it
{
expect
(
page
).
to
have_content
@commit
.
sha
[
0
..
7
]
}
...
...
spec/features/ci/commits_spec.rb
View file @
30c78e70
...
...
@@ -5,11 +5,10 @@ describe "Commits" do
context
"Authenticated user"
do
before
do
@project
=
FactoryGirl
.
create
:ci_project
@commit
=
FactoryGirl
.
create
:ci_commit
,
project:
@project
@commit
=
FactoryGirl
.
create
:ci_commit
@build
=
FactoryGirl
.
create
:ci_build
,
commit:
@commit
login_as
:user
@project
.
gl_project
.
team
<<
[
@user
,
:master
]
@
commit
.
project
.
gl_project
.
team
<<
[
@user
,
:master
]
end
describe
"GET /:project/commits/:sha"
do
...
...
@@ -51,8 +50,10 @@ describe "Commits" do
context
"Public pages"
do
before
do
@project
=
FactoryGirl
.
create
:ci_public_project
@commit
=
FactoryGirl
.
create
:ci_commit
,
project:
@project
@commit
=
FactoryGirl
.
create
:ci_commit
@commit
.
project
.
public
=
true
@commit
.
project
.
save
@build
=
FactoryGirl
.
create
:ci_build
,
commit:
@commit
end
...
...
spec/mailers/ci/notify_spec.rb
View file @
30c78e70
...
...
@@ -5,8 +5,7 @@ describe Ci::Notify do
include
EmailSpec
::
Matchers
before
do
@project
=
FactoryGirl
.
create
:ci_project
@commit
=
FactoryGirl
.
create
:ci_commit
,
project:
@project
@commit
=
FactoryGirl
.
create
:ci_commit
@build
=
FactoryGirl
.
create
:ci_build
,
commit:
@commit
end
...
...
spec/models/ci/build_spec.rb
View file @
30c78e70
...
...
@@ -27,7 +27,8 @@ require 'spec_helper'
describe
Ci
::
Build
do
let
(
:project
)
{
FactoryGirl
.
create
:ci_project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
let
(
:gl_project
)
{
FactoryGirl
.
create
:empty_project
,
gitlab_ci_project:
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
gl_project:
gl_project
}
let
(
:build
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
}
it
{
is_expected
.
to
belong_to
(
:commit
)
}
...
...
spec/models/ci/commit_spec.rb
View file @
30c78e70
...
...
@@ -18,9 +18,8 @@
require
'spec_helper'
describe
Ci
::
Commit
do
let
(
:project
)
{
FactoryGirl
.
create
:ci_project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
let
(
:commit_with_project
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
}
let
(
:commit_with_project
)
{
FactoryGirl
.
create
:ci_commit
}
let
(
:config_processor
)
{
Ci
::
GitlabCiYamlProcessor
.
new
(
gitlab_ci_yaml
)
}
it
{
is_expected
.
to
belong_to
(
:project
)
}
...
...
@@ -65,7 +64,8 @@ describe Ci::Commit do
project
=
FactoryGirl
.
create
:ci_project
,
email_add_pusher:
true
,
email_recipients:
''
commit
=
FactoryGirl
.
create
:ci_commit
,
project:
project
gl_project
=
FactoryGirl
.
create
:empty_project
,
gitlab_ci_project:
project
commit
=
FactoryGirl
.
create
:ci_commit
,
gl_project:
gl_project
expected
=
'commit_pusher_email'
allow
(
commit
).
to
receive
(
:push_data
)
{
{
user_email:
expected
}
}
expect
(
commit
.
project_recipients
).
to
eq
([
expected
])
...
...
@@ -75,7 +75,8 @@ describe Ci::Commit do
project
=
FactoryGirl
.
create
:ci_project
,
email_add_pusher:
true
,
email_recipients:
'rec1 rec2'
commit
=
FactoryGirl
.
create
:ci_commit
,
project:
project
gl_project
=
FactoryGirl
.
create
:empty_project
,
gitlab_ci_project:
project
commit
=
FactoryGirl
.
create
:ci_commit
,
gl_project:
gl_project
expected
=
'commit_pusher_email'
allow
(
commit
).
to
receive
(
:push_data
)
{
{
user_email:
expected
}
}
expect
(
commit
.
project_recipients
).
to
eq
([
'rec1'
,
'rec2'
,
expected
])
...
...
@@ -85,7 +86,8 @@ describe Ci::Commit do
project
=
FactoryGirl
.
create
:ci_project
,
email_add_pusher:
false
,
email_recipients:
'rec1 rec2'
commit
=
FactoryGirl
.
create
:ci_commit
,
project:
project
gl_project
=
FactoryGirl
.
create
:empty_project
,
gitlab_ci_project:
project
commit
=
FactoryGirl
.
create
:ci_commit
,
project:
gl_project
expect
(
commit
.
project_recipients
).
to
eq
([
'rec1'
,
'rec2'
])
end
...
...
@@ -93,7 +95,8 @@ describe Ci::Commit do
project
=
FactoryGirl
.
create
:ci_project
,
email_add_pusher:
true
,
email_recipients:
'rec1 rec1 rec2'
commit
=
FactoryGirl
.
create
:ci_commit
,
project:
project
gl_project
=
FactoryGirl
.
create
:empty_project
,
gitlab_ci_project:
project
commit
=
FactoryGirl
.
create
:ci_commit
,
project:
gl_project
expected
=
'rec2'
allow
(
commit
).
to
receive
(
:push_data
)
{
{
user_email:
expected
}
}
expect
(
commit
.
project_recipients
).
to
eq
([
'rec1'
,
'rec2'
])
...
...
@@ -219,8 +222,7 @@ describe Ci::Commit do
end
describe
"#finished_at"
do
let
(
:project
)
{
FactoryGirl
.
create
:ci_project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
}
it
"returns finished_at of latest build"
do
build
=
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
finished_at:
Time
.
now
-
60
...
...
@@ -238,7 +240,8 @@ describe Ci::Commit do
describe
"coverage"
do
let
(
:project
)
{
FactoryGirl
.
create
:ci_project
,
coverage_regex:
"/.*/"
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
let
(
:gl_project
)
{
FactoryGirl
.
create
:empty_project
,
gitlab_ci_project:
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
gl_project:
gl_project
}
it
"calculates average when there are two builds with coverage"
do
FactoryGirl
.
create
:ci_build
,
name:
"rspec"
,
coverage:
30
,
commit:
commit
...
...
spec/models/ci/mail_service_spec.rb
View file @
30c78e70
...
...
@@ -32,7 +32,8 @@ describe Ci::MailService do
describe
'failed build'
do
let
(
:project
)
{
FactoryGirl
.
create
(
:ci_project
,
email_add_pusher:
true
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
project:
project
)
}
let
(
:gl_project
)
{
FactoryGirl
.
create
(
:empty_project
,
gitlab_ci_project:
project
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
gl_project:
gl_project
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:ci_build
,
status: :failed
,
commit:
commit
)
}
before
do
...
...
@@ -54,7 +55,8 @@ describe Ci::MailService do
describe
'successfull build'
do
let
(
:project
)
{
FactoryGirl
.
create
(
:ci_project
,
email_add_pusher:
true
,
email_only_broken_builds:
false
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
project:
project
)
}
let
(
:gl_project
)
{
FactoryGirl
.
create
(
:empty_project
,
gitlab_ci_project:
project
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
gl_project:
gl_project
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:ci_build
,
status: :success
,
commit:
commit
)
}
before
do
...
...
@@ -81,7 +83,8 @@ describe Ci::MailService do
email_only_broken_builds:
false
,
email_recipients:
"jeroen@example.com"
)
end
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
project:
project
)
}
let
(
:gl_project
)
{
FactoryGirl
.
create
(
:empty_project
,
gitlab_ci_project:
project
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
gl_project:
gl_project
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:ci_build
,
status: :success
,
commit:
commit
)
}
before
do
...
...
@@ -109,7 +112,8 @@ describe Ci::MailService do
email_only_broken_builds:
true
,
email_recipients:
"jeroen@example.com"
)
end
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
project:
project
)
}
let
(
:gl_project
)
{
FactoryGirl
.
create
(
:empty_project
,
gitlab_ci_project:
project
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
gl_project:
gl_project
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:ci_build
,
status: :success
,
commit:
commit
)
}
before
do
...
...
@@ -137,7 +141,8 @@ describe Ci::MailService do
email_only_broken_builds:
false
,
email_recipients:
"jeroen@example.com"
)
end
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
project:
project
)
}
let
(
:gl_project
)
{
FactoryGirl
.
create
(
:empty_project
,
gitlab_ci_project:
project
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
gl_project:
gl_project
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:ci_build
,
status: :success
,
commit:
commit
)
}
before
do
...
...
@@ -159,7 +164,8 @@ describe Ci::MailService do
email_only_broken_builds:
true
,
email_recipients:
"jeroen@example.com"
)
end
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
project:
project
)
}
let
(
:gl_project
)
{
FactoryGirl
.
create
(
:empty_project
,
gitlab_ci_project:
project
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
gl_project:
gl_project
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:ci_build
,
status: :failed
,
commit:
commit
)
}
before
do
...
...
spec/models/ci/project_services/hip_chat_service_spec.rb
View file @
30c78e70
...
...
@@ -33,8 +33,7 @@ describe Ci::HipChatService do
describe
"Execute"
do
let
(
:service
)
{
Ci
::
HipChatService
.
new
}
let
(
:project
)
{
FactoryGirl
.
create
:ci_project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
}
let
(
:build
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
status:
'failed'
}
let
(
:api_url
)
{
'https://api.hipchat.com/v2/room/123/notification?auth_token=a1b2c3d4e5f6'
}
...
...
spec/models/ci/project_services/slack_service_spec.rb
View file @
30c78e70
...
...
@@ -31,8 +31,7 @@ describe Ci::SlackService do
describe
"Execute"
do
let
(
:slack
)
{
Ci
::
SlackService
.
new
}
let
(
:project
)
{
FactoryGirl
.
create
:ci_project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
}
let
(
:build
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
status:
'failed'
}
let
(
:webhook_url
)
{
'https://hooks.slack.com/services/SVRWFV0VVAR97N/B02R25XN3/ZBqu7xMupaEEICInN685'
}
let
(
:notify_only_broken_builds
)
{
false
}
...
...
spec/models/ci/project_spec.rb
View file @
30c78e70
...
...
@@ -81,10 +81,11 @@ describe Ci::Project do
context
:valid_project
do
let
(
:project
)
{
FactoryGirl
.
create
:ci_project
}
let
(
:gl_project
)
{
FactoryGirl
.
create
(
:empty_project
,
gitlab_ci_project:
project
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
gl_project:
gl_project
)
}
context
:project_with_commit_and_builds
do
before
do
commit
=
FactoryGirl
.
create
(
:ci_commit
,
project:
project
)
FactoryGirl
.
create
(
:ci_build
,
commit:
commit
)
end
...
...
spec/models/ci/service_spec.rb
View file @
30c78e70
...
...
@@ -29,8 +29,7 @@ describe Ci::Service do
end
describe
"Testable"
do
let
(
:project
)
{
FactoryGirl
.
create
:ci_project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
}
let
(
:build
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
}
before
do
...
...
spec/requests/ci/api/builds_spec.rb
View file @
30c78e70
...
...
@@ -5,10 +5,12 @@ describe Ci::API::API do
let
(
:runner
)
{
FactoryGirl
.
create
(
:ci_runner
,
tag_list:
[
"mysql"
,
"ruby"
])
}
let
(
:project
)
{
FactoryGirl
.
create
(
:ci_project
)
}
let
(
:gl_project
)
{
FactoryGirl
.
create
(
:empty_project
,
gitlab_ci_project:
project
)
}
describe
"Builds API for runners"
do
let
(
:shared_runner
)
{
FactoryGirl
.
create
(
:ci_runner
,
token:
"SharedRunner"
)
}
let
(
:shared_project
)
{
FactoryGirl
.
create
(
:ci_project
,
name:
"SharedProject"
)
}
let
(
:shared_gl_project
)
{
FactoryGirl
.
create
(
:empty_project
,
gitlab_ci_project:
shared_project
)
}
before
do
FactoryGirl
.
create
:ci_runner_project
,
project_id:
project
.
id
,
runner_id:
runner
.
id
...
...
@@ -16,7 +18,7 @@ describe Ci::API::API do
describe
"POST /builds/register"
do
it
"should start a build"
do
commit
=
FactoryGirl
.
create
(
:ci_commit
,
project:
project
)
commit
=
FactoryGirl
.
create
(
:ci_commit
,
gl_project:
gl_
project
)
commit
.
create_builds
build
=
commit
.
builds
.
first
...
...
@@ -34,7 +36,7 @@ describe Ci::API::API do
end
it
"should return 404 error if no builds for specific runner"
do
commit
=
FactoryGirl
.
create
(
:ci_commit
,
project:
shared
_project
)
commit
=
FactoryGirl
.
create
(
:ci_commit
,
gl_project:
shared_gl
_project
)
FactoryGirl
.
create
(
:ci_build
,
commit:
commit
,
status:
'pending'
)
post
ci_api
(
"/builds/register"
),
token:
runner
.
token
...
...
@@ -43,7 +45,7 @@ describe Ci::API::API do
end
it
"should return 404 error if no builds for shared runner"
do
commit
=
FactoryGirl
.
create
(
:ci_commit
,
project:
project
)
commit
=
FactoryGirl
.
create
(
:ci_commit
,
gl_project:
gl_
project
)
FactoryGirl
.
create
(
:ci_build
,
commit:
commit
,
status:
'pending'
)
post
ci_api
(
"/builds/register"
),
token:
shared_runner
.
token
...
...
@@ -52,7 +54,7 @@ describe Ci::API::API do
end
it
"returns options"
do
commit
=
FactoryGirl
.
create
(
:ci_commit
,
project:
project
)
commit
=
FactoryGirl
.
create
(
:ci_commit
,
gl_project:
gl_
project
)
commit
.
create_builds
post
ci_api
(
"/builds/register"
),
token:
runner
.
token
,
info:
{
platform: :darwin
}
...
...
@@ -62,7 +64,7 @@ describe Ci::API::API do
end
it
"returns variables"
do
commit
=
FactoryGirl
.
create
(
:ci_commit
,
project:
project
)
commit
=
FactoryGirl
.
create
(
:ci_commit
,
gl_project:
gl_
project
)
commit
.
create_builds
project
.
variables
<<
Ci
::
Variable
.
new
(
key:
"SECRET_KEY"
,
value:
"secret_value"
)
...
...
@@ -77,7 +79,7 @@ describe Ci::API::API do
it
"returns variables for triggers"
do
trigger
=
FactoryGirl
.
create
(
:ci_trigger
,
project:
project
)
commit
=
FactoryGirl
.
create
(
:ci_commit
,
project:
project
)
commit
=
FactoryGirl
.
create
(
:ci_commit
,
gl_project:
gl_
project
)
trigger_request
=
FactoryGirl
.
create
(
:ci_trigger_request_with_variables
,
commit:
commit
,
trigger:
trigger
)
commit
.
create_builds
(
trigger_request
)
...
...
@@ -95,7 +97,7 @@ describe Ci::API::API do
end
describe
"PUT /builds/:id"
do
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
project:
project
)}
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
gl_project:
gl_
project
)}
let
(
:build
)
{
FactoryGirl
.
create
(
:ci_build
,
commit:
commit
,
runner_id:
runner
.
id
)
}
it
"should update a running build"
do
...
...
spec/requests/ci/api/commits_spec.rb
View file @
30c78e70
...
...
@@ -4,7 +4,8 @@ describe Ci::API::API, 'Commits' do
include
ApiHelpers
let
(
:project
)
{
FactoryGirl
.
create
(
:ci_project
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
project:
project
)
}
let
(
:gl_project
)
{
FactoryGirl
.
create
(
:empty_project
,
gitlab_ci_project:
project
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
gl_project:
gl_project
)
}
let
(
:options
)
do
{
...
...
spec/requests/ci/api/triggers_spec.rb
View file @
30c78e70
...
...
@@ -6,6 +6,7 @@ describe Ci::API::API do
describe
'POST /projects/:project_id/refs/:ref/trigger'
do
let!
(
:trigger_token
)
{
'secure token'
}
let!
(
:project
)
{
FactoryGirl
.
create
(
:ci_project
)
}
let!
(
:gl_project
)
{
FactoryGirl
.
create
(
:empty_project
,
gitlab_ci_project:
project
)
}
let!
(
:project2
)
{
FactoryGirl
.
create
(
:ci_project
)
}
let!
(
:trigger
)
{
FactoryGirl
.
create
(
:ci_trigger
,
project:
project
,
token:
trigger_token
)
}
let
(
:options
)
do
...
...
@@ -33,7 +34,7 @@ describe Ci::API::API do
context
'Have a commit'
do
before
do
@commit
=
FactoryGirl
.
create
(
:ci_commit
,
project:
project
)
@commit
=
FactoryGirl
.
create
(
:ci_commit
,
gl_project:
gl_
project
)
end
it
'should create builds'
do
...
...
spec/requests/ci/builds_spec.rb
View file @
30c78e70
...
...
@@ -2,8 +2,7 @@ require 'spec_helper'
describe
"Builds"
do
before
do
@project
=
FactoryGirl
.
create
:ci_project
@commit
=
FactoryGirl
.
create
:ci_commit
,
project:
@project
@commit
=
FactoryGirl
.
create
:ci_commit
@build
=
FactoryGirl
.
create
:ci_build
,
commit:
@commit
end
...
...
spec/requests/ci/commits_spec.rb
View file @
30c78e70
...
...
@@ -2,8 +2,7 @@ require 'spec_helper'
describe
"Commits"
do
before
do
@project
=
FactoryGirl
.
create
:ci_project
@commit
=
FactoryGirl
.
create
:ci_commit
,
project:
@project
@commit
=
FactoryGirl
.
create
:ci_commit
end
describe
"GET /:project/refs/:ref_name/commits/:id/status.json"
do
...
...
spec/services/ci/create_trigger_request_service_spec.rb
View file @
30c78e70
...
...
@@ -3,6 +3,7 @@ require 'spec_helper'
describe
Ci
::
CreateTriggerRequestService
do
let
(
:service
)
{
Ci
::
CreateTriggerRequestService
.
new
}
let
(
:project
)
{
FactoryGirl
.
create
:ci_project
}
let
(
:gl_project
)
{
FactoryGirl
.
create
:empty_project
,
gitlab_ci_project:
project
}
let
(
:trigger
)
{
FactoryGirl
.
create
:ci_trigger
,
project:
project
}
describe
:execute
do
...
...
@@ -10,7 +11,7 @@ describe Ci::CreateTriggerRequestService do
subject
{
service
.
execute
(
project
,
trigger
,
'master'
)
}
before
do
@commit
=
FactoryGirl
.
create
:ci_commit
,
project:
project
@commit
=
FactoryGirl
.
create
:ci_commit
,
gl_project:
gl_
project
end
it
{
expect
(
subject
).
to
be_kind_of
(
Ci
::
TriggerRequest
)
}
...
...
@@ -27,7 +28,7 @@ describe Ci::CreateTriggerRequestService do
subject
{
service
.
execute
(
project
,
trigger
,
'master'
)
}
before
do
FactoryGirl
.
create
:ci_commit_without_jobs
,
project:
project
FactoryGirl
.
create
:ci_commit_without_jobs
,
gl_project:
gl_
project
end
it
{
expect
(
subject
).
to
be_nil
}
...
...
@@ -37,9 +38,9 @@ describe Ci::CreateTriggerRequestService do
subject
{
service
.
execute
(
project
,
trigger
,
'master'
)
}
before
do
@commit1
=
FactoryGirl
.
create
:ci_commit
,
committed_at:
2
.
hour
.
ago
,
project:
project
@commit2
=
FactoryGirl
.
create
:ci_commit
,
committed_at:
1
.
hour
.
ago
,
project:
project
@commit3
=
FactoryGirl
.
create
:ci_commit
,
committed_at:
3
.
hour
.
ago
,
project:
project
@commit1
=
FactoryGirl
.
create
:ci_commit
,
committed_at:
2
.
hour
.
ago
,
gl_project:
gl_
project
@commit2
=
FactoryGirl
.
create
:ci_commit
,
committed_at:
1
.
hour
.
ago
,
gl_project:
gl_
project
@commit3
=
FactoryGirl
.
create
:ci_commit
,
committed_at:
3
.
hour
.
ago
,
gl_project:
gl_
project
end
context
'retries latest one'
do
...
...
spec/services/ci/image_for_build_service_spec.rb
View file @
30c78e70
...
...
@@ -4,7 +4,8 @@ module Ci
describe
ImageForBuildService
do
let
(
:service
)
{
ImageForBuildService
.
new
}
let
(
:project
)
{
FactoryGirl
.
create
(
:ci_project
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
project:
project
,
ref:
'master'
)
}
let
(
:gl_project
)
{
FactoryGirl
.
create
(
:empty_project
,
gitlab_ci_project:
project
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:ci_commit
,
gl_project:
gl_project
,
ref:
'master'
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:ci_build
,
commit:
commit
)
}
describe
:execute
do
...
...
spec/services/ci/register_build_service_spec.rb
View file @
30c78e70
...
...
@@ -3,9 +3,8 @@ require 'spec_helper'
module
Ci
describe
RegisterBuildService
do
let!
(
:service
)
{
RegisterBuildService
.
new
}
let!
(
:project
)
{
FactoryGirl
.
create
:ci_project
}
let!
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
let!
(
:pending_build
)
{
FactoryGirl
.
create
:ci_build
,
project:
project
,
commit:
commit
}
let!
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
}
let!
(
:pending_build
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
}
let!
(
:shared_runner
)
{
FactoryGirl
.
create
(
:ci_runner
,
is_shared:
true
)
}
let!
(
:specific_runner
)
{
FactoryGirl
.
create
(
:ci_runner
,
is_shared:
false
)
}
...
...
spec/services/ci/web_hook_service_spec.rb
View file @
30c78e70
...
...
@@ -2,7 +2,8 @@ require 'spec_helper'
describe
Ci
::
WebHookService
do
let
(
:project
)
{
FactoryGirl
.
create
:ci_project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
let
(
:gl_project
)
{
FactoryGirl
.
create
:empty_project
,
gitlab_ci_project:
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
gl_project:
gl_project
}
let
(
:build
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
}
let
(
:hook
)
{
FactoryGirl
.
create
:ci_web_hook
,
project:
project
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment