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
Boxiang Sun
gitlab-ce
Commits
0df7a32e
Commit
0df7a32e
authored
Nov 19, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests
parent
2b907f61
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
+20
-20
app/models/ci/commit.rb
app/models/ci/commit.rb
+1
-1
spec/services/ci/create_commit_service_spec.rb
spec/services/ci/create_commit_service_spec.rb
+19
-19
No files found.
app/models/ci/commit.rb
View file @
0df7a32e
...
...
@@ -196,7 +196,7 @@ module Ci
rescue
Psych
::
SyntaxError
=>
e
save_yaml_error
(
e
.
message
)
nil
rescue
Exception
=>
e
rescue
Exception
save_yaml_error
(
"Undefined yaml error"
)
nil
end
...
...
spec/services/ci/create_commit_service_spec.rb
View file @
0df7a32e
...
...
@@ -53,7 +53,7 @@ module Ci
end
end
it
'
fail
s commits without .gitlab-ci.yml'
do
it
'
skip
s commits without .gitlab-ci.yml'
do
stub_ci_commit_yaml_file
(
nil
)
result
=
service
.
execute
(
project
,
user
,
ref:
'refs/heads/0_1'
,
...
...
@@ -63,7 +63,24 @@ module Ci
)
expect
(
result
).
to
be_persisted
expect
(
result
.
builds
.
any?
).
to
be_falsey
expect
(
result
.
status
).
to
eq
(
'failed'
)
expect
(
result
.
status
).
to
eq
(
'skipped'
)
expect
(
commit
.
yaml_errors
).
to_not
be_nil
end
it
'skips commits if yaml is invalid'
do
message
=
'message'
allow_any_instance_of
(
Ci
::
Commit
).
to
receive
(
:git_commit_message
)
{
message
}
stub_ci_commit_yaml_file
(
'invalid: file: file'
)
commits
=
[{
message:
message
}]
commit
=
service
.
execute
(
project
,
user
,
ref:
'refs/tags/0_1'
,
before:
'00000000'
,
after:
'31das312'
,
commits:
commits
)
expect
(
commit
.
builds
.
any?
).
to
be
false
expect
(
commit
.
status
).
to
eq
(
'skipped'
)
expect
(
commit
.
yaml_errors
).
to_not
be_nil
end
describe
:ci_skip?
do
...
...
@@ -114,23 +131,6 @@ module Ci
end
end
describe
:config_processor
do
it
"skips builds creation if yaml is invalid"
do
allow_any_instance_of
(
Ci
::
Commit
).
to
receive
(
:git_commit_message
)
{
"message"
}
stub_ci_commit_yaml_file
(
'invalid: file: file'
)
commits
=
[{
message:
message
}]
commit
=
service
.
execute
(
project
,
user
,
ref:
'refs/tags/0_1'
,
before:
'00000000'
,
after:
'31das312'
,
commits:
commits
)
expect
(
commit
.
builds
.
any?
).
to
be
false
expect
(
commit
.
status
).
to
eq
(
"skipped"
)
expect
(
commit
.
yaml_errors
).
to_not
be_nil
end
end
it
"skips build creation if there are already builds"
do
allow_any_instance_of
(
Ci
::
Commit
).
to
receive
(
:ci_yaml_file
)
{
gitlab_ci_yaml
}
...
...
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