Last active
August 29, 2015 14:03
-
-
Save tgxworld/6851db8cfb2ce143e53b 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
# Before: Subscribing and unsubscribing to `/render_template.action_view/` every test. | |
Calculating ------------------------------------- | |
Integration Test 67 i/100ms | |
Functional Test 91 i/100ms | |
------------------------------------------------- | |
Integration Test 691.5 (±6.9%) i/s - 3484 in 5.063611s | |
Functional Test 938.4 (±5.4%) i/s - 4732 in 5.058631s | |
# After: Subscribing to `/render_template.actione_view/` only once. | |
Calculating ------------------------------------- | |
Integration Test 72 i/100ms | |
Functional Test 97 i/100ms | |
------------------------------------------------- | |
Integration Test 735.3 (±6.9%) i/s - 3672 in 5.019675s | |
Functional Test 963.9 (±5.6%) i/s - 4850 in 5.048307s |
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://www.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(5) 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 |
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
class UsersController < ApplicationController | |
before_action :set_user, only: [:show, :edit, :update, :destroy] | |
# GET /users | |
# GET /users.json | |
def index | |
render plain: 'ok' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment