diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-22 12:09:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-22 12:09:42 +0000 |
commit | 2c171fdd723a6a1f45dedd12e62f93745318b40e (patch) | |
tree | 989875e5b72e03be69aa3fb329900506a198b3f4 /db | |
parent | c70359a07f62d06825c58e165e08874a21622cdc (diff) | |
download | gitlab-ce-2c171fdd723a6a1f45dedd12e62f93745318b40e.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/fixtures/development/12_snippets.rb | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/db/fixtures/development/12_snippets.rb b/db/fixtures/development/12_snippets.rb index 3fa172c8f0f..8ceabcdcd9b 100644 --- a/db/fixtures/development/12_snippets.rb +++ b/db/fixtures/development/12_snippets.rb @@ -1,40 +1,25 @@ 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) } +SNIPPET_REPO_URL = "https://gitlab.com/gitlab-org/gitlab-snippet-test.git" - delegate :name, :username, :email, to: :user, prefix: true -end -eos - - 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 |