Add performance spec
This commit is contained in:
parent
e56df5c159
commit
33ba00377e
1 changed files with 24 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue