Commit 56556d288d77c0cddcc12eec18b0cbe7c04f985e

Authored by Luke Baker
1 parent cdd4cab2

remove timing from test

instead of timing in test, verify that prompts aren't created when ideas are added.
Showing 1 changed file with 4 additions and 6 deletions   Show diff stats
spec/models/question_spec.rb
@@ -233,20 +233,18 @@ describe Question do @@ -233,20 +233,18 @@ describe Question do
233 @question.choices.count.should == 3 233 @question.choices.count.should == 3
234 end 234 end
235 235
236 - it "should create 2000 ideas question in less than 30 seconds" do  
237 - start = Time.now 236 + it "should create 500 ideas question without creating any prompts" do
238 @question = Factory.build(:question) 237 @question = Factory.build(:question)
239 @question.ideas = [] 238 @question.ideas = []
240 o = [('a'..'z'),('A'..'Z')].map{|i| i.to_a}.flatten 239 o = [('a'..'z'),('A'..'Z')].map{|i| i.to_a}.flatten
241 - 2000.times do 240 + 500.times do
242 @question.ideas << (0..10).map{ o[rand(o.length)] }.join 241 @question.ideas << (0..10).map{ o[rand(o.length)] }.join
243 end 242 end
244 243
245 @question.save 244 @question.save
246 - @question.choices.count.should == 2000 245 + @question.choices.count.should == 500
247 246
248 - endTime = Time.now  
249 - (endTime - start).should < 30 247 + @question.reload.prompts.count.should == 0
250 end 248 end
251 249
252 context "median response per session" do 250 context "median response per session" do