Created
October 30, 2015 13:54
-
-
Save daxadax/c0e8b6bea0a17c76ef97 to your computer and use it in GitHub Desktop.
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
describe 'database performance' do | |
before { @sql_calls = 0 } | |
after { ActiveSupport::Notifications.unsubscribe(@subscription) } | |
it 'makes a minimum of db queries' do | |
@subscription = ActiveSupport::Notifications.subscribe('sql.active_record') do |event| | |
@sql_calls += 1 | |
end | |
get :index, attributes.merge(format: :json) | |
expect(@sql_calls).to be < 25 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment