Skip to content

Instantly share code, notes, and snippets.

@dynamicguy
Forked from danbronsema/rspec performance test
Created April 8, 2013 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dynamicguy/5335476 to your computer and use it in GitHub Desktop.
Save dynamicguy/5335476 to your computer and use it in GitHub Desktop.
context 'performance' do
before do
require 'benchmark'
@posts = []
@users = []
8.times do |n|
user = Factory.create(:user)
@users << user
aspect = user.aspects.create(:name => 'people')
connect_users(@user, @aspect0, user, aspect)
post = @user.post(:status_message, :message => "hello#{n}", :to => @aspect1.id)
@posts << post
8.times do |n|
user.comment "yo#{post.message}", :on => post
end
end
end
it 'takes time' do
Benchmark.realtime{
get :index
}.should < 1.5
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment