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
Léo-Paul Géneau
gitlab-ce
Commits
b65903e0
Commit
b65903e0
authored
Apr 05, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve development fixtures
parent
ef7e605e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
23 deletions
+29
-23
db/fixtures/development/06_teams.rb
db/fixtures/development/06_teams.rb
+11
-19
db/fixtures/development/09_issues.rb
db/fixtures/development/09_issues.rb
+2
-0
db/fixtures/development/10_merge_requests.rb
db/fixtures/development/10_merge_requests.rb
+15
-4
db/fixtures/development/11_keys.rb
db/fixtures/development/11_keys.rb
+1
-0
No files found.
db/fixtures/development/06_teams.rb
View file @
b65903e0
Gitlab
::
Seeder
.
quiet
do
(
1
..
300
).
each
do
|
i
|
# Random Project
project
=
Project
.
scoped
.
sample
# Random user
user
=
User
.
not_in_project
(
project
).
sample
ActiveRecord
::
Base
.
observers
.
disable
:all
next
unless
user
UsersProject
.
seed
(
:id
,
[{
id:
i
,
project_id:
project
.
id
,
user_id:
user
.
id
,
project_access:
UsersProject
.
access_roles
.
values
.
sample
}])
print
(
'.'
)
Gitlab
::
Seeder
.
quiet
do
Project
.
all
.
each
do
|
project
|
project
.
team
<<
[
User
.
first
,
:master
]
print
'.'
User
.
all
.
sample
(
rand
(
10
)).
each
do
|
user
|
role
=
[
:master
,
:developer
,
:reporter
]
.
sample
project
.
team
<<
[
user
,
role
]
print
'.'
end
end
end
puts
"OK"
.
green
db/fixtures/development/09_issues.rb
View file @
b65903e0
ActiveRecord
::
Base
.
observers
.
disable
:all
Gitlab
::
Seeder
.
quiet
do
(
1
..
300
).
each
do
|
i
|
# Random Project
...
...
db/fixtures/development/10_merge_requests.rb
View file @
b65903e0
ActiveRecord
::
Base
.
observers
.
disable
:all
Gitlab
::
Seeder
.
quiet
do
(
1
..
3
00
).
each
do
|
i
|
(
1
..
1
00
).
each
do
|
i
|
# Random Project
project
=
Project
.
all
.
sample
...
...
@@ -8,19 +10,28 @@ Gitlab::Seeder.quiet do
next
unless
user
next
if
project
.
empty_repo?
branches
=
project
.
repository
.
branch_names
.
sample
(
2
)
user_id
=
user
.
id
MergeRequestObserver
.
current_user
=
user
MergeRequest
.
seed
(
:id
,
[{
id:
i
,
source_branch:
'master'
,
target_branch:
'feature'
,
source_branch:
branches
.
first
,
target_branch:
branches
.
last
,
project_id:
project
.
id
,
author_id:
user_id
,
assignee_id:
user_id
,
state:
[
'opened'
,
'closed'
].
sample
,
milestone:
project
.
milestones
.
sample
,
title:
Faker
::
Lorem
.
sentence
(
6
)
}])
print
(
'.'
)
end
end
puts
'Load diffs for Merge Requests (it will take some time)...'
MergeRequest
.
all
.
each
do
|
mr
|
mr
.
reload_code
print
'.'
end
db/fixtures/development/11_keys.rb
View file @
b65903e0
ActiveRecord
::
Base
.
observers
.
enable
:all
Gitlab
::
Seeder
.
quiet
do
User
.
first
(
30
).
each_with_index
do
|
user
,
i
|
...
...
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