diff options
Diffstat (limited to 'railties/lib/generators/rails/performance_test')
3 files changed, 30 insertions, 0 deletions
diff --git a/railties/lib/generators/rails/performance_test/USAGE b/railties/lib/generators/rails/performance_test/USAGE new file mode 100644 index 0000000000..ee82578cdb --- /dev/null +++ b/railties/lib/generators/rails/performance_test/USAGE @@ -0,0 +1,10 @@ +Description: + Stubs out a new performance test. Pass the name of the test, either + CamelCased or under_scored, as an argument. + + This generator invokes the current performance tool, which defaults to + TestUnit. + +Example: + `./script/generate performance_test GeneralStories` creates a GeneralStories + performance test in test/performance/general_stories_test.rb diff --git a/railties/lib/generators/rails/performance_test/performance_test_generator.rb b/railties/lib/generators/rails/performance_test/performance_test_generator.rb new file mode 100644 index 0000000000..b8efda8df3 --- /dev/null +++ b/railties/lib/generators/rails/performance_test/performance_test_generator.rb @@ -0,0 +1,11 @@ +module Rails + module Generators + class PerformanceTestGenerator < NamedBase + check_class_collision :suffix => "Test" + + def create_test_files + template 'performance_test.rb', File.join('test/performance', class_path, "#{file_name}_test.rb") + end + end + end +end diff --git a/railties/lib/generators/rails/performance_test/templates/performance_test.rb b/railties/lib/generators/rails/performance_test/templates/performance_test.rb new file mode 100644 index 0000000000..27c91b0fca --- /dev/null +++ b/railties/lib/generators/rails/performance_test/templates/performance_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' +require 'performance_test_help' + +class <%= class_name %>Test < ActionController::PerformanceTest + # Replace this with your real tests. + def test_homepage + get '/' + end +end |