Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorrandx <dmitriy.zaporozhets@gmail.com>2012-10-30 12:03:21 +0400
committerrandx <dmitriy.zaporozhets@gmail.com>2012-10-30 12:03:21 +0400
commit36dbac2fd90c12a74781c9982db8f18bae938265 (patch)
tree4e0be6493eaf6619d59670e385cac1c05f3ea487 /db
parente4cf99db4615f406dfc60bfc8bca473581b4f910 (diff)
More seeds
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/development/005_issues.rb40
-rw-r--r--db/fixtures/development/005_milestones.rb (renamed from db/fixtures/development/007_milestones.rb)0
-rw-r--r--db/fixtures/development/007_issues.rb20
-rw-r--r--db/fixtures/development/008_merge_requests.rb37
4 files changed, 40 insertions, 57 deletions
diff --git a/db/fixtures/development/005_issues.rb b/db/fixtures/development/005_issues.rb
deleted file mode 100644
index 32375387bfb..00000000000
--- a/db/fixtures/development/005_issues.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-Issue.seed(:id, [
- { :id => 1, :project_id => 1, :author_id => 1, :assignee_id => 1, :title => Faker::Lorem.sentence(6) },
- { :id => 2, :project_id => 1, :author_id => 2, :assignee_id => 2, :title => Faker::Lorem.sentence(6) },
- { :id => 3, :project_id => 1, :author_id => 3, :assignee_id => 3, :title => Faker::Lorem.sentence(6) },
- { :id => 4, :project_id => 1, :author_id => 4, :assignee_id => 4, :title => Faker::Lorem.sentence(6) },
- { :id => 5, :project_id => 1, :author_id => 5, :assignee_id => 5, :title => Faker::Lorem.sentence(6) },
-
- { :id => 6, :project_id => 2, :author_id => 1, :assignee_id => 1, :title => Faker::Lorem.sentence(6) },
- { :id => 7, :project_id => 2, :author_id => 2, :assignee_id => 2, :title => Faker::Lorem.sentence(6) },
- { :id => 8, :project_id => 2, :author_id => 3, :assignee_id => 3, :title => Faker::Lorem.sentence(6) },
- { :id => 9, :project_id => 2, :author_id => 4, :assignee_id => 4, :title => Faker::Lorem.sentence(6) },
- { :id => 11, :project_id => 2, :author_id => 5, :assignee_id => 5, :title => Faker::Lorem.sentence(6) },
-
- { :id => 12, :project_id => 3, :author_id => 1, :assignee_id => 1, :title => Faker::Lorem.sentence(6)},
- { :id => 13, :project_id => 3, :author_id => 2, :assignee_id => 2, :title => Faker::Lorem.sentence(6)},
- { :id => 14, :project_id => 3, :author_id => 3, :assignee_id => 3, :title => Faker::Lorem.sentence(6)},
- { :id => 15, :project_id => 3, :author_id => 4, :assignee_id => 4, :title => Faker::Lorem.sentence(6)},
- { :id => 16, :project_id => 3, :author_id => 5, :assignee_id => 5, :title => Faker::Lorem.sentence(6)},
-
- { :id => 21, :project_id => 1, :author_id => 1, :assignee_id => 1, :title => Faker::Lorem.sentence(6) },
- { :id => 22, :project_id => 1, :author_id => 2, :assignee_id => 2, :title => Faker::Lorem.sentence(6) },
- { :id => 23, :project_id => 1, :author_id => 3, :assignee_id => 3, :title => Faker::Lorem.sentence(6) },
- { :id => 24, :project_id => 1, :author_id => 4, :assignee_id => 4, :title => Faker::Lorem.sentence(6) },
- { :id => 25, :project_id => 1, :author_id => 5, :assignee_id => 5, :title => Faker::Lorem.sentence(6) },
-
- { :id => 26, :project_id => 2, :author_id => 1, :assignee_id => 1, :title => Faker::Lorem.sentence(6) },
- { :id => 27, :project_id => 2, :author_id => 2, :assignee_id => 2, :title => Faker::Lorem.sentence(6) },
- { :id => 28, :project_id => 2, :author_id => 3, :assignee_id => 3, :title => Faker::Lorem.sentence(6) },
- { :id => 29, :project_id => 2, :author_id => 4, :assignee_id => 4, :title => Faker::Lorem.sentence(6) },
- { :id => 30, :project_id => 2, :author_id => 5, :assignee_id => 5, :title => Faker::Lorem.sentence(6) },
-
- { :id => 32, :project_id => 3, :author_id => 1, :assignee_id => 1, :title => Faker::Lorem.sentence(6)},
- { :id => 33, :project_id => 3, :author_id => 2, :assignee_id => 2, :title => Faker::Lorem.sentence(6)},
- { :id => 34, :project_id => 3, :author_id => 3, :assignee_id => 3, :title => Faker::Lorem.sentence(6)},
- { :id => 35, :project_id => 3, :author_id => 4, :assignee_id => 4, :title => Faker::Lorem.sentence(6)},
- { :id => 36, :project_id => 3, :author_id => 5, :assignee_id => 5, :title => Faker::Lorem.sentence(6)}
-])
-
-
-
diff --git a/db/fixtures/development/007_milestones.rb b/db/fixtures/development/005_milestones.rb
index a77f619f995..a77f619f995 100644
--- a/db/fixtures/development/007_milestones.rb
+++ b/db/fixtures/development/005_milestones.rb
diff --git a/db/fixtures/development/007_issues.rb b/db/fixtures/development/007_issues.rb
new file mode 100644
index 00000000000..d60af71e6a2
--- /dev/null
+++ b/db/fixtures/development/007_issues.rb
@@ -0,0 +1,20 @@
+(1..300).each do |i|
+ # Random Project
+ project_id = rand(2) + 1
+ project = Project.find(project_id)
+
+ # Random user
+ user = project.users.sample
+ user_id = user.id
+ IssueObserver.current_user = user
+
+ Issue.seed(:id, [{
+ id: i,
+ project_id: project_id,
+ author_id: user_id,
+ assignee_id: user_id,
+ closed: [true, false].sample,
+ milestone: project.milestones.sample,
+ title: Faker::Lorem.sentence(6)
+ }])
+end
diff --git a/db/fixtures/development/008_merge_requests.rb b/db/fixtures/development/008_merge_requests.rb
index 6e0d67c421b..8d20e628113 100644
--- a/db/fixtures/development/008_merge_requests.rb
+++ b/db/fixtures/development/008_merge_requests.rb
@@ -1,19 +1,22 @@
-MergeRequest.seed(:id, [
- { :id => 1, milestone_id: 1, project_id: 1, source_branch: 'master', target_branch: 'feature', author_id: 1, assignee_id: 1, title: Faker::Lorem.sentence(6) },
- { :id => 2, milestone_id: 1, project_id: 1, source_branch: 'master', target_branch: 'feature', author_id: 2, assignee_id: 2, title: Faker::Lorem.sentence(6) },
- { :id => 3, milestone_id: 1, project_id: 1, source_branch: 'master', target_branch: 'feature', author_id: 3, assignee_id: 3, title: Faker::Lorem.sentence(6) },
- { :id => 4, milestone_id: 1, project_id: 1, source_branch: 'master', target_branch: 'feature', author_id: 4, assignee_id: 4, title: Faker::Lorem.sentence(6) },
- { :id => 5, milestone_id: 1, project_id: 1, source_branch: 'master', target_branch: 'feature', author_id: 5, assignee_id: 5, title: Faker::Lorem.sentence(6) },
+(1..300).each do |i|
+ # Random Project
+ project_id = rand(2) + 1
+ project = Project.find(project_id)
- { :id => 6, milestone_id: 5, project_id: 2, source_branch: 'master', target_branch: 'feature', author_id: 1, assignee_id: 1, title: Faker::Lorem.sentence(6) },
- { :id => 7, milestone_id: 6, project_id: 2, source_branch: 'master', target_branch: 'feature', author_id: 2, assignee_id: 2, title: Faker::Lorem.sentence(6) },
- { :id => 8, milestone_id: 6, project_id: 2, source_branch: 'master', target_branch: 'feature', author_id: 3, assignee_id: 3, title: Faker::Lorem.sentence(6) },
- { :id => 9, milestone_id: 6, project_id: 2, source_branch: 'master', target_branch: 'feature', author_id: 4, assignee_id: 4, title: Faker::Lorem.sentence(6) },
- { :id => 11, milestone_id: 5, project_id: 2, source_branch: 'master', target_branch: 'feature', author_id: 5, assignee_id: 5, title: Faker::Lorem.sentence(6) },
+ # Random user
+ user = project.users.sample
+ user_id = user.id
+ MergeRequestObserver.current_user = user
- { :id => 12, milestone_id: 9, project_id: 3, source_branch: 'master', target_branch: 'feature', author_id: 1, assignee_id: 1, title: Faker::Lorem.sentence(6)},
- { :id => 13, milestone_id: 9, project_id: 3, source_branch: 'master', target_branch: 'feature', author_id: 2, assignee_id: 2, title: Faker::Lorem.sentence(6)},
- { :id => 14, milestone_id: 9, project_id: 3, source_branch: 'master', target_branch: 'feature', author_id: 3, assignee_id: 3, title: Faker::Lorem.sentence(6)},
- { :id => 15, milestone_id: 9, project_id: 3, source_branch: 'master', target_branch: 'feature', author_id: 4, assignee_id: 4, title: Faker::Lorem.sentence(6)},
- { :id => 16, milestone_id: 9, project_id: 3, source_branch: 'master', target_branch: 'feature', author_id: 5, assignee_id: 5, title: Faker::Lorem.sentence(6)},
-])
+ MergeRequest.seed(:id, [{
+ id: i,
+ source_branch: 'master',
+ target_branch: 'feature',
+ project_id: project_id,
+ author_id: user_id,
+ assignee_id: user_id,
+ closed: [true, false].sample,
+ milestone: project.milestones.sample,
+ title: Faker::Lorem.sentence(6)
+ }])
+end