Skip to content
This repository
Browse code

Merge abstract_controller/test_helper and new_base/test_helper since …

…they are expected to run in the same testing sandbox
  • Loading branch information...
commit 6d214c953b74c40d6247dfd2d4526991a0f99f5c 1 parent 199a423
Joshua Peek josh authored

Showing 26 changed files with 49 additions and 100 deletions. Show diff stats Hide diff stats

  1. +4 27 actionpack/Rakefile
  2. +1 1  actionpack/test/abstract_controller/abstract_controller_test.rb
  3. +2 2 actionpack/test/abstract_controller/callbacks_test.rb
  4. +1 1  actionpack/test/abstract_controller/helper_test.rb
  5. +1 1  actionpack/test/abstract_controller/layouts_test.rb
  6. +0 24 actionpack/test/abstract_controller/test_helper.rb
  7. +8 2 actionpack/test/{new_base/test_helper.rb → abstract_unit2.rb}
  8. +3 3 actionpack/test/{lib → }/active_record_unit.rb
  9. +2 2 actionpack/test/new_base/base_test.rb
  10. +2 2 actionpack/test/new_base/content_negotiation_test.rb
  11. +1 1  actionpack/test/new_base/content_type_test.rb
  12. +2 2 actionpack/test/new_base/etag_test.rb
  13. +1 2  actionpack/test/new_base/metal_test.rb
  14. +1 1  actionpack/test/new_base/middleware_test.rb
  15. +0 1  actionpack/test/new_base/redirect_test.rb
  16. +2 2 actionpack/test/new_base/render_action_test.rb
  17. +2 2 actionpack/test/new_base/render_file_test.rb
  18. +2 2 actionpack/test/new_base/render_implicit_action_test.rb
  19. +2 2 actionpack/test/new_base/render_layout_test.rb
  20. +2 2 actionpack/test/new_base/render_partial_test.rb
  21. +2 2 actionpack/test/new_base/render_rjs_test.rb
  22. +2 2 actionpack/test/new_base/render_template_test.rb
  23. +2 2 actionpack/test/new_base/render_test.rb
  24. +2 2 actionpack/test/new_base/render_text_test.rb
  25. +2 2 actionpack/test/new_base/render_xml_test.rb
  26. +0 8 actionpack/test/runner
31 actionpack/Rakefile
@@ -34,11 +34,8 @@ end
34 34 desc "Run all unit tests"
35 35 task :test => [:test_action_pack, :test_active_record_integration, :test_new_base]
36 36
37   -test_lib_dirs = ENV["NEW"] ? ["test/new_base"] : []
38   -test_lib_dirs.push "test", "test/lib"
39   -# test_lib_dirs = [ENV["NEW"] ? "test/new_base" : "test", "test/lib"]
40 37 Rake::TestTask.new(:test_action_pack) do |t|
41   - t.libs.concat test_lib_dirs
  38 + t.libs << 'test'
42 39
43 40 # make sure we include the tests in alphabetical order as on some systems
44 41 # this will not happen automatically and the tests (as a whole) will error
@@ -51,44 +48,24 @@ end
51 48 task :isolated_test do
52 49 ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
53 50 Dir.glob("test/{controller,dispatch,template}/**/*_test.rb").all? do |file|
54   - system(ruby, "-Ilib:#{test_lib_dirs * ':'}", file)
  51 + system(ruby, "-Itest", file)
55 52 end or raise "Failures"
56 53 end
57 54
58 55 desc 'ActiveRecord Integration Tests'
59 56 Rake::TestTask.new(:test_active_record_integration) do |t|
60   - t.libs.concat test_lib_dirs
  57 + t.libs << 'test'
61 58 t.test_files = Dir.glob("test/activerecord/*_test.rb")
62 59 t.verbose = true
63 60 end
64 61
65 62 desc 'New Controller Tests'
66 63 Rake::TestTask.new(:test_new_base) do |t|
67   - t.libs << "test/new_base" << "test/lib"
  64 + t.libs << 'test'
68 65 t.test_files = Dir.glob("test/{abstract_controller,new_base}/*_test.rb")
69 66 t.verbose = true
70 67 end
71 68
72   -desc 'Old Controller Tests on New Base'
73   -Rake::TestTask.new(:test_new_base_on_old_tests) do |t|
74   - t.libs << "test/new_base" << "test/lib"
75   -
76   - t.verbose = true
77   - # ==== Not ported
78   - # * filters
79   -
80   - t.test_files = Dir.glob( "test/{dispatch,template}/**/*_test.rb" ).sort + %w(
81   - action_pack_assertions addresses_render assert_select
82   - base benchmark caching capture content_type cookie dispatcher
83   - filter_params flash helper http_basic_authentication
84   - http_digest_authentication integration layout logging mime_responds
85   - record_identifier redirect render render_js render_json
86   - render_other render_xml request_forgery_protection rescue
87   - resources routing selector send_file test url_rewriter
88   - verification view_paths webservice
89   - ).map { |name| "test/controller/#{name}_test.rb" }
90   -end
91   -
92 69 # Genereate the RDoc documentation
93 70
94 71 Rake::RDocTask.new { |rdoc|
2  actionpack/test/abstract_controller/abstract_controller_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 module AbstractController
4 4 module Testing
4 actionpack/test/abstract_controller/callbacks_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 module AbstractController
4 4 module Testing
@@ -235,4 +235,4 @@ class TestHalting < ActiveSupport::TestCase
235 235 end
236 236
237 237 end
238   -end
  238 +end
2  actionpack/test/abstract_controller/helper_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 module AbstractController
4 4 module Testing
2  actionpack/test/abstract_controller/layouts_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2 require 'active_support/core_ext/class/removal'
3 3
4 4 module AbstractControllerTests
24 actionpack/test/abstract_controller/test_helper.rb
... ... @@ -1,24 +0,0 @@
1   -$:.unshift(File.dirname(__FILE__) + '/../../lib')
2   -$:.unshift(File.dirname(__FILE__) + '/../../../activesupport/lib')
3   -$:.unshift(File.dirname(__FILE__) + '/../lib')
4   -
5   -bundler = File.join(File.dirname(__FILE__), '..', '..', 'vendor', 'gems', 'environment')
6   -require bundler if File.exist?("#{bundler}.rb")
7   -
8   -require 'rubygems'
9   -require 'test/unit'
10   -require 'active_support'
11   -require 'active_support/test_case'
12   -require 'abstract_controller'
13   -require 'action_view'
14   -require 'action_view/base'
15   -require 'action_dispatch'
16   -require 'fixture_template'
17   -
18   -begin
19   - require 'ruby-debug'
20   - Debugger.settings[:autoeval] = true
21   - Debugger.start
22   -rescue LoadError
23   - # Debugging disabled. `gem install ruby-debug` to enable.
24   -end
10 actionpack/test/new_base/test_helper.rb → actionpack/test/abstract_unit2.rb
... ... @@ -1,6 +1,9 @@
1   -$:.unshift(File.dirname(__FILE__) + '/../../lib')
2   -$:.unshift(File.dirname(__FILE__) + '/../../../activesupport/lib')
  1 +# TODO: Unify with abstract_unit
  2 +
  3 +$:.unshift(File.dirname(__FILE__) + '/../lib')
  4 +$:.unshift(File.dirname(__FILE__) + '/../../activesupport/lib')
3 5 $:.unshift(File.dirname(__FILE__) + '/../lib')
  6 +$:.unshift(File.dirname(__FILE__) + '/lib')
4 7
5 8 bundler = File.join(File.dirname(__FILE__), '..', '..', 'vendor', 'gems', 'environment')
6 9 require bundler if File.exist?("#{bundler}.rb")
@@ -8,7 +11,10 @@
8 11 require 'test/unit'
9 12 require 'active_support'
10 13 require 'active_support/test_case'
  14 +require 'abstract_controller'
11 15 require 'action_view'
  16 +require 'action_view/base'
  17 +require 'action_dispatch'
12 18 require 'fixture_template'
13 19
14 20 begin
6 actionpack/test/lib/active_record_unit.rb → actionpack/test/active_record_unit.rb
@@ -16,7 +16,7 @@ class ActiveRecordTestConnector
16 16 else
17 17 $stderr.print 'Attempting to load Active Record... '
18 18 begin
19   - PATH_TO_AR = "#{File.dirname(__FILE__)}/../../../activerecord/lib"
  19 + PATH_TO_AR = "#{File.dirname(__FILE__)}/../../activerecord/lib"
20 20 raise LoadError, "#{PATH_TO_AR} doesn't exist" unless File.directory?(PATH_TO_AR)
21 21 $LOAD_PATH.unshift PATH_TO_AR
22 22 require 'active_record'
@@ -72,13 +72,13 @@ def setup_connection
72 72
73 73 # Load actionpack sqlite tables
74 74 def load_schema
75   - File.read(File.dirname(__FILE__) + "/../fixtures/db_definitions/sqlite.sql").split(';').each do |sql|
  75 + File.read(File.dirname(__FILE__) + "/fixtures/db_definitions/sqlite.sql").split(';').each do |sql|
76 76 ActiveRecord::Base.connection.execute(sql) unless sql.blank?
77 77 end
78 78 end
79 79
80 80 def require_fixture_models
81   - Dir.glob(File.dirname(__FILE__) + "/../fixtures/*.rb").each {|f| require f}
  81 + Dir.glob(File.dirname(__FILE__) + "/fixtures/*.rb").each {|f| require f}
82 82 end
83 83 end
84 84 end
4 actionpack/test/new_base/base_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 # Tests the controller dispatching happy path
4 4 module Dispatching
@@ -65,4 +65,4 @@ class BaseTest < SimpleRouteCase
65 65 assert_equal 'contained_empty', Submodule::ContainedEmptyController.controller_name
66 66 end
67 67 end
68   -end
  68 +end
4 actionpack/test/new_base/content_negotiation_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 module ContentNegotiation
4 4
@@ -15,4 +15,4 @@ class TestContentNegotiation < SimpleRouteCase
15 15 assert_body "Hello world */*!"
16 16 end
17 17 end
18   -end
  18 +end
2  actionpack/test/new_base/content_type_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 module ContentType
4 4 class BaseController < ActionController::Base
4 actionpack/test/new_base/etag_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 module Etags
4 4 class BasicController < ActionController::Base
@@ -43,4 +43,4 @@ def etag_for(text)
43 43 %("#{Digest::MD5.hexdigest(text)}")
44 44 end
45 45 end
46   -end
  46 +end
3  actionpack/test/new_base/metal_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 module MetalTest
4 4 class MetalMiddleware < ActionController::Middleware
@@ -41,4 +41,3 @@ def setup
41 41 end
42 42 end
43 43 end
44   -
2  actionpack/test/new_base/middleware_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 module MiddlewareTest
4 4 class MyMiddleware
1  actionpack/test/new_base/redirect_test.rb
... ... @@ -1 +0,0 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
4 actionpack/test/new_base/render_action_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 module RenderAction
4 4 # This has no layout and it works
@@ -317,4 +317,4 @@ class ControllerLayoutTest < SimpleRouteCase
317 317 assert_status 200
318 318 end
319 319 end
320   -end
  320 +end
4 actionpack/test/new_base/render_file_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 module RenderFile
4 4
@@ -107,4 +107,4 @@ def teardown
107 107 end
108 108 end
109 109
110   -end
  110 +end
4 actionpack/test/new_base/render_implicit_action_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 module RenderImplicitAction
4 4 class SimpleController < ::ApplicationController
@@ -25,4 +25,4 @@ class RenderImplicitActionTest < SimpleRouteCase
25 25 assert_status 200
26 26 end
27 27 end
28   -end
  28 +end
4 actionpack/test/new_base/render_layout_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 module ControllerLayouts
4 4 class ImplicitController < ::ApplicationController
@@ -98,4 +98,4 @@ class MismatchFormatTest < SimpleRouteCase
98 98 end
99 99 end
100 100 end
101   -end
  101 +end
4 actionpack/test/new_base/render_partial_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 module RenderPartial
4 4
@@ -24,4 +24,4 @@ class TestPartial < SimpleRouteCase
24 24 end
25 25 end
26 26
27   -end
  27 +end
4 actionpack/test/new_base/render_rjs_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 module RenderRjs
4 4
@@ -42,4 +42,4 @@ class TestBasic < SimpleRouteCase
42 42 end
43 43
44 44 end
45   -end
  45 +end
4 actionpack/test/new_base/render_template_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 module RenderTemplate
4 4 class WithoutLayoutController < ActionController::Base
@@ -167,4 +167,4 @@ class TestTemplateRenderWithForwardSlash < SimpleRouteCase
167 167 end
168 168 end
169 169 end
170   -end
  170 +end
4 actionpack/test/new_base/render_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 module Render
4 4 class BlankRenderController < ActionController::Base
@@ -82,4 +82,4 @@ class TestVariousObjectsAvailableInView < SimpleRouteCase
82 82 assert_body "Controller Name: blank_render"
83 83 end
84 84 end
85   -end
  85 +end
4 actionpack/test/new_base/render_text_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 module RenderText
4 4 class SimpleController < ActionController::Base
@@ -134,4 +134,4 @@ class RenderTextTest < SimpleRouteCase
134 134 assert_status 200
135 135 end
136 136 end
137   -end
  137 +end
4 actionpack/test/new_base/render_xml_test.rb
... ... @@ -1,4 +1,4 @@
1   -require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
  1 +require 'abstract_unit2'
2 2
3 3 module RenderXml
4 4
@@ -8,4 +8,4 @@ class BasicController < ActionController::Base
8 8 "render_xml/basic/with_render_erb" => "Hello world!"
9 9 )]
10 10 end
11   -end
  11 +end
8 actionpack/test/runner
... ... @@ -1,8 +0,0 @@
1   -#!/usr/bin/env ruby
2   -
3   -
4   -ARGV.each do |arg|
5   - Dir["#{Dir.pwd}/#{arg}/**/*_test.rb"].each do |file|
6   - require file
7   - end
8   -end

0 comments on commit 6d214c9

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