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
5583b952
Commit
5583b952
authored
Jan 26, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for build created using generic commit status
parent
8d397862
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
55 deletions
+81
-55
spec/factories/commit_statuses.rb
spec/factories/commit_statuses.rb
+7
-2
spec/features/commits_spec.rb
spec/features/commits_spec.rb
+74
-53
No files found.
spec/factories/commit_statuses.rb
View file @
5583b952
FactoryGirl
.
define
do
FactoryGirl
.
define
do
factory
:commit_status
,
class:
CommitStatus
do
factory
:commit_status
,
class:
CommitStatus
do
started_at
'Di 29. Okt 09:51:28 CET 2013'
finished_at
'Di 29. Okt 09:53:28 CET 2013'
name
'default'
name
'default'
ref
'master'
status
'success'
status
'success'
description
'commit status'
description
'commit status'
commit
factory: :ci_commit_with_one_job
commit
factory: :ci_commit_with_one_job
started_at
'Tue, 26 Jan 2016 08:23:42 +0100'
finished_at
'Tue, 26 Jan 2016 08:23:42 +0100'
after
(
:build
)
do
|
build
,
evaluator
|
build
.
project
=
build
.
commit
.
project
end
factory
:generic_commit_status
,
class:
GenericCommitStatus
do
factory
:generic_commit_status
,
class:
GenericCommitStatus
do
name
'generic'
name
'generic'
...
...
spec/features/commits_spec.rb
View file @
5583b952
...
@@ -16,83 +16,104 @@ describe 'Commits' do
...
@@ -16,83 +16,104 @@ describe 'Commits' do
FactoryGirl
.
create
:ci_commit
,
project:
project
,
sha:
project
.
commit
.
sha
FactoryGirl
.
create
:ci_commit
,
project:
project
,
sha:
project
.
commit
.
sha
end
end
let!
(
:build
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
}
context
'commit status is Generic Commit Status'
do
let!
(
:status
)
{
FactoryGirl
.
create
:generic_commit_status
,
commit:
commit
}
describe
'Project commit
s'
do
describe
'Commit build
s'
do
before
do
before
do
visit
namespace_project_commits_path
(
project
.
namespace
,
project
,
:master
)
visit
ci_status_path
(
commit
)
end
end
it
'should show build status'
do
it
{
expect
(
page
).
to
have_content
commit
.
sha
[
0
..
7
]
}
page
.
within
(
"//li[@id='commit-
#{
commit
.
short_sha
}
']"
)
do
expect
(
page
).
to
have_css
(
".ci-status-link"
)
it
'contains generic commit status build'
do
page
.
within
(
'.table-holder'
)
do
expect
(
page
).
to
have_content
"#
#{
status
.
id
}
"
# build id
expect
(
page
).
to
have_content
'generic'
# build name
end
end
end
end
end
end
end
describe
'Commit builds'
do
context
'commit status is Ci Build'
do
before
do
let!
(
:build
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
}
visit
ci_status_path
(
commit
)
end
it
{
expect
(
page
).
to
have_content
commit
.
sha
[
0
..
7
]
}
it
{
expect
(
page
).
to
have_content
commit
.
git_commit_message
}
it
{
expect
(
page
).
to
have_content
commit
.
git_author_name
}
end
context
'Download artifacts'
do
describe
'Project commits'
do
let
(
:artifacts_file
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
}
before
do
visit
namespace_project_commits_path
(
project
.
namespace
,
project
,
:master
)
end
before
do
it
'should show build status'
do
build
.
update_attributes
(
artifacts_file:
artifacts_file
)
page
.
within
(
"//li[@id='commit-
#{
commit
.
short_sha
}
']"
)
do
expect
(
page
).
to
have_css
(
".ci-status-link"
)
end
end
end
end
it
do
describe
'Commit builds'
do
visit
ci_status_path
(
commit
)
before
do
click_on
'Download artifacts'
visit
ci_status_path
(
commit
)
expect
(
page
.
response_headers
[
'Content-Type'
]).
to
eq
(
artifacts_file
.
content_type
)
end
end
end
describe
'Cancel all builds'
do
it
{
expect
(
page
).
to
have_content
commit
.
sha
[
0
..
7
]
}
it
'cancels commit'
do
it
{
expect
(
page
).
to
have_content
commit
.
git_commit_message
}
visit
ci_status_path
(
commit
)
it
{
expect
(
page
).
to
have_content
commit
.
git_author_name
}
click_on
'Cancel running'
expect
(
page
).
to
have_content
'canceled'
end
end
end
describe
'Cancel build'
do
context
'Download artifacts'
do
it
'cancels build'
do
let
(
:artifacts_file
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
}
visit
ci_status_path
(
commit
)
click_on
'Cancel'
before
do
expect
(
page
).
to
have_content
'canceled'
build
.
update_attributes
(
artifacts_file:
artifacts_file
)
end
end
end
describe
'.gitlab-ci.yml not found warning'
do
it
do
context
'ci builds enabled'
do
it
"does not show warning"
do
visit
ci_status_path
(
commit
)
visit
ci_status_path
(
commit
)
expect
(
page
).
not_to
have_content
'.gitlab-ci.yml not found in this commit'
click_on
'Download artifacts'
expect
(
page
.
response_headers
[
'Content-Type'
]).
to
eq
(
artifacts_file
.
content_type
)
end
end
end
it
'shows warning
'
do
describe
'Cancel all builds
'
do
stub_ci_commit_yaml_file
(
nil
)
it
'cancels commit'
do
visit
ci_status_path
(
commit
)
visit
ci_status_path
(
commit
)
expect
(
page
).
to
have_content
'.gitlab-ci.yml not found in this commit'
click_on
'Cancel running'
expect
(
page
).
to
have_content
'canceled'
end
end
end
end
context
'ci builds disabled'
do
describe
'Cancel build'
do
before
do
it
'cancels build'
do
stub_ci_builds_disabled
stub_ci_commit_yaml_file
(
nil
)
visit
ci_status_path
(
commit
)
visit
ci_status_path
(
commit
)
click_on
'Cancel'
expect
(
page
).
to
have_content
'canceled'
end
end
end
describe
'.gitlab-ci.yml not found warning'
do
context
'ci builds enabled'
do
it
"does not show warning"
do
visit
ci_status_path
(
commit
)
expect
(
page
).
not_to
have_content
'.gitlab-ci.yml not found in this commit'
end
it
'shows warning'
do
stub_ci_commit_yaml_file
(
nil
)
visit
ci_status_path
(
commit
)
expect
(
page
).
to
have_content
'.gitlab-ci.yml not found in this commit'
end
end
context
'ci builds disabled'
do
before
do
stub_ci_builds_disabled
stub_ci_commit_yaml_file
(
nil
)
visit
ci_status_path
(
commit
)
end
it
'does not show warning'
do
it
'does not show warning'
do
expect
(
page
).
not_to
have_content
'.gitlab-ci.yml not found in this commit'
expect
(
page
).
not_to
have_content
'.gitlab-ci.yml not found in this commit'
end
end
end
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