Forked from danbronsema/rspec performance test
Last active
December 22, 2015 00:00
-
-
Save fabrizioc1/6385954 to your computer and use it in GitHub Desktop.
rspec performance test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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