Update snippet fixtures

parent 8214da07
require './spec/support/sidekiq_middleware' require './spec/support/sidekiq_middleware'
Gitlab::Seeder.quiet do SNIPPET_REPO_URL = "https://gitlab.com/gitlab-org/gitlab-snippet-test.git"
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 Gitlab::Seeder.quiet do
end 20.times do |i|
eos
50.times do |i|
user = User.not_mass_generated.sample user = User.not_mass_generated.sample
PersonalSnippet.seed(:id, [{ user.snippets.create({
id: i, type: 'PersonalSnippet',
author_id: user.id,
title: FFaker::Lorem.sentence(3), title: FFaker::Lorem.sentence(3),
file_name: FFaker::Internet.domain_word + '.rb', file_name: 'file.rb',
visibility_level: Gitlab::VisibilityLevel.values.sample, 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('.') print('.')
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment