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
a8dd4d36
Commit
a8dd4d36
authored
9 years ago
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix build features specs
parent
9a9417ee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
40 deletions
+45
-40
app/models/ci/project.rb
app/models/ci/project.rb
+3
-1
spec/factories/ci/projects.rb
spec/factories/ci/projects.rb
+1
-1
spec/features/ci/builds_spec.rb
spec/features/ci/builds_spec.rb
+41
-38
No files found.
app/models/ci/project.rb
View file @
a8dd4d36
...
@@ -28,9 +28,11 @@
...
@@ -28,9 +28,11 @@
module
Ci
module
Ci
class
Project
<
ActiveRecord
::
Base
class
Project
<
ActiveRecord
::
Base
extend
Ci
::
Model
extend
Ci
::
Model
include
Ci
::
ProjectStatus
include
Ci
::
ProjectStatus
belongs_to
:gl_project
,
class_name:
'Project'
,
foreign_key: :gitlab_id
has_many
:commits
,
->
()
{
order
(
:committed_at
)
},
dependent: :destroy
,
class_name:
'Ci::Commit'
has_many
:commits
,
->
()
{
order
(
:committed_at
)
},
dependent: :destroy
,
class_name:
'Ci::Commit'
has_many
:builds
,
through: :commits
,
dependent: :destroy
,
class_name:
'Ci::Build'
has_many
:builds
,
through: :commits
,
dependent: :destroy
,
class_name:
'Ci::Build'
has_many
:runner_projects
,
dependent: :destroy
,
class_name:
'Ci::RunnerProject'
has_many
:runner_projects
,
dependent: :destroy
,
class_name:
'Ci::RunnerProject'
...
...
This diff is collapsed.
Click to expand it.
spec/factories/ci/projects.rb
View file @
a8dd4d36
...
@@ -43,7 +43,7 @@ FactoryGirl.define do
...
@@ -43,7 +43,7 @@ FactoryGirl.define do
"git@demo.gitlab.com:gitlab/gitlab-shell
#{
n
}
.git"
"git@demo.gitlab.com:gitlab/gitlab-shell
#{
n
}
.git"
end
end
sequence
:gitlab_id
gl_project
factory: :project
factory
:ci_project
do
factory
:ci_project
do
token
'iPWx6WM4lhHNedGfBpPJNP'
token
'iPWx6WM4lhHNedGfBpPJNP'
...
...
This diff is collapsed.
Click to expand it.
spec/features/ci/builds_spec.rb
View file @
a8dd4d36
require
'spec_helper'
require
'spec_helper'
describe
"Builds"
do
describe
"Builds"
do
before
do
context
:private_project
do
@project
=
FactoryGirl
.
create
:project
@commit
=
FactoryGirl
.
create
:commit
,
project:
@project
@build
=
FactoryGirl
.
create
:build
,
commit:
@commit
end
describe
"GET /:project/builds/:id"
do
before
do
before
do
@project
=
FactoryGirl
.
create
:ci_project
@commit
=
FactoryGirl
.
create
:ci_commit
,
project:
@project
@build
=
FactoryGirl
.
create
:ci_build
,
commit:
@commit
login_as
:user
login_as
:user
visit
project_build_path
(
@project
,
@build
)
@project
.
gl_project
.
team
<<
[
@user
,
:master
]
end
end
it
{
expect
(
page
).
to
have_content
@commit
.
sha
[
0
..
7
]
}
describe
"GET /:project/builds/:id"
do
it
{
expect
(
page
).
to
have_content
@commit
.
git_commit_message
}
before
do
it
{
expect
(
page
).
to
have_content
@commit
.
git_author_name
}
visit
ci_project_build_path
(
@project
,
@build
)
end
end
describe
"GET /:project/builds/:id/cancel"
do
it
{
expect
(
page
).
to
have_content
@commit
.
sha
[
0
..
7
]
}
before
do
it
{
expect
(
page
).
to
have_content
@commit
.
git_commit_message
}
login_as
:user
it
{
expect
(
page
).
to
have_content
@commit
.
git_author_name
}
@build
.
run!
visit
cancel_project_build_path
(
@project
,
@build
)
end
end
it
{
expect
(
page
).
to
have_content
'canceled'
}
describe
"GET /:project/builds/:id/cancel"
do
it
{
expect
(
page
).
to
have_content
'Retry'
}
before
do
end
@build
.
run!
visit
cancel_ci_project_build_path
(
@project
,
@build
)
end
describe
"POST /:project/builds/:id/retry"
do
it
{
expect
(
page
).
to
have_content
'canceled'
}
before
do
it
{
expect
(
page
).
to
have_content
'Retry'
}
login_as
:user
@build
.
cancel!
visit
project_build_path
(
@project
,
@build
)
click_link
'Retry'
end
end
it
{
expect
(
page
).
to
have_content
'pending'
}
describe
"POST /:project/builds/:id/retry"
do
it
{
expect
(
page
).
to
have_content
'Cancel'
}
before
do
@build
.
cancel!
visit
ci_project_build_path
(
@project
,
@build
)
click_link
'Retry'
end
it
{
expect
(
page
).
to
have_content
'pending'
}
it
{
expect
(
page
).
to
have_content
'Cancel'
}
end
end
end
describe
"Show page public accessible"
do
context
:public_project
do
before
do
describe
"Show page public accessible"
do
@project
=
FactoryGirl
.
create
:public_project
before
do
@commit
=
FactoryGirl
.
create
:commit
,
project:
@project
@project
=
FactoryGirl
.
create
:ci_public_project
@runner
=
FactoryGirl
.
create
:specific_runner
@commit
=
FactoryGirl
.
create
:ci_commit
,
project:
@project
@build
=
FactoryGirl
.
create
:build
,
commit:
@commit
,
runner:
@runner
@runner
=
FactoryGirl
.
create
:ci_specific_runner
@build
=
FactoryGirl
.
create
:ci_build
,
commit:
@commit
,
runner:
@runner
stub_gitlab_calls
stub_gitlab_calls
visit
project_build_path
(
@project
,
@build
)
visit
ci_
project_build_path
(
@project
,
@build
)
end
end
it
{
expect
(
page
).
to
have_content
@commit
.
sha
[
0
..
7
]
}
it
{
expect
(
page
).
to
have_content
@commit
.
sha
[
0
..
7
]
}
end
end
end
end
end
This diff is collapsed.
Click to expand it.
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