Skip to content
This repository
Browse code

Add integration test support to app generation and testing

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3702 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 1a91abe6450b5bcb2a7fe1de1494b12c34288e50 1 parent 9507f5d
Jamis Buck authored
2  railties/CHANGELOG
... ...
@@ -1,5 +1,7 @@
1 1
 *SVN*
2 2
 
  3
+* Add integration test support to app generation and testing [Jamis Buck]
  4
+
3 5
 * Added namespaces to all tasks, so for example load_fixtures is now db:fixtures:load. All the old task names are still valid, they just point to the new namespaced names. "rake -T" will only show the namespaced ones, though [DHH]
4 6
 
5 7
 * CHANGED DEFAULT: ActiveRecord::Base.schema_format is now :ruby by default instead of :sql. This means that we'll assume you want to live in the world of db/schema.rb where the grass is green and the girls are pretty. If your schema contains un-dumpable elements, such as constraints or database-specific column types, you just got an invitation to either 1) patch the dumper to include foreign key support, 2) stop being db specific, or 3) just change the default in config/environment.rb to config.active_record.schema_format = :sql -- we even include an example for that on new Rails skeletons now. Brought to you by the federation of opinionated framework builders! [DHH]
2  railties/lib/code_statistics.rb
... ...
@@ -1,6 +1,6 @@
1 1
 class CodeStatistics #:nodoc:
2 2
 
3  
-  TEST_TYPES = ['Units', 'Functionals', 'Unit tests', 'Functional tests']
  3
+  TEST_TYPES = %w(Units Functionals Unit\ tests Functional\ tests Integration\ tests)
4 4
 
5 5
   def initialize(*pairs)
6 6
     @pairs      = pairs
1  railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -124,6 +124,7 @@ def mysql_socket_location
124 124
     script/process
125 125
     test/fixtures
126 126
     test/functional
  127
+    test/integration
127 128
     test/mocks/development
128 129
     test/mocks/test
129 130
     test/unit
17  railties/lib/tasks/statistics.rake
... ...
@@ -1,12 +1,13 @@
1 1
 STATS_DIRECTORIES = [
2  
-  %w(Helpers           app/helpers), 
3  
-  %w(Controllers       app/controllers), 
4  
-  %w(APIs              app/apis),
5  
-  %w(Components        components),
6  
-  %w(Functional\ tests test/functional),
7  
-  %w(Models            app/models),
8  
-  %w(Unit\ tests       test/unit),
9  
-  %w(Libraries         lib/)
  2
+  %w(Helpers            app/helpers), 
  3
+  %w(Controllers        app/controllers), 
  4
+  %w(APIs               app/apis),
  5
+  %w(Components         components),
  6
+  %w(Functional\ tests  test/functional),
  7
+  %w(Models             app/models),
  8
+  %w(Unit\ tests        test/unit),
  9
+  %w(Libraries          lib/),
  10
+  %w(Integration\ tests test/integration)
10 11
 ].collect { |name, dir| [ name, "#{RAILS_ROOT}/#{dir}" ] }.select { |name, dir| File.directory?(dir) }
11 12
 
12 13
 desc "Report code statistics (KLOCs, etc) from the application"
14  railties/lib/tasks/testing.rake
@@ -13,8 +13,13 @@ end
13 13
 
14 14
 desc 'Test all units and functionals'
15 15
 task :test do
16  
-  Rake::Task["test:units"].invoke      rescue got_error = true
  16
+  Rake::Task["test:units"].invoke       rescue got_error = true
17 17
   Rake::Task["test:functionals"].invoke rescue got_error = true
  18
+  
  19
+  if File.exist?("test/integration")
  20
+    Rake::Task["test:integration"].invoke rescue got_error = true
  21
+  end
  22
+
18 23
   raise "Test failures" if got_error
19 24
 end
20 25
 
@@ -45,6 +50,13 @@ namespace :test do
45 50
     t.verbose = true
46 51
   end
47 52
 
  53
+  desc "Run the integration tests in test/integration"
  54
+  Rake::TestTask.new(:integration => "db:test:prepare") do |t|
  55
+    t.libs << "test"
  56
+    t.pattern = 'test/integration/**/*_test.rb'
  57
+    t.verbose = true
  58
+  end
  59
+
48 60
   desc "Run the plugin tests in vendor/plugins/**/test (or specify with PLUGIN=name)"
49 61
   Rake::TestTask.new(:plugins => :environment) do |t|
50 62
     t.libs << "test"
1  railties/lib/test_help.rb
@@ -7,6 +7,7 @@
7 7
 require 'test/unit'
8 8
 require 'active_record/fixtures'
9 9
 require 'action_controller/test_process'
  10
+require 'action_controller/integration_test'
10 11
 require 'action_web_service/test_invoke'
11 12
 require 'breakpoint'
12 13
 

0 notes on commit 1a91abe

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