Commit c99242f970433a35def7e2d24487ed5724517f2d
1 parent
119bad22
Exists in
master
and in
1 other branch
add test for creating 2000 ideas in < 20 seconds
Showing
1 changed file
with
16 additions
and
0 deletions
Show diff stats
spec/models/question_spec.rb
... | ... | @@ -232,6 +232,22 @@ describe Question do |
232 | 232 | @question.save |
233 | 233 | @question.choices.count.should == 3 |
234 | 234 | end |
235 | + | |
236 | + it "should create 2000 ideas question in less than 20 seconds" do | |
237 | + start = Time.now | |
238 | + @question = Factory.build(:question) | |
239 | + @question.ideas = [] | |
240 | + o = [('a'..'z'),('A'..'Z')].map{|i| i.to_a}.flatten | |
241 | + 2000.times do | |
242 | + @question.ideas << (0..10).map{ o[rand(o.length)] }.join | |
243 | + end | |
244 | + | |
245 | + @question.save | |
246 | + @question.choices.count.should == 2000 | |
247 | + | |
248 | + endTime = Time.now | |
249 | + (endTime - start).should < 20 | |
250 | + end | |
235 | 251 | context "catchup algorithm" do |
236 | 252 | before(:all) do |
237 | 253 | @catchup_q = Factory.create(:aoi_question) | ... | ... |