perfomance_fixtures.rb

Marius BALTEANU, 2022-06-27 21:13

Download (423 Bytes)

 
1
require File.expand_path('../test_helper', __FILE__)
2

    
3
# Create projects
4
p = 0
5
while p <= 500
6
  Project.generate!
7
  p += 1
8
end
9

    
10
# Create custom fields
11
c = 0
12
while c <= 50
13
  IssueCustomField.generate!(name: "Cf #{c}", is_for_all: true, is_filter: true)
14
  c += 1
15
end
16

    
17
# Create issues
18
i = 0
19
while i <= 5000
20
  p_id = rand(Project.first.id..Project.last.id)
21
  Issue.generate!(subject: "Issue #{i}", project_id: p_id)
22
  i += 1
23
end