diff options
author | Rizwan Reza <rizwanreza@gmail.com> | 2010-03-29 09:52:33 +0430 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-03-28 22:38:46 -0700 |
commit | a0dc6755db71b33aebccdb95fd0dd7097c934c04 (patch) | |
tree | 6be6fe842c6544c5cc3b8afb3e7e8dade8013d23 /railties/lib/rails/test_unit/testing.rake | |
parent | 98d2d8ce2c2f332ee337b9ab2110300e1f2bf1f2 (diff) | |
download | rails-a0dc6755db71b33aebccdb95fd0dd7097c934c04.tar.gz rails-a0dc6755db71b33aebccdb95fd0dd7097c934c04.tar.bz2 rails-a0dc6755db71b33aebccdb95fd0dd7097c934c04.zip |
Reorganized app/test directory. [#3057 state:resolved]
Run 'rake update:test_directory' to reorganize your already generated apps.
test/functional -> test/controllers
test/functional -> test/controllers
test/unit/helpers -> test/helpers
test/unit/**/*_observer_test.rb -> test/observers
test/unit -> test/models
Diffstat (limited to 'railties/lib/rails/test_unit/testing.rake')
-rw-r--r-- | railties/lib/rails/test_unit/testing.rake | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake index 57857fb911..4f34707f53 100644 --- a/railties/lib/rails/test_unit/testing.rake +++ b/railties/lib/rails/test_unit/testing.rake @@ -40,7 +40,7 @@ end desc 'Run all unit, functional and integration tests' task :test do - errors = %w(test:units test:functionals test:integration).collect do |task| + errors = %w(test:models test:controllers test:helpers).collect do |task| begin Rake::Task[task].invoke nil @@ -55,8 +55,10 @@ namespace :test do Rake::TestTask.new(:recent => "db:test:prepare") do |t| since = TEST_CHANGES_SINCE touched = FileList['test/**/*_test.rb'].select { |path| File.mtime(path) > since } + - recent_tests('app/models/**/*.rb', 'test/unit', since) + - recent_tests('app/controllers/**/*.rb', 'test/functional', since) + recent_tests('app/models/**/*.rb', 'test/models', since) + + recent_tests('app/models/**/*_observer.rb', 'test/observers', since) + + recent_tests('app/controllers/**/*.rb', 'test/controllers', since) + + recent_tests('app/helpers/**/*.rb', 'test/helpers', since) t.libs << 'test' t.test_files = touched.uniq @@ -74,35 +76,39 @@ namespace :test do end models = changed_since_checkin.select { |path| path =~ /app[\\\/]models[\\\/].*\.rb$/ } + observers = changed_since_checkin.select { |path| path =~ /app[\\\/]models[\\\/].*_observer\.rb$/ } controllers = changed_since_checkin.select { |path| path =~ /app[\\\/]controllers[\\\/].*\.rb$/ } + helpers = changed_since_checkin.select { |path| path =~ /app[\\\/]helpers[\\\/].*\.rb$/ } - unit_tests = models.map { |model| "test/unit/#{File.basename(model, '.rb')}_test.rb" } - functional_tests = controllers.map { |controller| "test/functional/#{File.basename(controller, '.rb')}_test.rb" } + model_tests = models.map { |model| "test/models/#{File.basename(model, '.rb')}_test.rb" } + observer_tests = observers.map { |observer| "test/observers/#{File.basename(observer, '.rb')}_test.rb" } + controller_tests = controllers.map { |controller| "test/controllers/#{File.basename(controller, '.rb')}_test.rb" } + helper_tests = helpers.map { |helper| "test/helpers/#{File.basename(helper, '.rb')}_test.rb" } - unit_tests.uniq + functional_tests.uniq + (model_tests + observer_tests + controller_tests + helper_tests).uniq end t.libs << 'test' end Rake::Task['test:uncommitted'].comment = "Test changes since last checkin (only Subversion and Git)" - Rake::TestTask.new(:units => "db:test:prepare") do |t| + Rake::TestTask.new(:models => "db:test:prepare") do |t| t.libs << "test" - t.pattern = 'test/unit/**/*_test.rb' + t.pattern = ['test/models/**/*_test.rb', 'test/observers/**/*_test.rb'] end - Rake::Task['test:units'].comment = "Run the unit tests in test/unit" + Rake::Task['test:models'].comment = "Run the unit tests in test/models and test/observers" - Rake::TestTask.new(:functionals => "db:test:prepare") do |t| + Rake::TestTask.new(:controllers => "db:test:prepare") do |t| t.libs << "test" - t.pattern = 'test/functional/**/*_test.rb' + t.pattern = 'test/controllers/**/*_test.rb' end - Rake::Task['test:functionals'].comment = "Run the functional tests in test/functional" + Rake::Task['test:controllers'].comment = "Run the functional and integration tests in test/controllers" - Rake::TestTask.new(:integration => "db:test:prepare") do |t| + Rake::TestTask.new(:helpers => "db:test:prepare") do |t| t.libs << "test" - t.pattern = 'test/integration/**/*_test.rb' + t.pattern = 'test/helpers/**/*_test.rb' end - Rake::Task['test:integration'].comment = "Run the integration tests in test/integration" + Rake::Task['test:helpers'].comment = "Run the unit tests in test/helpers" Rake::TestTask.new(:benchmark => 'db:test:prepare') do |t| t.libs << 'test' |