Last active
August 29, 2015 14:02
-
-
Save tgxworld/dfb2335485de59193add to your computer and use it in GitHub Desktop.
Benchmark with Large RouteSet
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
<h1>Listing users</h1> | |
<table> | |
<thead> | |
<tr> | |
<th colspan="3"></th> | |
</tr> | |
</thead> | |
<tbody> | |
<% @users.each do |user| %> | |
<tr> | |
<td><%= link_to 'Show', user %></td> | |
<td><%= link_to 'Edit', edit_user_path(user) %></td> | |
<td><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %></td> | |
</tr> | |
<% end %> | |
</tbody> | |
</table> | |
<br> | |
<%= link_to 'New User', new_user_path %> |
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
Rails.application.routes.draw do | |
resources :a | |
resources :b | |
resources :c | |
resources :d | |
resources :e | |
resources :f | |
resources :g | |
resources :h | |
resources :i | |
resources :j | |
resources :k | |
resources :l | |
resources :m | |
resources :n | |
resources :o | |
resources :p | |
resources :q | |
resources :r | |
resources :s | |
resources :t | |
resources :u | |
resources :v | |
resources :w | |
resources :x | |
resources :y | |
resources :z | |
resources :users do | |
resources :posts do | |
resources :apples do | |
resources :pears do | |
resources :a do | |
resources :b | |
end | |
end | |
end | |
end | |
end | |
end |
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
require 'test_helper' | |
require 'benchmark/ips' | |
class UserFlowTest < ActionDispatch::IntegrationTest | |
def test_index | |
get 'http://example.com/users' | |
assert_equal 200, response.status | |
end | |
end | |
class UserFlowTest2 < ActionController::TestCase | |
tests UsersController | |
def test_index | |
get :index | |
assert_equal 200, response.status | |
end | |
end | |
Benchmark.ips(30) do |bm| | |
bm.report 'Integration Test' do | |
Minitest.run_one_method(UserFlowTest, 'test_index') | |
end | |
bm.report 'Functional Test' do | |
Minitest.run_one_method(UserFlowTest2, 'test_index') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment