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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e2c3dca3
Commit
e2c3dca3
authored
Aug 02, 2017
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove `:empty_project` factory, implement `:repository` trait
parent
64d6a48b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
48 deletions
+43
-48
spec/factories/projects.rb
spec/factories/projects.rb
+43
-48
No files found.
spec/factories/projects.rb
View file @
e2c3dca3
...
...
@@ -5,7 +5,7 @@ FactoryGirl.define do
#
# Project does not have bare repository.
# Use this factory if you don't need repository in tests
factory
:
empty_
project
,
class:
'Project'
do
factory
:project
,
class:
'Project'
do
sequence
(
:name
)
{
|
n
|
"project
#{
n
}
"
}
path
{
name
.
downcase
.
gsub
(
/\s/
,
'_'
)
}
namespace
...
...
@@ -54,8 +54,44 @@ FactoryGirl.define do
avatar
{
File
.
open
(
Rails
.
root
.
join
(
'spec/fixtures/dk.png'
))
}
end
# Project with test repository
#
# Repository source is at https://gitlab.com/gitlab-org/gitlab-test
trait
:repository
do
# no-op... for now!
path
{
'gitlabhq'
}
test_repo
transient
do
create_template
nil
end
after
:create
do
|
project
,
evaluator
|
if
evaluator
.
create_template
args
=
evaluator
.
create_template
project
.
add_user
(
args
[
:user
],
args
[
:access
])
project
.
repository
.
create_file
(
args
[
:user
],
".gitlab/
#{
args
[
:path
]
}
/bug.md"
,
'something valid'
,
message:
'test 3'
,
branch_name:
'master'
)
project
.
repository
.
create_file
(
args
[
:user
],
".gitlab/
#{
args
[
:path
]
}
/template_test.md"
,
'template_test'
,
message:
'test 1'
,
branch_name:
'master'
)
project
.
repository
.
create_file
(
args
[
:user
],
".gitlab/
#{
args
[
:path
]
}
/feature_proposal.md"
,
'feature_proposal'
,
message:
'test 2'
,
branch_name:
'master'
)
end
end
end
trait
:empty_repo
do
...
...
@@ -146,59 +182,18 @@ FactoryGirl.define do
#
# This is a case when you just created a project
# but not pushed any code there yet
factory
:project_empty_repo
,
parent: :
empty_
project
do
factory
:project_empty_repo
,
parent: :project
do
empty_repo
end
# Project with broken repository
#
# Project with an invalid repository state
factory
:project_broken_repo
,
parent: :
empty_
project
do
factory
:project_broken_repo
,
parent: :project
do
broken_repo
end
# Project with test repository
#
# Test repository source can be found at
# https://gitlab.com/gitlab-org/gitlab-test
factory
:project
,
parent: :empty_project
do
path
{
'gitlabhq'
}
test_repo
transient
do
create_template
nil
end
after
:create
do
|
project
,
evaluator
|
if
evaluator
.
create_template
args
=
evaluator
.
create_template
project
.
add_user
(
args
[
:user
],
args
[
:access
])
project
.
repository
.
create_file
(
args
[
:user
],
".gitlab/
#{
args
[
:path
]
}
/bug.md"
,
'something valid'
,
message:
'test 3'
,
branch_name:
'master'
)
project
.
repository
.
create_file
(
args
[
:user
],
".gitlab/
#{
args
[
:path
]
}
/template_test.md"
,
'template_test'
,
message:
'test 1'
,
branch_name:
'master'
)
project
.
repository
.
create_file
(
args
[
:user
],
".gitlab/
#{
args
[
:path
]
}
/feature_proposal.md"
,
'feature_proposal'
,
message:
'test 2'
,
branch_name:
'master'
)
end
end
end
factory
:forked_project_with_submodules
,
parent: :empty_project
do
factory
:forked_project_with_submodules
,
parent: :project
do
path
{
'forked-gitlabhq'
}
after
:create
do
|
project
|
...
...
@@ -228,11 +223,11 @@ FactoryGirl.define do
jira_service
end
factory
:kubernetes_project
,
parent: :
empty_
project
do
factory
:kubernetes_project
,
parent: :project
do
kubernetes_service
end
factory
:prometheus_project
,
parent: :
empty_
project
do
factory
:prometheus_project
,
parent: :project
do
after
:create
do
|
project
|
project
.
create_prometheus_service
(
active:
true
,
...
...
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