1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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
This commit is contained in:
Jamis Buck 2006-02-28 18:57:32 +00:00
parent 9507f5dcc9
commit 1a91abe645
6 changed files with 27 additions and 10 deletions

View file

@ -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]

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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"

View file

@ -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'