aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/lib/code_statistics.rb2
-rw-r--r--railties/lib/rails_generator/generators/applications/app/app_generator.rb1
-rw-r--r--railties/lib/tasks/statistics.rake17
-rw-r--r--railties/lib/tasks/testing.rake14
-rw-r--r--railties/lib/test_help.rb1
6 files changed, 27 insertions, 10 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index 8df21ee5f2..ba834e847c 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Add integration test support to app generation and testing [Jamis Buck]
+
* 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]
* 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]
diff --git a/railties/lib/code_statistics.rb b/railties/lib/code_statistics.rb
index f1c0bf1f6a..e99d876e44 100644
--- a/railties/lib/code_statistics.rb
+++ b/railties/lib/code_statistics.rb
@@ -1,6 +1,6 @@
class CodeStatistics #:nodoc:
- TEST_TYPES = ['Units', 'Functionals', 'Unit tests', 'Functional tests']
+ TEST_TYPES = %w(Units Functionals Unit\ tests Functional\ tests Integration\ tests)
def initialize(*pairs)
@pairs = pairs
diff --git a/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
index f6544e7ced..6f55084c34 100644
--- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb
+++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -124,6 +124,7 @@ class AppGenerator < Rails::Generator::Base
script/process
test/fixtures
test/functional
+ test/integration
test/mocks/development
test/mocks/test
test/unit
diff --git a/railties/lib/tasks/statistics.rake b/railties/lib/tasks/statistics.rake
index 01c944d558..87b89e5198 100644
--- a/railties/lib/tasks/statistics.rake
+++ b/railties/lib/tasks/statistics.rake
@@ -1,12 +1,13 @@
STATS_DIRECTORIES = [
- %w(Helpers app/helpers),
- %w(Controllers app/controllers),
- %w(APIs app/apis),
- %w(Components components),
- %w(Functional\ tests test/functional),
- %w(Models app/models),
- %w(Unit\ tests test/unit),
- %w(Libraries lib/)
+ %w(Helpers app/helpers),
+ %w(Controllers app/controllers),
+ %w(APIs app/apis),
+ %w(Components components),
+ %w(Functional\ tests test/functional),
+ %w(Models app/models),
+ %w(Unit\ tests test/unit),
+ %w(Libraries lib/),
+ %w(Integration\ tests test/integration)
].collect { |name, dir| [ name, "#{RAILS_ROOT}/#{dir}" ] }.select { |name, dir| File.directory?(dir) }
desc "Report code statistics (KLOCs, etc) from the application"
diff --git a/railties/lib/tasks/testing.rake b/railties/lib/tasks/testing.rake
index 6d846e1cc0..6fedcdb7e3 100644
--- a/railties/lib/tasks/testing.rake
+++ b/railties/lib/tasks/testing.rake
@@ -13,8 +13,13 @@ end
desc 'Test all units and functionals'
task :test do
- Rake::Task["test:units"].invoke rescue got_error = true
+ Rake::Task["test:units"].invoke rescue got_error = true
Rake::Task["test:functionals"].invoke rescue got_error = true
+
+ if File.exist?("test/integration")
+ Rake::Task["test:integration"].invoke rescue got_error = true
+ end
+
raise "Test failures" if got_error
end
@@ -45,6 +50,13 @@ namespace :test do
t.verbose = true
end
+ desc "Run the integration tests in test/integration"
+ Rake::TestTask.new(:integration => "db:test:prepare") do |t|
+ t.libs << "test"
+ t.pattern = 'test/integration/**/*_test.rb'
+ t.verbose = true
+ end
+
desc "Run the plugin tests in vendor/plugins/**/test (or specify with PLUGIN=name)"
Rake::TestTask.new(:plugins => :environment) do |t|
t.libs << "test"
diff --git a/railties/lib/test_help.rb b/railties/lib/test_help.rb
index 9238d1e244..4eea71aa79 100644
--- a/railties/lib/test_help.rb
+++ b/railties/lib/test_help.rb
@@ -7,6 +7,7 @@ silence_warnings { RAILS_ENV = "test" }
require 'test/unit'
require 'active_record/fixtures'
require 'action_controller/test_process'
+require 'action_controller/integration_test'
require 'action_web_service/test_invoke'
require 'breakpoint'