diff options
author | Mikel Lindsaar <raasdnil@gmail.com> | 2010-02-02 10:51:19 +1100 |
---|---|---|
committer | Mikel Lindsaar <raasdnil@gmail.com> | 2010-02-02 10:51:19 +1100 |
commit | d1eed079e1338249aa3b2881d07029ac4e71f4ed (patch) | |
tree | 18088ca9388e1b7bd27fffea8cb41fa52b618c34 /railties/test | |
parent | ddf2b4add33d5e54c5f5e7adacadbb50d3fa7b52 (diff) | |
parent | b9edb0c60c11025311fb06f2e60b3354f1b6cb09 (diff) | |
download | rails-d1eed079e1338249aa3b2881d07029ac4e71f4ed.tar.gz rails-d1eed079e1338249aa3b2881d07029ac4e71f4ed.tar.bz2 rails-d1eed079e1338249aa3b2881d07029ac4e71f4ed.zip |
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/abstract_unit.rb | 12 | ||||
-rw-r--r-- | railties/test/application/configuration_test.rb | 2 | ||||
-rw-r--r-- | railties/test/application/generators_test.rb | 13 | ||||
-rw-r--r-- | railties/test/application/middleware_test.rb | 2 | ||||
-rw-r--r-- | railties/test/isolation/abstract_unit.rb | 26 | ||||
-rw-r--r-- | railties/test/rails_info_controller_test.rb | 8 |
6 files changed, 27 insertions, 36 deletions
diff --git a/railties/test/abstract_unit.rb b/railties/test/abstract_unit.rb index 77ef82856a..aa66dbb9be 100644 --- a/railties/test/abstract_unit.rb +++ b/railties/test/abstract_unit.rb @@ -1,15 +1,7 @@ ORIG_ARGV = ARGV.dup -root = File.expand_path('../../..', __FILE__) -begin - require "#{root}/vendor/gems/environment" -rescue LoadError - %w(activesupport activemodel activerecord actionpack actionmailer activeresource railties).each do |lib| - $:.unshift "#{root}/#{lib}/lib" - end -end - -$:.unshift "#{root}/railties/builtin/rails_info" +require File.expand_path("../../../load_paths", __FILE__) +$:.unshift File.expand_path("../../builtin/rails_info", __FILE__) require 'stringio' require 'test/unit' diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index 60d644bd59..56f45582c8 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -93,7 +93,7 @@ module ApplicationTests RUBY require "#{app_path}/config/application" - assert AppTemplate::Application.config.action_controller.allow_concurrency + assert AppTemplate::Application.config.allow_concurrency end test "the application can be marked as threadsafe when there are no frameworks" do diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb index e54edea07c..25fa100275 100644 --- a/railties/test/application/generators_test.rb +++ b/railties/test/application/generators_test.rb @@ -30,6 +30,7 @@ module ApplicationTests assert_equal(true, c.generators.colorize_logging) assert_equal({}, c.generators.aliases) assert_equal({}, c.generators.options) + assert_equal({}, c.generators.fallbacks) end end @@ -51,11 +52,20 @@ module ApplicationTests end end - test "generators aliases and options on initialization" do + test "generators set rails fallbacks" do + with_config do |c| + c.generators.fallbacks[:shoulda] = :test_unit + expected = { :shoulda => :test_unit } + assert_equal expected, c.generators.fallbacks + end + end + + test "generators aliases, options and fallbacks on initialization" do add_to_config <<-RUBY config.generators.rails :aliases => { :test_framework => "-w" } config.generators.orm :datamapper config.generators.test_framework :rspec + config.generators.fallbacks[:shoulda] = :test_unit RUBY # Initialize the application @@ -65,6 +75,7 @@ module ApplicationTests assert_equal :rspec, Rails::Generators.options[:rails][:test_framework] assert_equal "-w", Rails::Generators.aliases[:rails][:test_framework] + assert_equal :test_unit, Rails::Generators.fallbacks[:shoulda] end test "generators no color on initialization" do diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb index 0b92cdba54..ce9cd510a3 100644 --- a/railties/test/application/middleware_test.rb +++ b/railties/test/application/middleware_test.rb @@ -39,7 +39,7 @@ module ApplicationTests end test "removes lock if allow concurrency is set" do - add_to_config "config.action_controller.allow_concurrency = true" + add_to_config "config.allow_concurrency = true" boot! assert !middleware.include?("Rack::Lock") end diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index 940585836c..ff4ee6332b 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -183,23 +183,7 @@ module TestHelpers end def boot_rails - root = File.expand_path('../../../..', __FILE__) - begin - require "#{root}/vendor/gems/environment" - rescue LoadError - %w( - actionmailer/lib - actionpack/lib - activemodel/lib - activerecord/lib - activeresource/lib - activesupport/lib - railties/lib - railties - ).reverse_each do |path| - $:.unshift "#{root}/#{path}" - end - end + require File.expand_path('../../../../load_paths', __FILE__) end end end @@ -220,14 +204,18 @@ Module.new do end FileUtils.mkdir(tmp_path) - environment = File.expand_path('../../../../vendor/gems/environment', __FILE__) + environment = File.expand_path('../../../../load_paths', __FILE__) if File.exist?("#{environment}.rb") require_environment = "-r #{environment}" end `#{Gem.ruby} #{require_environment} #{RAILS_FRAMEWORK_ROOT}/railties/bin/rails #{tmp_path('app_template')}` File.open("#{tmp_path}/app_template/config/boot.rb", 'w') do |f| - f.puts "require '#{environment}'" if require_environment + if require_environment + f.puts "Dir.chdir('#{File.dirname(environment)}') do" + f.puts " require '#{environment}'" + f.puts "end" + end f.puts "require 'rails/all'" end end diff --git a/railties/test/rails_info_controller_test.rb b/railties/test/rails_info_controller_test.rb index edab27465e..4163fb2c6d 100644 --- a/railties/test/rails_info_controller_test.rb +++ b/railties/test/rails_info_controller_test.rb @@ -17,23 +17,23 @@ class InfoControllerTest < ActionController::TestCase ActionController::Routing::Routes.draw do |map| match ':controller/:action' end - @controller.stubs(:consider_all_requests_local => false, :local_request? => true) + @controller.stubs(:consider_all_requests_local? => false, :local_request? => true) end test "info controller does not allow remote requests" do - @controller.stubs(:consider_all_requests_local => false, :local_request? => false) + @controller.stubs(:consider_all_requests_local? => false, :local_request? => false) get :properties assert_response :forbidden end test "info controller renders an error message when request was forbidden" do - @controller.stubs(:consider_all_requests_local => false, :local_request? => false) + @controller.stubs(:consider_all_requests_local? => false, :local_request? => false) get :properties assert_select 'p' end test "info controller allows requests when all requests are considered local" do - @controller.stubs(:consider_all_requests_local => true, :local_request? => false) + @controller.stubs(:consider_all_requests_local? => true, :local_request? => false) get :properties assert_response :success end |