Permalink
Browse files

add tests for performance test

  • Loading branch information...
1 parent 25288c1 commit ebc5ef0e6662cb3aa0b5098e23b39eb56364b235 @janx janx committed May 5, 2011
Showing with 29 additions and 0 deletions.
  1. +4 −0 Gemfile
  2. +25 −0 railties/test/application/test_test.rb
View
@@ -21,6 +21,10 @@ group :doc do
gem "RedCloth", "~> 4.2" if RUBY_VERSION < "1.9.3"
end
+group :test do
+ gem "ruby-prof"
+end
+
# AS
gem "memcache-client", ">= 1.8.5"
@@ -65,6 +65,31 @@ def test_index
run_test 'integration/posts_test.rb'
end
+ test "performance test" do
+ controller 'posts', <<-RUBY
+ class PostsController < ActionController::Base
+ end
+ RUBY
+
+ app_file 'app/views/posts/index.html.erb', <<-HTML
+ Posts#index
+ HTML
+
+ app_file 'test/performance/posts_test.rb', <<-RUBY
+ require 'test_helper'
+ require 'rails/performance_test_help'
+
+ class PostsTest < ActionDispatch::PerformanceTest
+ def test_index
+ get '/posts'
+ assert_response :success
+ end
+ end
+ RUBY
+
+ run_test 'performance/posts_test.rb'
+ end
+
private
def run_test(name)
result = ruby '-Itest', "#{app_path}/test/#{name}"

0 comments on commit ebc5ef0

Please sign in to comment.