diff --git a/test/integration/performance_test.rb b/test/integration/performance_test.rb index a25f43d..cfd114f 100644 --- a/test/integration/performance_test.rb +++ b/test/integration/performance_test.rb @@ -22,16 +22,20 @@ class PerformanceTest < ActionController::IntegrationTest should 'not have a linear increase in time to display a blog page' do person = create_profile('clueless') + person0 = create_profile('person0') + person1 = create_profile('person1') + create_posts(person1, 50) + person2 = create_profile('person2') + create_posts(person2, 100) + # no posts - time0 = (Benchmark.measure { get '/clueless/blog' }) + time0 = (Benchmark.measure { get '/person0/blog' }) # first 50 - create_posts(person) - time1 = (Benchmark.measure { get '/clueless/blog' }) + time1 = (Benchmark.measure { get '/person1/blog' }) # another 50 - create_posts(person) - time2 = (Benchmark.measure { get '/clueless/blog' }) + time2 = (Benchmark.measure { get '/person2/blog' }) # should not scale linearly, i.e. the inclination of the first segment must # be a lot higher than the one of the segment segment. To compensate for @@ -51,10 +55,10 @@ class PerformanceTest < ActionController::IntegrationTest person end - def create_posts(profile) + def create_posts(profile, n) postnumber = profile.articles.count blog = profile.blog - 50.times do |i| + n.times do |i| postnumber += 1 TinyMceArticle.create!(:profile => profile, :parent => blog, :name => "post number #{postnumber}") end -- libgit2 0.21.2