|
1 |
| -MergeRequest.seed(:id, [ |
2 |
| - { :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) }, |
3 |
| - { :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) }, |
4 |
| - { :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) }, |
5 |
| - { :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) }, |
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 | +(1..300).each do |i| |
| 2 | + # Random Project |
| 3 | + project_id = rand(2) + 1 |
| 4 | + project = Project.find(project_id) |
7 | 5 |
|
8 |
| - { :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) }, |
9 |
| - { :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) }, |
10 |
| - { :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) }, |
11 |
| - { :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) }, |
12 |
| - { :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) }, |
| 6 | + # Random user |
| 7 | + user = project.users.sample |
| 8 | + user_id = user.id |
| 9 | + MergeRequestObserver.current_user = user |
13 | 10 |
|
14 |
| - { :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)}, |
15 |
| - { :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)}, |
16 |
| - { :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)}, |
17 |
| - { :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)}, |
18 |
| - { :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)}, |
19 |
| -]) |
| 11 | + MergeRequest.seed(:id, [{ |
| 12 | + id: i, |
| 13 | + source_branch: 'master', |
| 14 | + target_branch: 'feature', |
| 15 | + project_id: project_id, |
| 16 | + author_id: user_id, |
| 17 | + assignee_id: user_id, |
| 18 | + closed: [true, false].sample, |
| 19 | + milestone: project.milestones.sample, |
| 20 | + title: Faker::Lorem.sentence(6) |
| 21 | + }]) |
| 22 | +end |
0 commit comments