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
Jérome Perrin
gitlab-ce
Commits
d8478d16
Commit
d8478d16
authored
Sep 01, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix spec
parent
5547baa3
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
11 deletions
+15
-11
app/models/ci/build.rb
app/models/ci/build.rb
+2
-1
features/steps/project/pages.rb
features/steps/project/pages.rb
+2
-1
lib/api/commit_statuses.rb
lib/api/commit_statuses.rb
+4
-2
spec/requests/api/commit_statuses_spec.rb
spec/requests/api/commit_statuses_spec.rb
+2
-2
spec/requests/api/commits_spec.rb
spec/requests/api/commits_spec.rb
+1
-1
spec/requests/api/v3/commits_spec.rb
spec/requests/api/v3/commits_spec.rb
+2
-2
spec/services/ci/retry_build_service_spec.rb
spec/services/ci/retry_build_service_spec.rb
+2
-2
No files found.
app/models/ci/build.rb
View file @
d8478d16
...
@@ -3,6 +3,7 @@ module Ci
...
@@ -3,6 +3,7 @@ module Ci
include
TokenAuthenticatable
include
TokenAuthenticatable
include
AfterCommitQueue
include
AfterCommitQueue
include
Presentable
include
Presentable
include
Importable
belongs_to
:runner
belongs_to
:runner
belongs_to
:trigger_request
belongs_to
:trigger_request
...
@@ -26,7 +27,7 @@ module Ci
...
@@ -26,7 +27,7 @@ module Ci
validates
:coverage
,
numericality:
true
,
allow_blank:
true
validates
:coverage
,
numericality:
true
,
allow_blank:
true
validates
:ref
,
presence:
true
validates
:ref
,
presence:
true
validates
:protected
,
inclusion:
{
in:
[
true
,
false
]
},
on: :create
validates
:protected
,
inclusion:
{
in:
[
true
,
false
]
,
unless: :importing?
},
on: :create
scope
:unstarted
,
->
()
{
where
(
runner_id:
nil
)
}
scope
:unstarted
,
->
()
{
where
(
runner_id:
nil
)
}
scope
:ignore_failures
,
->
()
{
where
(
allow_failure:
false
)
}
scope
:ignore_failures
,
->
()
{
where
(
allow_failure:
false
)
}
...
...
features/steps/project/pages.rb
View file @
d8478d16
...
@@ -37,7 +37,8 @@ class Spinach::Features::ProjectPages < Spinach::FeatureSteps
...
@@ -37,7 +37,8 @@ class Spinach::Features::ProjectPages < Spinach::FeatureSteps
step
'pages are deployed'
do
step
'pages are deployed'
do
pipeline
=
@project
.
pipelines
.
create
(
ref:
'HEAD'
,
pipeline
=
@project
.
pipelines
.
create
(
ref:
'HEAD'
,
sha:
@project
.
commit
(
'HEAD'
).
sha
,
sha:
@project
.
commit
(
'HEAD'
).
sha
,
source: :push
)
source: :push
,
protected:
false
)
build
=
build
(
:ci_build
,
build
=
build
(
:ci_build
,
project:
@project
,
project:
@project
,
...
...
lib/api/commit_statuses.rb
View file @
d8478d16
...
@@ -74,7 +74,8 @@ module API
...
@@ -74,7 +74,8 @@ module API
source: :external
,
source: :external
,
sha:
commit
.
sha
,
sha:
commit
.
sha
,
ref:
ref
,
ref:
ref
,
user:
current_user
)
user:
current_user
,
protected:
@project
.
protected_for?
(
ref
))
end
end
status
=
GenericCommitStatus
.
running_or_pending
.
find_or_initialize_by
(
status
=
GenericCommitStatus
.
running_or_pending
.
find_or_initialize_by
(
...
@@ -82,7 +83,8 @@ module API
...
@@ -82,7 +83,8 @@ module API
pipeline:
pipeline
,
pipeline:
pipeline
,
name:
name
,
name:
name
,
ref:
ref
,
ref:
ref
,
user:
current_user
user:
current_user
,
protected:
@project
.
protected_for?
(
ref
)
)
)
optional_attributes
=
optional_attributes
=
...
...
spec/requests/api/commit_statuses_spec.rb
View file @
d8478d16
...
@@ -16,8 +16,8 @@ describe API::CommitStatuses do
...
@@ -16,8 +16,8 @@ describe API::CommitStatuses do
let
(
:get_url
)
{
"/projects/
#{
project
.
id
}
/repository/commits/
#{
sha
}
/statuses"
}
let
(
:get_url
)
{
"/projects/
#{
project
.
id
}
/repository/commits/
#{
sha
}
/statuses"
}
context
'ci commit exists'
do
context
'ci commit exists'
do
let!
(
:master
)
{
project
.
pipelines
.
create
(
source: :push
,
sha:
commit
.
id
,
ref:
'master'
)
}
let!
(
:master
)
{
project
.
pipelines
.
create
(
source: :push
,
sha:
commit
.
id
,
ref:
'master'
,
protected:
false
)
}
let!
(
:develop
)
{
project
.
pipelines
.
create
(
source: :push
,
sha:
commit
.
id
,
ref:
'develop'
)
}
let!
(
:develop
)
{
project
.
pipelines
.
create
(
source: :push
,
sha:
commit
.
id
,
ref:
'develop'
,
protected:
false
)
}
context
"reporter user"
do
context
"reporter user"
do
let
(
:statuses_id
)
{
json_response
.
map
{
|
status
|
status
[
'id'
]
}
}
let
(
:statuses_id
)
{
json_response
.
map
{
|
status
|
status
[
'id'
]
}
}
...
...
spec/requests/api/commits_spec.rb
View file @
d8478d16
...
@@ -565,7 +565,7 @@ describe API::Commits do
...
@@ -565,7 +565,7 @@ describe API::Commits do
end
end
context
'when the ref has a pipeline'
do
context
'when the ref has a pipeline'
do
let!
(
:pipeline
)
{
project
.
pipelines
.
create
(
source: :push
,
ref:
'master'
,
sha:
commit
.
sha
)
}
let!
(
:pipeline
)
{
project
.
pipelines
.
create
(
source: :push
,
ref:
'master'
,
sha:
commit
.
sha
,
protected:
false
)
}
it
'includes a "created" status'
do
it
'includes a "created" status'
do
get
api
(
route
,
current_user
)
get
api
(
route
,
current_user
)
...
...
spec/requests/api/v3/commits_spec.rb
View file @
d8478d16
...
@@ -386,7 +386,7 @@ describe API::V3::Commits do
...
@@ -386,7 +386,7 @@ describe API::V3::Commits do
end
end
it
"returns status for CI"
do
it
"returns status for CI"
do
pipeline
=
project
.
pipelines
.
create
(
source: :push
,
ref:
'master'
,
sha:
project
.
repository
.
commit
.
sha
)
pipeline
=
project
.
pipelines
.
create
(
source: :push
,
ref:
'master'
,
sha:
project
.
repository
.
commit
.
sha
,
protected:
false
)
pipeline
.
update
(
status:
'success'
)
pipeline
.
update
(
status:
'success'
)
get
v3_api
(
"/projects/
#{
project
.
id
}
/repository/commits/
#{
project
.
repository
.
commit
.
id
}
"
,
user
)
get
v3_api
(
"/projects/
#{
project
.
id
}
/repository/commits/
#{
project
.
repository
.
commit
.
id
}
"
,
user
)
...
@@ -396,7 +396,7 @@ describe API::V3::Commits do
...
@@ -396,7 +396,7 @@ describe API::V3::Commits do
end
end
it
"returns status for CI when pipeline is created"
do
it
"returns status for CI when pipeline is created"
do
project
.
pipelines
.
create
(
source: :push
,
ref:
'master'
,
sha:
project
.
repository
.
commit
.
sha
)
project
.
pipelines
.
create
(
source: :push
,
ref:
'master'
,
sha:
project
.
repository
.
commit
.
sha
,
protected:
false
)
get
v3_api
(
"/projects/
#{
project
.
id
}
/repository/commits/
#{
project
.
repository
.
commit
.
id
}
"
,
user
)
get
v3_api
(
"/projects/
#{
project
.
id
}
/repository/commits/
#{
project
.
repository
.
commit
.
id
}
"
,
user
)
...
...
spec/services/ci/retry_build_service_spec.rb
View file @
d8478d16
...
@@ -22,7 +22,7 @@ describe Ci::RetryBuildService do
...
@@ -22,7 +22,7 @@ describe Ci::RetryBuildService do
%i[type lock_version target_url base_tags
%i[type lock_version target_url base_tags
commit_id deployments erased_by_id last_deployment project_id
commit_id deployments erased_by_id last_deployment project_id
runner_id tag_taggings taggings tags trigger_request_id
runner_id tag_taggings taggings tags trigger_request_id
user_id auto_canceled_by_id retried
protected
]
.
freeze
user_id auto_canceled_by_id retried]
.
freeze
shared_examples
'build duplication'
do
shared_examples
'build duplication'
do
let
(
:stage
)
do
let
(
:stage
)
do
...
@@ -48,7 +48,7 @@ describe Ci::RetryBuildService do
...
@@ -48,7 +48,7 @@ describe Ci::RetryBuildService do
describe
'clone accessors'
do
describe
'clone accessors'
do
CLONE_ACCESSORS
.
each
do
|
attribute
|
CLONE_ACCESSORS
.
each
do
|
attribute
|
it
"clones
#{
attribute
}
build attribute"
do
it
"clones
#{
attribute
}
build attribute"
do
expect
(
new_build
.
send
(
attribute
)).
to
be_present
expect
(
new_build
.
send
(
attribute
)).
not_to
be_nil
expect
(
new_build
.
send
(
attribute
)).
to
eq
build
.
send
(
attribute
)
expect
(
new_build
.
send
(
attribute
)).
to
eq
build
.
send
(
attribute
)
end
end
end
end
...
...
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