Add performance spec

This commit is contained in:
Raphael 2010-11-25 22:44:48 -05:00
parent e56df5c159
commit 33ba00377e

View file

@ -8,8 +8,8 @@ describe AspectsController do
render_views
before do
@user = make_user
@user2 = make_user
@user = make_user
@user2 = make_user
@aspect = @user.aspects.create(:name => "lame-os")
@aspect1 = @user.aspects.create(:name => "another aspect")
@ -30,6 +30,28 @@ describe AspectsController do
get :index
assigns[:contacts].should == @user.contacts
end
context 'performance' do
before do
require 'benchmark'
@posts = []
@users = []
8.times do |n|
user = make_user
@users << user
aspect = user.aspects.create(:name => 'people')
connect_users(@user, @aspect, user, aspect)
post = @user.post(:status_message, :message => "hello#{n}", :to => @aspect1.id)
@posts << post
user.comment "yo#{post.message}", :on => post
end
end
it 'takes time' do
Benchmark.realtime{
get :index
}.should < 0
end
end
end
describe "#create" do