Skip to content

Commit 0b1313f

Browse files
committed
Add RubyVM tests
These tests the number of global contants before and after running minitest. They showed that integration tests were creating a global constant which is expensive. That global constant is in `url_helpers` and the fix has been merged into master Rails.
1 parent 275dfdd commit 0b1313f

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
require 'test_helper'
2+
3+
class DocumentsControllerTest < ActionController::TestCase
4+
test "index" do
5+
get :index
6+
assert_equal 200, response.status
7+
end
8+
end
9+
10+
Minitest.run_one_method(DocumentsControllerTest, 'test_index')
11+
12+
# ruby -Ilib:test test/controllers/documents_rubyvm_index_test.rb
13+
puts RubyVM.stat
14+
Minitest.run_one_method(DocumentsControllerTest, 'test_index')
15+
puts RubyVM.stat
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
require 'test_helper'
2+
ActiveSupport::Dependencies.constantize('DocumentsController')
3+
4+
class DocumentsIntegrationTest < ActionDispatch::IntegrationTest
5+
test "index" do
6+
get '/documents'
7+
assert_equal 200, response.status
8+
end
9+
end
10+
11+
Minitest.run_one_method(DocumentsIntegrationTest, 'test_index')
12+
13+
# ruby -Ilib:test test/integration/documents_rubyvm_index_test.rb
14+
puts RubyVM.stat
15+
Minitest.run_one_method(DocumentsIntegrationTest, 'test_index')
16+
puts RubyVM.stat

0 commit comments

Comments
 (0)