mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge master.
This commit is contained in:
commit
3f948a0e29
36 changed files with 136 additions and 67 deletions
4
Gemfile
4
Gemfile
|
@ -22,6 +22,10 @@ end
|
||||||
gem "rack-test", "0.5.3", :require => 'rack/test'
|
gem "rack-test", "0.5.3", :require => 'rack/test'
|
||||||
gem "RedCloth", ">= 4.2.2"
|
gem "RedCloth", ">= 4.2.2"
|
||||||
|
|
||||||
|
group :documentation do
|
||||||
|
gem 'rdoc', '2.1'
|
||||||
|
end
|
||||||
|
|
||||||
if ENV['CI']
|
if ENV['CI']
|
||||||
gem "nokogiri", ">= 1.4.0"
|
gem "nokogiri", ">= 1.4.0"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
require File.expand_path('../../../load_paths', __FILE__)
|
require File.expand_path('../../../bundler', __FILE__)
|
||||||
|
|
||||||
|
lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
|
||||||
|
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
|
||||||
|
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require 'action_mailer'
|
require 'action_mailer'
|
||||||
|
@ -14,7 +17,7 @@ ActionView::Template.register_template_handler :bak, lambda { |template| "Lame b
|
||||||
FIXTURE_LOAD_PATH = File.expand_path('fixtures', File.dirname(__FILE__))
|
FIXTURE_LOAD_PATH = File.expand_path('fixtures', File.dirname(__FILE__))
|
||||||
ActionMailer::Base.view_paths = FIXTURE_LOAD_PATH
|
ActionMailer::Base.view_paths = FIXTURE_LOAD_PATH
|
||||||
|
|
||||||
class MockSMTP
|
class MockSMTP
|
||||||
def self.deliveries
|
def self.deliveries
|
||||||
@@deliveries
|
@@deliveries
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
railties_path = File.expand_path('../../../railties/lib', __FILE__)
|
||||||
|
$:.unshift(railties_path) if File.directory?(railties_path) && !$:.include?(railties_path)
|
||||||
|
|
||||||
require "abstract_unit"
|
require "abstract_unit"
|
||||||
require "rails/log_subscriber/test_helper"
|
require "rails/log_subscriber/test_helper"
|
||||||
require "action_mailer/railties/log_subscriber"
|
require "action_mailer/railties/log_subscriber"
|
||||||
|
|
|
@ -21,6 +21,6 @@ Gem::Specification.new do |s|
|
||||||
s.add_dependency('activemodel', '= 3.0.0.beta1')
|
s.add_dependency('activemodel', '= 3.0.0.beta1')
|
||||||
s.add_dependency('rack', '~> 1.1.0')
|
s.add_dependency('rack', '~> 1.1.0')
|
||||||
s.add_dependency('rack-test', '~> 0.5.0')
|
s.add_dependency('rack-test', '~> 0.5.0')
|
||||||
s.add_dependency('rack-mount', '~> 0.4.7')
|
s.add_dependency('rack-mount', '~> 0.5.1')
|
||||||
s.add_dependency('erubis', '~> 2.6.5')
|
s.add_dependency('erubis', '~> 2.6.5')
|
||||||
end
|
end
|
||||||
|
|
|
@ -100,7 +100,7 @@ module AbstractController
|
||||||
def helper(*args, &block)
|
def helper(*args, &block)
|
||||||
self._helper_serial = AbstractController::Helpers.next_serial + 1
|
self._helper_serial = AbstractController::Helpers.next_serial + 1
|
||||||
|
|
||||||
_modules_for_helpers(args).each do |mod|
|
modules_for_helpers(args).each do |mod|
|
||||||
add_template_helper(mod)
|
add_template_helper(mod)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ module AbstractController
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# Array[Module]:: A normalized list of modules for the list of
|
# Array[Module]:: A normalized list of modules for the list of
|
||||||
# helpers provided.
|
# helpers provided.
|
||||||
def _modules_for_helpers(args)
|
def modules_for_helpers(args)
|
||||||
args.flatten.map! do |arg|
|
args.flatten.map! do |arg|
|
||||||
case arg
|
case arg
|
||||||
when String, Symbol
|
when String, Symbol
|
||||||
|
|
|
@ -37,7 +37,7 @@ module AbstractController
|
||||||
# options<Hash>:: See _render_template_with_layout in ActionView::Base
|
# options<Hash>:: See _render_template_with_layout in ActionView::Base
|
||||||
# partial<Boolean>:: Whether or not the template to render is a partial
|
# partial<Boolean>:: Whether or not the template to render is a partial
|
||||||
#
|
#
|
||||||
# Override this method in a to change the default behavior.
|
# Override this method in a module to change the default behavior.
|
||||||
def view_context
|
def view_context
|
||||||
@_view_context ||= ActionView::Base.for_controller(self)
|
@_view_context ||= ActionView::Base.for_controller(self)
|
||||||
end
|
end
|
||||||
|
|
|
@ -52,7 +52,7 @@ module ActionController
|
||||||
|
|
||||||
def method_for_action(action_name)
|
def method_for_action(action_name)
|
||||||
super || begin
|
super || begin
|
||||||
if template_exists?(action_name.to_s, {:formats => formats}, :_prefix => controller_path)
|
if view_paths.exists?(action_name.to_s, {:formats => formats}, controller_path)
|
||||||
"default_render"
|
"default_render"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -49,6 +49,14 @@ module ActionController
|
||||||
headers["Content-Type"] = type.to_s
|
headers["Content-Type"] = type.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def content_type
|
||||||
|
headers["Content-Type"]
|
||||||
|
end
|
||||||
|
|
||||||
|
def location
|
||||||
|
headers["Location"]
|
||||||
|
end
|
||||||
|
|
||||||
def location=(url)
|
def location=(url)
|
||||||
headers["Location"] = url
|
headers["Location"] = url
|
||||||
end
|
end
|
||||||
|
|
|
@ -86,7 +86,7 @@ module ActionController
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Overwrite _modules_for_helpers to accept :all as argument, which loads
|
# Overwrite modules_for_helpers to accept :all as argument, which loads
|
||||||
# all helpers in helpers_dir.
|
# all helpers in helpers_dir.
|
||||||
#
|
#
|
||||||
# ==== Parameters
|
# ==== Parameters
|
||||||
|
@ -95,7 +95,7 @@ module ActionController
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# Array[Module]:: A normalized list of modules for the list of
|
# Array[Module]:: A normalized list of modules for the list of
|
||||||
# helpers provided.
|
# helpers provided.
|
||||||
def _modules_for_helpers(args)
|
def modules_for_helpers(args)
|
||||||
args += all_application_helpers if args.delete(:all)
|
args += all_application_helpers if args.delete(:all)
|
||||||
super(args)
|
super(args)
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,10 +15,8 @@ module ActionController
|
||||||
|
|
||||||
# Overrides AbstractController::Base#action_method? to return false if the
|
# Overrides AbstractController::Base#action_method? to return false if the
|
||||||
# action name is in the list of hidden actions.
|
# action name is in the list of hidden actions.
|
||||||
def action_method?(action_name)
|
def method_for_action(action_name)
|
||||||
self.class.visible_action?(action_name) do
|
self.class.visible_action?(action_name) && super
|
||||||
!self.class.hidden_actions.include?(action_name) && super
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
|
@ -31,13 +29,13 @@ module ActionController
|
||||||
end
|
end
|
||||||
|
|
||||||
def inherited(klass)
|
def inherited(klass)
|
||||||
klass.instance_variable_set("@visible_actions", {})
|
klass.class_eval { @visible_actions = {} }
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
def visible_action?(action_name)
|
def visible_action?(action_name)
|
||||||
return @visible_actions[action_name] if @visible_actions.key?(action_name)
|
return @visible_actions[action_name] if @visible_actions.key?(action_name)
|
||||||
@visible_actions[action_name] = yield
|
@visible_actions[action_name] = !hidden_actions.include?(action_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Overrides AbstractController::Base#action_methods to remove any methods
|
# Overrides AbstractController::Base#action_methods to remove any methods
|
||||||
|
|
|
@ -430,7 +430,7 @@ module ActionDispatch
|
||||||
end
|
end
|
||||||
|
|
||||||
req = Rack::Request.new(env)
|
req = Rack::Request.new(env)
|
||||||
@set.recognize(req) do |route, params|
|
@set.recognize(req) do |route, matches, params|
|
||||||
dispatcher = route.app
|
dispatcher = route.app
|
||||||
if dispatcher.is_a?(Dispatcher) && dispatcher.controller(params, false)
|
if dispatcher.is_a?(Dispatcher) && dispatcher.controller(params, false)
|
||||||
dispatcher.prepare_params!(params)
|
dispatcher.prepare_params!(params)
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
require File.expand_path('../../../load_paths', __FILE__)
|
require File.expand_path('../../../bundler', __FILE__)
|
||||||
|
|
||||||
|
lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
|
||||||
|
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
|
||||||
|
|
||||||
|
activemodel_path = File.expand_path('../../../activemodel/lib', __FILE__)
|
||||||
|
$:.unshift(activemodel_path) if File.directory?(activemodel_path) && !$:.include?(activemodel_path)
|
||||||
|
|
||||||
$:.unshift(File.dirname(__FILE__) + '/lib')
|
$:.unshift(File.dirname(__FILE__) + '/lib')
|
||||||
$:.unshift(File.dirname(__FILE__) + '/fixtures/helpers')
|
$:.unshift(File.dirname(__FILE__) + '/fixtures/helpers')
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
railties_path = File.expand_path('../../../../railties/lib', __FILE__)
|
||||||
|
$:.unshift(railties_path) if File.directory?(railties_path) && !$:.include?(railties_path)
|
||||||
|
|
||||||
require 'active_record_unit'
|
require 'active_record_unit'
|
||||||
require 'active_record/railties/controller_runtime'
|
require 'active_record/railties/controller_runtime'
|
||||||
require 'fixtures/project'
|
require 'fixtures/project'
|
||||||
|
@ -31,7 +34,7 @@ class ControllerRuntimeLogSubscriberTest < ActionController::TestCase
|
||||||
def set_logger(logger)
|
def set_logger(logger)
|
||||||
ActionController::Base.logger = logger
|
ActionController::Base.logger = logger
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_log_with_active_record
|
def test_log_with_active_record
|
||||||
get :show
|
get :show
|
||||||
wait
|
wait
|
||||||
|
@ -39,4 +42,4 @@ class ControllerRuntimeLogSubscriberTest < ActionController::TestCase
|
||||||
assert_equal 2, @logger.logged(:info).size
|
assert_equal 2, @logger.logged(:info).size
|
||||||
assert_match /\(Views: [\d\.]+ms | ActiveRecord: [\d\.]+ms\)/, @logger.logged(:info)[1]
|
assert_match /\(Views: [\d\.]+ms | ActiveRecord: [\d\.]+ms\)/, @logger.logged(:info)[1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
railties_path = File.expand_path('../../../../railties/lib', __FILE__)
|
||||||
|
$:.unshift(railties_path) if File.directory?(railties_path) && !$:.include?(railties_path)
|
||||||
|
|
||||||
require "abstract_unit"
|
require "abstract_unit"
|
||||||
require "rails/log_subscriber/test_helper"
|
require "rails/log_subscriber/test_helper"
|
||||||
require "action_controller/railties/log_subscriber"
|
require "action_controller/railties/log_subscriber"
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
railties_path = File.expand_path('../../../../railties/lib', __FILE__)
|
||||||
|
$:.unshift(railties_path) if File.directory?(railties_path) && !$:.include?(railties_path)
|
||||||
|
|
||||||
require "abstract_unit"
|
require "abstract_unit"
|
||||||
require "rails/log_subscriber/test_helper"
|
require "rails/log_subscriber/test_helper"
|
||||||
require "action_view/railties/log_subscriber"
|
require "action_view/railties/log_subscriber"
|
||||||
|
@ -90,4 +93,4 @@ class AVLogSubscriberTest < ActiveSupport::TestCase
|
||||||
assert_equal 1, @logger.logged(:info).size
|
assert_equal 1, @logger.logged(:info).size
|
||||||
assert_match /Rendered collection/, @logger.logged(:info).last
|
assert_match /Rendered collection/, @logger.logged(:info).last
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@ require 'rake/testtask'
|
||||||
task :default => :test
|
task :default => :test
|
||||||
|
|
||||||
Rake::TestTask.new do |t|
|
Rake::TestTask.new do |t|
|
||||||
t.libs << "#{dir}/test"
|
t.libs << "test"
|
||||||
t.test_files = Dir.glob("#{dir}/test/cases/**/*_test.rb").sort
|
t.test_files = Dir.glob("#{dir}/test/cases/**/*_test.rb").sort
|
||||||
t.warning = true
|
t.warning = true
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
require File.expand_path('../../../../load_paths', __FILE__)
|
require File.expand_path('../../../../bundler', __FILE__)
|
||||||
|
|
||||||
|
lib = File.expand_path("#{File.dirname(__FILE__)}/../../lib")
|
||||||
|
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
|
||||||
|
|
||||||
|
puts $LOAD_PATH.inspect
|
||||||
|
|
||||||
require 'config'
|
require 'config'
|
||||||
require 'active_model'
|
require 'active_model'
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
require 'logger'
|
require 'logger'
|
||||||
|
|
||||||
$:.unshift(File.dirname(__FILE__) + '/../../../activerecord/lib')
|
activerecord_path = File.expand_path('../../../../activerecord/lib', __FILE__)
|
||||||
|
$:.unshift(activerecord_path) if File.directory?(activerecord_path) && !$:.include?(activerecord_path)
|
||||||
|
|
||||||
require 'active_record'
|
require 'active_record'
|
||||||
|
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#++
|
#++
|
||||||
|
|
||||||
|
|
||||||
activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__)
|
activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__)
|
||||||
$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
|
$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
require File.expand_path('../../../../load_paths', __FILE__)
|
require File.expand_path('../../../../bundler', __FILE__)
|
||||||
|
|
||||||
|
lib = File.expand_path("#{File.dirname(__FILE__)}/../../lib")
|
||||||
|
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
|
||||||
|
|
||||||
require 'config'
|
require 'config'
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
railties_path = File.expand_path('../../../../railties/lib', __FILE__)
|
||||||
|
$:.unshift(railties_path) if File.directory?(railties_path) && !$:.include?(railties_path)
|
||||||
|
|
||||||
require "cases/helper"
|
require "cases/helper"
|
||||||
require "models/developer"
|
require "models/developer"
|
||||||
require "rails/log_subscriber/test_helper"
|
require "rails/log_subscriber/test_helper"
|
||||||
|
@ -39,4 +42,4 @@ class LogSubscriberTest < ActiveSupport::TestCase
|
||||||
assert_match /CACHE/, @logger.logged(:debug).last
|
assert_match /CACHE/, @logger.logged(:debug).last
|
||||||
assert_match /SELECT .*?FROM .?developers.?/, @logger.logged(:debug).last
|
assert_match /SELECT .*?FROM .?developers.?/, @logger.logged(:debug).last
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
require File.expand_path('../../../load_paths', __FILE__)
|
require File.expand_path('../../../bundler', __FILE__)
|
||||||
|
|
||||||
|
lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
|
||||||
|
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
|
||||||
|
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
|
@ -6,7 +9,6 @@ require 'active_resource'
|
||||||
require 'active_support'
|
require 'active_support'
|
||||||
require 'active_support/test_case'
|
require 'active_support/test_case'
|
||||||
|
|
||||||
$:.unshift "#{File.dirname(__FILE__)}/../test"
|
|
||||||
require 'setter_trap'
|
require 'setter_trap'
|
||||||
|
|
||||||
require 'logger'
|
require 'logger'
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
|
railties_path = File.expand_path('../../../../railties/lib', __FILE__)
|
||||||
|
$:.unshift(railties_path) if File.directory?(railties_path) && !$:.include?(railties_path)
|
||||||
|
|
||||||
require "abstract_unit"
|
require "abstract_unit"
|
||||||
require "fixtures/person"
|
require "fixtures/person"
|
||||||
require "rails/log_subscriber/test_helper"
|
require "rails/log_subscriber/test_helper"
|
||||||
require "active_resource/railties/log_subscriber"
|
require "active_resource/railties/log_subscriber"
|
||||||
require "active_support/core_ext/hash/conversions"
|
require "active_support/core_ext/hash/conversions"
|
||||||
|
|
||||||
|
# TODO: This test should be part of Railties
|
||||||
class LogSubscriberTest < ActiveSupport::TestCase
|
class LogSubscriberTest < ActiveSupport::TestCase
|
||||||
include Rails::LogSubscriber::TestHelper
|
include Rails::LogSubscriber::TestHelper
|
||||||
Rails::LogSubscriber.add(:active_resource, ActiveResource::Railties::LogSubscriber.new)
|
Rails::LogSubscriber.add(:active_resource, ActiveResource::Railties::LogSubscriber.new)
|
||||||
|
@ -28,4 +32,4 @@ class LogSubscriberTest < ActiveSupport::TestCase
|
||||||
assert_equal "GET http://37s.sunrise.i:3000/people/1.xml", @logger.logged(:info)[0]
|
assert_equal "GET http://37s.sunrise.i:3000/people/1.xml", @logger.logged(:info)[0]
|
||||||
assert_match /\-\-\> 200 200 106/, @logger.logged(:info)[1]
|
assert_match /\-\-\> 200 200 106/, @logger.logged(:info)[1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
require File.expand_path('../../../load_paths', __FILE__)
|
require File.expand_path('../../../bundler', __FILE__)
|
||||||
|
|
||||||
|
lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
|
||||||
|
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
|
||||||
|
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require 'mocha'
|
require 'mocha'
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
$:.unshift "#{File.dirname(__FILE__)}/../lib"
|
|
||||||
require 'active_support'
|
require 'active_support'
|
||||||
|
|
||||||
class GrandParent
|
class GrandParent
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# require 'abstract_unit'
|
# require 'abstract_unit'
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
$:.unshift "#{File.dirname(__FILE__)}/../lib"
|
|
||||||
require 'active_support'
|
require 'active_support'
|
||||||
|
|
||||||
module CallbacksTest
|
module CallbacksTest
|
||||||
|
|
|
@ -84,6 +84,8 @@ class DelegatingAttributesTest < Test::Unit::TestCase
|
||||||
|
|
||||||
assert_equal "1", Child.some_attribute
|
assert_equal "1", Child.some_attribute
|
||||||
assert_nil Mokopuna.some_attribute
|
assert_nil Mokopuna.some_attribute
|
||||||
|
ensure
|
||||||
|
Child.some_attribute=nil
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
15
activesupport/test/load_paths_test.rb
Normal file
15
activesupport/test/load_paths_test.rb
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
require 'abstract_unit'
|
||||||
|
|
||||||
|
class LoadPathsTest < Test::Unit::TestCase
|
||||||
|
def test_uniq_load_paths
|
||||||
|
load_paths_count = $LOAD_PATH.inject({}) { |paths, path|
|
||||||
|
expanded_path = File.expand_path(path)
|
||||||
|
paths[expanded_path] ||= 0
|
||||||
|
paths[expanded_path] += 1
|
||||||
|
paths
|
||||||
|
}
|
||||||
|
|
||||||
|
# CI has a bunch of duplicate load paths
|
||||||
|
# assert_equal [], load_paths_count.select { |k, v| v > 1 }, $LOAD_PATH.inspect
|
||||||
|
end
|
||||||
|
end
|
10
bundler.rb
Normal file
10
bundler.rb
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
begin
|
||||||
|
require File.expand_path('../.bundle/environment', __FILE__)
|
||||||
|
rescue LoadError
|
||||||
|
begin
|
||||||
|
require 'rubygems'
|
||||||
|
require 'bundler'
|
||||||
|
Bundler.setup
|
||||||
|
rescue LoadError
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,21 +0,0 @@
|
||||||
begin
|
|
||||||
require File.expand_path('../.bundle/environment', __FILE__)
|
|
||||||
rescue LoadError
|
|
||||||
begin
|
|
||||||
require 'rubygems'
|
|
||||||
require 'bundler'
|
|
||||||
Bundler.setup
|
|
||||||
rescue LoadError
|
|
||||||
%w(
|
|
||||||
actionmailer
|
|
||||||
actionpack
|
|
||||||
activemodel
|
|
||||||
activerecord
|
|
||||||
activeresource
|
|
||||||
activesupport
|
|
||||||
railties
|
|
||||||
).each do |framework|
|
|
||||||
$:.unshift File.expand_path("../#{framework}/lib", __FILE__)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,4 +1,4 @@
|
||||||
require File.expand_path('../../load_paths', __FILE__)
|
require File.expand_path('../../bundler', __FILE__)
|
||||||
|
|
||||||
require 'rake'
|
require 'rake'
|
||||||
require 'rake/testtask'
|
require 'rake/testtask'
|
||||||
|
|
|
@ -21,7 +21,7 @@ Gem::Specification.new do |s|
|
||||||
s.has_rdoc = false
|
s.has_rdoc = false
|
||||||
|
|
||||||
s.add_dependency('rake', '>= 0.8.3')
|
s.add_dependency('rake', '>= 0.8.3')
|
||||||
s.add_dependency('thor', '~> 0.13')
|
s.add_dependency('thor', '~> 0.13.0')
|
||||||
s.add_dependency('activesupport', '= 3.0.0.beta1')
|
s.add_dependency('activesupport', '= 3.0.0.beta1')
|
||||||
s.add_dependency('actionpack', '= 3.0.0.beta1')
|
s.add_dependency('actionpack', '= 3.0.0.beta1')
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
ORIG_ARGV = ARGV.dup
|
ORIG_ARGV = ARGV.dup
|
||||||
|
|
||||||
require File.expand_path("../../../load_paths", __FILE__)
|
require File.expand_path("../../../bundler", __FILE__)
|
||||||
$:.unshift File.expand_path("../../builtin/rails_info", __FILE__)
|
$:.unshift File.expand_path("../../builtin/rails_info", __FILE__)
|
||||||
|
|
||||||
|
lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
|
||||||
|
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
|
||||||
|
|
||||||
|
require 'edge_rails'
|
||||||
|
|
||||||
require 'stringio'
|
require 'stringio'
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
|
|
|
@ -140,7 +140,7 @@ module ApplicationTests
|
||||||
require "#{app_path}/config/environment"
|
require "#{app_path}/config/environment"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "filter_parameters should be able to set via config.filter_parameters" do
|
test "filter_parameters should be able to set via config.filter_parameters" do
|
||||||
add_to_config <<-RUBY
|
add_to_config <<-RUBY
|
||||||
config.filter_parameters += [ :foo, 'bar', lambda { |key, value|
|
config.filter_parameters += [ :foo, 'bar', lambda { |key, value|
|
||||||
|
|
14
railties/test/edge_rails.rb
Normal file
14
railties/test/edge_rails.rb
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
require File.expand_path('../../../bundler', __FILE__)
|
||||||
|
|
||||||
|
%w(
|
||||||
|
actionmailer
|
||||||
|
actionpack
|
||||||
|
activemodel
|
||||||
|
activerecord
|
||||||
|
activeresource
|
||||||
|
activesupport
|
||||||
|
railties
|
||||||
|
).each do |framework|
|
||||||
|
framework_path = File.expand_path("../../../#{framework}/lib", __FILE__)
|
||||||
|
$:.unshift(framework_path) if File.directory?(framework_path) && !$:.include?(framework_path)
|
||||||
|
end
|
|
@ -187,7 +187,7 @@ module TestHelpers
|
||||||
end
|
end
|
||||||
|
|
||||||
def boot_rails
|
def boot_rails
|
||||||
require File.expand_path('../../../../load_paths', __FILE__)
|
require File.expand_path('../../edge_rails', __FILE__)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -208,18 +208,12 @@ Module.new do
|
||||||
end
|
end
|
||||||
FileUtils.mkdir(tmp_path)
|
FileUtils.mkdir(tmp_path)
|
||||||
|
|
||||||
environment = File.expand_path('../../../../load_paths', __FILE__)
|
environment = File.expand_path('../../edge_rails', __FILE__)
|
||||||
if File.exist?("#{environment}.rb")
|
require_environment = "-r #{environment}"
|
||||||
require_environment = "-r #{environment}"
|
|
||||||
end
|
|
||||||
|
|
||||||
`#{Gem.ruby} #{require_environment} #{RAILS_FRAMEWORK_ROOT}/railties/bin/rails #{tmp_path('app_template')}`
|
`#{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|
|
File.open("#{tmp_path}/app_template/config/boot.rb", 'w') do |f|
|
||||||
if require_environment
|
f.puts "require '#{environment}'"
|
||||||
f.puts "Dir.chdir('#{File.dirname(environment)}') do"
|
|
||||||
f.puts " require '#{environment}'"
|
|
||||||
f.puts "end"
|
|
||||||
end
|
|
||||||
f.puts "require 'rails/all'"
|
f.puts "require 'rails/all'"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue