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
db252875
Commit
db252875
authored
Jul 20, 2020
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update snippet fixtures
parent
8214da07
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
30 deletions
+15
-30
db/fixtures/development/12_snippets.rb
db/fixtures/development/12_snippets.rb
+15
-30
No files found.
db/fixtures/development/12_snippets.rb
View file @
db252875
require
'./spec/support/sidekiq_middleware'
Gitlab
::
Seeder
.
quiet
do
content
=<<
eos
class Member < ActiveRecord::Base
include Notifiable
include Gitlab::Access
belongs_to :user
belongs_to :source, polymorphic: true
validates :user, presence: true
validates :source, presence: true
validates :user_id, uniqueness: { scope: [:source_type, :source_id], message: "already exists in source" }
validates :access_level, inclusion: { in: Gitlab::Access.all_values }, presence: true
scope :guests, -> { where(access_level: GUEST) }
scope :reporters, -> { where(access_level: REPORTER) }
scope :developers, -> { where(access_level: DEVELOPER) }
scope :maintainers, -> { where(access_level: MAINTAINER) }
scope :owners, -> { where(access_level: OWNER) }
delegate :name, :username, :email, to: :user, prefix: true
end
eos
SNIPPET_REPO_URL
=
"https://gitlab.com/gitlab-org/gitlab-snippet-test.git"
50
.
times
do
|
i
|
Gitlab
::
Seeder
.
quiet
do
20
.
times
do
|
i
|
user
=
User
.
not_mass_generated
.
sample
PersonalSnippet
.
seed
(
:id
,
[{
id:
i
,
author_id:
user
.
id
,
user
.
snippets
.
create
({
type:
'PersonalSnippet'
,
title:
FFaker
::
Lorem
.
sentence
(
3
),
file_name:
FFaker
::
Internet
.
domain_word
+
'
.rb'
,
file_name:
'file
.rb'
,
visibility_level:
Gitlab
::
VisibilityLevel
.
values
.
sample
,
content:
content
,
}])
content:
'foo'
}).
tap
do
|
snippet
|
unless
snippet
.
repository_exists?
snippet
.
repository
.
import_repository
(
SNIPPET_REPO_URL
)
end
snippet
.
track_snippet_repository
(
snippet
.
repository
.
storage
)
snippet
.
statistics
.
refresh!
end
print
(
'.'
)
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