Skip to content
This repository
Browse code

Add performance test generator

  • Loading branch information...
commit 2e232af91f7e276904e02cbb1ea42ea24c19255b 1 parent 10c581a
Pratik authored June 19, 2008
8  railties/lib/rails_generator/generators/components/performance_test/USAGE
... ...
@@ -0,0 +1,8 @@
  1
+Description:
  2
+    Stubs out a new performance test. Pass the name of the test, either
  3
+    CamelCased or under_scored, as an argument. The new test class is
  4
+    generated in test/performance/testname_test.rb
  5
+
  6
+Example:
  7
+    `./script/generate performance_test GeneralStories` creates a GeneralStories
  8
+    performance test in test/performance/general_stories_test.rb
16  railties/lib/rails_generator/generators/components/performance_test/performance_test_generator.rb
... ...
@@ -0,0 +1,16 @@
  1
+class PerformanceTestGenerator < Rails::Generator::NamedBase
  2
+  default_options :skip_migration => false
  3
+
  4
+  def manifest
  5
+    record do |m|
  6
+      # Check for class naming collisions.
  7
+      m.class_collisions class_path, class_name, "#{class_name}Test"
  8
+
  9
+      # performance test directory
  10
+      m.directory File.join('test/performance', class_path)
  11
+
  12
+      # performance test stub
  13
+      m.template 'performance_test.rb', File.join('test/performance', class_path, "#{file_name}_test.rb")
  14
+    end
  15
+  end
  16
+end
8  railties/lib/rails_generator/generators/components/performance_test/templates/performance_test.rb
... ...
@@ -0,0 +1,8 @@
  1
+require 'performance/test_helper'
  2
+
  3
+class <%= class_name %>Test < ActionController::PerformanceTest
  4
+  # Replace this with your real tests.
  5
+  def test_homepage
  6
+    get '/'
  7
+  end
  8
+end

0 notes on commit 2e232af

Please sign in to comment.
Something went wrong with that request. Please try again.