From 4b66180ccad53940b18ca1a4350159b1fcf2695c Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Sat, 25 Mar 2006 19:57:03 +0000 Subject: Add an integration test generator git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4027 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/CHANGELOG | 2 ++ .../generators/components/integration_test/USAGE | 14 ++++++++++++++ .../integration_test/integration_test_generator.rb | 16 ++++++++++++++++ .../integration_test/templates/integration_test.rb | 4 ++++ 4 files changed, 36 insertions(+) create mode 100644 railties/lib/rails_generator/generators/components/integration_test/USAGE create mode 100644 railties/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb create mode 100644 railties/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 84f9727171..1142e8ac56 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Add an integration_test generator [Jamis Buck] + * Make all ActionView helpers available in the console from the helper method for debugging purposes. n.b.: Only an 80% solution. Some stuff won't work, most will. [Marcel Molina Jr.] ex. diff --git a/railties/lib/rails_generator/generators/components/integration_test/USAGE b/railties/lib/rails_generator/generators/components/integration_test/USAGE new file mode 100644 index 0000000000..d1ed71a408 --- /dev/null +++ b/railties/lib/rails_generator/generators/components/integration_test/USAGE @@ -0,0 +1,14 @@ +Description: + The model generator creates a stub for a new integration test. + + The generator takes an integration test name as its argument. The test + name may be given in CamelCase or under_score and should not be suffixed + with 'Test'. + + The generator creates an integration test class in test/integration. + +Example: + ./script/generate integration_test GeneralStories + + This will create a GeneralStores integration test: + test/integration/general_stories_test.rb diff --git a/railties/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb b/railties/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb new file mode 100644 index 0000000000..90fa96938b --- /dev/null +++ b/railties/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb @@ -0,0 +1,16 @@ +class IntegrationTestGenerator < 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" + + # integration test directory + m.directory File.join('test/integration', class_path) + + # integration test stub + m.template 'integration_test.rb', File.join('test/integration', class_path, "#{file_name}_test.rb") + end + end +end diff --git a/railties/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb b/railties/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb new file mode 100644 index 0000000000..5f9bd829e0 --- /dev/null +++ b/railties/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb @@ -0,0 +1,4 @@ +require "#{File.dirname(__FILE__)}<%= '/..' * class_nesting_depth %>/../test_helper" + +class <%= class_name %>Test < ActionController::IntegrationTest +end -- cgit v1.2.3