Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
railties/lib/rails_generator/generators/components/performance_test/USAGE
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Description: | ||
Stubs out a new performance test. Pass the name of the test, either | ||
CamelCased or under_scored, as an argument. The new test class is | ||
generated in test/performance/testname_test.rb | ||
|
||
Example: | ||
`./script/generate performance_test GeneralStories` creates a GeneralStories | ||
performance test in test/performance/general_stories_test.rb |
16 changes: 16 additions & 0 deletions
16
.../lib/rails_generator/generators/components/performance_test/performance_test_generator.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class PerformanceTestGenerator < Rails::Generator::NamedBase | ||
default_options :skip_migration => false | ||
|
||
def manifest | ||
record do |m| | ||
# Check for class naming collisions. | ||
m.class_collisions class_path, class_name, "#{class_name}Test" | ||
|
||
# performance test directory | ||
m.directory File.join('test/performance', class_path) | ||
|
||
# performance test stub | ||
m.template 'performance_test.rb', File.join('test/performance', class_path, "#{file_name}_test.rb") | ||
end | ||
end | ||
end |
8 changes: 8 additions & 0 deletions
8
.../lib/rails_generator/generators/components/performance_test/templates/performance_test.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'performance/test_helper' | ||
|
||
class <%= class_name %>Test < ActionController::PerformanceTest | ||
# Replace this with your real tests. | ||
def test_homepage | ||
get '/' | ||
end | ||
end |