Permalink
Browse files

Merge commit 'rails/master'

Conflicts:

	activerecord/lib/active_record.rb
  • Loading branch information...
2 parents 5255a81 + 196f780 commit fd3c55f09fdfb45c33a5383af2c0b9ddf8f63e90 @miloops miloops committed Jun 2, 2009
Showing with 4,748 additions and 3,874 deletions.
  1. +1 −0 .gitignore
  2. +1 −1 ...nmailer/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.erb
  3. +5 −4 actionmailer/test/mail_service_test.rb
  4. +3 −0 actionpack/CHANGELOG
  5. +6 −9 actionpack/Rakefile
  6. +11 −6 actionpack/examples/minimal.rb
  7. +1 −1 actionpack/lib/action_controller/abstract.rb
  8. +19 −19 actionpack/lib/action_controller/abstract/base.rb
  9. +5 −5 actionpack/lib/action_controller/abstract/benchmarker.rb
  10. +21 −6 actionpack/lib/action_controller/abstract/callbacks.rb
  11. +2 −2 actionpack/lib/action_controller/abstract/exceptions.rb
  12. +6 −7 actionpack/lib/action_controller/abstract/helpers.rb
  13. +15 −14 actionpack/lib/action_controller/abstract/layouts.rb
  14. +7 −7 actionpack/lib/action_controller/abstract/logger.rb
  15. +18 −14 actionpack/lib/action_controller/abstract/renderer.rb
  16. +1 −6 actionpack/lib/action_controller/base/chained/filters.rb
  17. +44 −41 actionpack/lib/action_controller/base/chained/flash.rb
  18. +1 −1 actionpack/lib/action_controller/base/cookies.rb
  19. +3 −5 actionpack/lib/action_controller/base/filter_parameter_logging.rb
  20. +1 −1 actionpack/lib/action_controller/base/helpers.rb
  21. +2 −2 actionpack/lib/action_controller/base/request_forgery_protection.rb
  22. +2 −2 actionpack/lib/action_controller/base/streaming.rb
  23. +2 −2 actionpack/lib/action_controller/base/verification.rb
  24. +1 −1 actionpack/lib/action_controller/caching.rb
  25. +1 −1 actionpack/lib/action_controller/caching/actions.rb
  26. +3 −0 actionpack/lib/action_controller/new_base.rb
  27. +12 −11 actionpack/lib/action_controller/new_base/base.rb
  28. +40 −22 actionpack/lib/action_controller/new_base/compatibility.rb
  29. +17 −15 actionpack/lib/action_controller/new_base/conditional_get.rb
  30. +26 −27 actionpack/lib/action_controller/new_base/helpers.rb
  31. +27 −21 actionpack/lib/action_controller/new_base/hide_actions.rb
  32. +52 −28 actionpack/lib/action_controller/new_base/http.rb
  33. +21 −23 actionpack/lib/action_controller/new_base/layouts.rb
  34. +33 −0 actionpack/lib/action_controller/new_base/rack_convenience.rb
  35. +4 −4 actionpack/lib/action_controller/new_base/redirector.rb
  36. +27 −31 actionpack/lib/action_controller/new_base/render_options.rb
  37. +45 −51 actionpack/lib/action_controller/new_base/renderer.rb
  38. +15 −16 actionpack/lib/action_controller/new_base/rescuable.rb
  39. +4 −0 actionpack/lib/action_controller/new_base/session.rb
  40. +4 −3 actionpack/lib/action_controller/new_base/testing.rb
  41. +7 −3 actionpack/lib/action_controller/new_base/url_for.rb
  42. +3 −0 actionpack/lib/action_controller/routing/resources.rb
  43. +1 −1 actionpack/lib/action_controller/routing/segments.rb
  44. +1 −1 actionpack/lib/action_controller/testing/integration.rb
  45. +2 −1 actionpack/lib/action_controller/testing/process2.rb
  46. +3 −0 actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb
  47. +10 −6 actionpack/lib/action_dispatch/middleware/show_exceptions.rb
  48. +2 −0 actionpack/lib/action_dispatch/testing/assertions/routing.rb
  49. +10 −3 actionpack/lib/action_view/helpers/capture_helper.rb
  50. +2 −1 actionpack/lib/action_view/helpers/form_tag_helper.rb
  51. +1 −1 actionpack/lib/action_view/render/partials.rb
  52. +3 −5 actionpack/lib/action_view/template/handlers/erb.rb
  53. +17 −3 actionpack/lib/action_view/template/template.rb
  54. +6 −0 actionpack/test/controller/cookie_test.rb
  55. +74 −28 actionpack/test/controller/filters_test.rb
  56. +21 −1 actionpack/test/controller/flash_test.rb
  57. +9 −4 actionpack/test/controller/routing_test.rb
  58. +2 −2 actionpack/test/controller/view_paths_test.rb
  59. +2 −2 actionpack/test/dispatch/show_exceptions_test.rb
  60. +3 −1 actionpack/test/fixtures/test/utf8.html.erb
  61. +5 −0 actionpack/test/fixtures/test/utf8_magic.html.erb
  62. +4 −1 actionpack/test/template/body_parts_test.rb
  63. +3 −3 actionpack/test/template/form_tag_helper_test.rb
  64. +47 −28 actionpack/test/template/output_buffer_test.rb
  65. +21 −4 actionpack/test/template/render_test.rb
  66. +1 −2 activemodel/Rakefile
  67. +41 −5 activemodel/lib/active_model.rb
  68. +0 −7 activemodel/lib/active_model/callbacks.rb
  69. +0 −3 activemodel/lib/active_model/core.rb
  70. +8 −13 activemodel/lib/active_model/deprecated_error_methods.rb
  71. +116 −40 activemodel/lib/active_model/errors.rb
  72. +24 −0 activemodel/lib/active_model/locale/en.yml
  73. +0 −1 activemodel/lib/active_model/observing.rb
  74. +5 −0 activemodel/lib/active_model/state_machine.rb
  75. +18 −0 activemodel/lib/active_model/test_case.rb
  76. +23 −45 activemodel/lib/active_model/validations.rb
  77. +12 −9 activemodel/lib/active_model/validations/acceptance.rb
  78. +6 −5 activemodel/lib/active_model/validations/confirmation.rb
  79. +9 −8 activemodel/lib/active_model/validations/exclusion.rb
  80. +9 −7 activemodel/lib/active_model/validations/format.rb
  81. +9 −8 activemodel/lib/active_model/validations/inclusion.rb
  82. +46 −48 activemodel/lib/active_model/validations/length.rb
  83. +22 −16 activemodel/lib/active_model/validations/numericality.rb
  84. +15 −18 activemodel/lib/active_model/validations/presence.rb
  85. +0 −104 activemodel/lib/active_model/validations/uniqueness.rb
  86. +44 −0 activemodel/lib/active_model/validations_repair_helper.rb
  87. +20 −0 activemodel/test/cases/helper.rb
  88. +1 −1 activemodel/test/{ → cases}/observing_test.rb
  89. +1 −2 activemodel/test/{ → cases}/state_machine/event_test.rb
  90. +1 −1 activemodel/test/{ → cases}/state_machine/machine_test.rb
  91. +1 −1 activemodel/test/{ → cases}/state_machine/state_test.rb
  92. +1 −2 activemodel/test/{ → cases}/state_machine/state_transition_test.rb
  93. +1 −1 activemodel/test/{ → cases}/state_machine_test.rb
  94. +41 −0 activemodel/test/cases/tests_database.rb
  95. +80 −0 activemodel/test/cases/validations/acceptance_validation_test.rb
  96. +140 −0 activemodel/test/cases/validations/conditional_validation_test.rb
  97. +68 −0 activemodel/test/cases/validations/confirmation_validation_test.rb
  98. +46 −0 activemodel/test/cases/validations/exclusion_validation_test.rb
  99. +98 −0 activemodel/test/cases/validations/format_validation_test.rb
  100. +182 −0 activemodel/test/cases/validations/i18n_generate_message_validation_test.rb
  101. +579 −0 activemodel/test/cases/validations/i18n_validation_test.rb
  102. +80 −0 activemodel/test/cases/validations/inclusion_validation_test.rb
  103. +449 −0 activemodel/test/cases/validations/length_validation_test.rb
  104. +179 −0 activemodel/test/cases/validations/numericality_validation_test.rb
  105. +57 −0 activemodel/test/cases/validations/presence_validation_test.rb
  106. +178 −0 activemodel/test/cases/validations_test.rb
  107. +3 −0 activemodel/test/config.rb
  108. +41 −0 activemodel/test/fixtures/topics.yml
  109. +6 −0 activemodel/test/models/developer.rb
  110. +5 −0 activemodel/test/models/person.rb
  111. +34 −0 activemodel/test/models/reply.rb
  112. +9 −0 activemodel/test/models/topic.rb
  113. +14 −0 activemodel/test/schema.rb
  114. +0 −21 activemodel/test/test_helper.rb
  115. +9 −1 activerecord/lib/active_record.rb
  116. +1 −1 activerecord/lib/active_record/aggregations.rb
  117. +1 −1 activerecord/lib/active_record/association_preload.rb
  118. +1 −1 activerecord/lib/active_record/associations.rb
  119. +1 −1 activerecord/lib/active_record/attribute_methods.rb
  120. +2 −2 activerecord/lib/active_record/autosave_association.rb
  121. +1 −1 activerecord/lib/active_record/batches.rb
  122. +1 −1 activerecord/lib/active_record/calculations.rb
  123. +1 −1 activerecord/lib/active_record/callbacks.rb
  124. +1 −1 activerecord/lib/active_record/dirty.rb
  125. +1 −1 activerecord/lib/active_record/fixtures.rb
  126. +1 −1 activerecord/lib/active_record/locking/optimistic.rb
  127. +1 −1 activerecord/lib/active_record/named_scope.rb
  128. +1 −1 activerecord/lib/active_record/nested_attributes.rb
  129. +1 −1 activerecord/lib/active_record/observer.rb
  130. +1 −1 activerecord/lib/active_record/reflection.rb
  131. +9 −2 activerecord/lib/active_record/schema_dumper.rb
  132. +1 −1 activerecord/lib/active_record/serializers/json_serializer.rb
  133. +1 −1 activerecord/lib/active_record/timestamp.rb
  134. +1 −1 activerecord/lib/active_record/transactions.rb
  135. +92 −953 activerecord/lib/active_record/validations.rb
  136. +7 −7 {activemodel/lib/active_model → activerecord/lib/active_record}/validations/associated.rb
  137. +159 −0 activerecord/lib/active_record/validations/uniqueness.rb
  138. +1 −1 activerecord/test/cases/associations/eager_load_nested_include_test.rb
  139. +2 −2 activerecord/test/cases/associations/has_one_associations_test.rb
  140. +18 −18 activerecord/test/cases/autosave_association_test.rb
  141. +1 −1 activerecord/test/cases/helper.rb
  142. +1 −1 activerecord/test/cases/repair_helper.rb
  143. +5 −0 activerecord/test/cases/schema_dumper_test.rb
  144. +101 −0 activerecord/test/cases/validations/association_validation_test.rb
  145. +166 −0 activerecord/test/cases/validations/i18n_generate_message_validation_test.rb
  146. +81 −267 activerecord/test/cases/{validations_i18n_test.rb → validations/i18n_validation_test.rb}
  147. +278 −0 activerecord/test/cases/validations/uniqueness_validation_test.rb
  148. +42 −1,457 activerecord/test/cases/validations_test.rb
  149. +6 −3 activerecord/test/models/company.rb
  150. +6 −3 activerecord/test/models/company_in_module.rb
  151. +12 −8 activerecord/test/models/reply.rb
  152. +1 −0 activerecord/test/schema/schema.rb
  153. +12 −0 activeresource/lib/active_resource.rb
  154. +5 −3 activeresource/lib/active_resource/base.rb
  155. +4 −199 activeresource/lib/active_resource/validations.rb
  156. +5 −5 activeresource/test/base_errors_test.rb
  157. +2 −1 activesupport/lib/active_support/autoload.rb
  158. +1 −1 activesupport/lib/active_support/cache/strategy/local_cache.rb
  159. +25 −0 activesupport/lib/active_support/concern.rb
  160. +1 −11 activesupport/lib/active_support/dependency_module.rb
  161. +25 −5 activesupport/lib/active_support/new_callbacks.rb
  162. +9 −0 activesupport/test/caching_test.rb
  163. +22 −13 activesupport/test/{dependency_module_test.rb → concern_test.rb}
  164. +2 −0 railties/CHANGELOG
  165. +4 −4 railties/lib/commands/server.rb
  166. +11 −5 railties/lib/initializer.rb
  167. +13 −0 railties/lib/rails_generator/generators/components/model_subclass/USAGE
  168. +32 −0 railties/lib/rails_generator/generators/components/model_subclass/model_subclass_generator.rb
  169. +3 −0 railties/lib/rails_generator/generators/components/model_subclass/templates/model.rb
  170. +8 −0 railties/lib/rails_generator/generators/components/model_subclass/templates/unit_test.rb
  171. +22 −4 railties/lib/tasks/databases.rake
  172. +15 −0 railties/test/generators/rails_model_subclass_generator_test.rb
  173. +20 −4 railties/test/initializer_test.rb
  174. 0 tools/{profile_requires → profile}
View
@@ -8,6 +8,7 @@ activesupport/doc
activeresource/pkg
activerecord/pkg
actionpack/pkg
+activemodel/test/fixtures/fixture_database.sqlite3
actionmailer/pkg
activesupport/pkg
railties/pkg
@@ -1 +1 @@
-Have a lovely picture, from me. Enjoy!
+Have some dots. Enjoy!
@@ -6,10 +6,10 @@ class FunkyPathMailer < ActionMailer::Base
def multipart_with_template_path_with_dots(recipient)
recipients recipient
- subject "Have a lovely picture"
+ subject "This path has dots"
from "Chad Fowler <chad@chadfowler.com>"
- attachment :content_type => "image/jpeg",
- :body => "not really a jpeg, we're only testing, after all"
+ attachment :content_type => "text/plain",
+ :body => "dots dots dots..."
end
end
@@ -939,7 +939,8 @@ def test_deliver_with_mail_object
def test_multipart_with_template_path_with_dots
mail = FunkyPathMailer.create_multipart_with_template_path_with_dots(@recipient)
assert_equal 2, mail.parts.length
- assert mail.parts.any? {|part| part.content_type == "text/plain" && part.charset == "utf-8"}
+ assert "text/plain", mail.parts[1].content_type
+ assert "utf-8", mail.parts[1].charset
end
def test_custom_content_type_attributes
View
@@ -1,5 +1,8 @@
*Edge*
+* Ruby 1.9: ERB template encoding using a magic comment at the top of the file. [Jeremy Kemper]
+ <%# encoding: utf-8 %>
+
* Change integration test helpers to accept Rack environment instead of just HTTP Headers [Pratik Naik]
Before : get '/path', {}, 'Accept' => 'text/javascript'
View
@@ -59,24 +59,21 @@ end
desc 'Old Controller Tests on New Base'
Rake::TestTask.new(:test_new_base_on_old_tests) do |t|
t.libs << "test/new_base" << "test/lib"
- # layout
- # Dir.glob( "test/{dispatch,template}/**/*_test.rb" ).sort +
+ t.verbose = true
# ==== Not ported
# * filters
- # * integration
- # * test
- # * view_paths
- t.test_files = %w(
+
+ t.test_files = Dir.glob( "test/{dispatch,template}/**/*_test.rb" ).sort + %w(
action_pack_assertions addresses_render assert_select
base benchmark caching capture content_type cookie dispatcher
filter_params flash helper http_basic_authentication
- http_digest_authentication layout logging mime_responds
+ http_digest_authentication integration layout logging mime_responds
record_identifier redirect render render_js render_json
render_other render_xml request_forgery_protection rescue
- resources routing selector send_file url_rewriter verification webservice
+ resources routing selector send_file test url_rewriter
+ verification view_paths webservice
).map { |name| "test/controller/#{name}_test.rb" }
- t.verbose = true
end
# Genereate the RDoc documentation
@@ -24,10 +24,12 @@ def report(env, response)
out.puts '---'
end
- def self.run(app, n)
+ def self.run(app, n, label = nil)
+ puts '=' * label.size, label, '=' * label.size if label
env = { 'n' => n, 'rack.input' => StringIO.new(''), 'rack.errors' => $stdout }
t = Benchmark.realtime { new(app).call(env) }
- puts "%d ms / %d req = %d usec/req" % [10**3 * t, n, 10**6 * t / n]
+ puts "%d ms / %d req = %.1f usec/req" % [10**3 * t, n, 10**6 * t / n]
+ puts
end
end
@@ -38,16 +40,19 @@ class BasePostController < ActionController::Base
def index
render :text => ''
end
-
- Runner.run(action(:index), N)
end
+OK = [200, {}, []]
+MetalPostController = lambda { OK }
+
if ActionController.const_defined?(:Http)
class HttpPostController < ActionController::Http
def index
self.response_body = ''
end
-
- Runner.run(action(:index), N)
end
end
+
+Runner.run(MetalPostController, N, 'metal')
+Runner.run(HttpPostController.action(:index), N, 'http') if defined? HttpPostController
+Runner.run(BasePostController.action(:index), N, 'base')
@@ -11,4 +11,4 @@ module AbstractController
autoload :Renderer, "action_controller/abstract/renderer"
# === Exceptions
autoload :ActionNotFound, "action_controller/abstract/exceptions"
-end
+end
@@ -2,28 +2,27 @@
module AbstractController
class Error < StandardError; end
-
+
class DoubleRenderError < Error
DEFAULT_MESSAGE = "Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like \"redirect_to(...) and return\"."
def initialize(message = nil)
super(message || DEFAULT_MESSAGE)
end
- end
-
+ end
+
class Base
-
attr_internal :response_body
attr_internal :response_obj
attr_internal :action_name
class << self
- attr_reader :abstract
-
+ attr_reader :abstract
+
def abstract!
@abstract = true
end
-
+
alias_method :abstract?, :abstract
def inherited(klass)
@@ -34,21 +33,21 @@ def inherited(klass)
def subclasses
@subclasses ||= []
end
-
+
def internal_methods
controller = self
controller = controller.superclass until controller.abstract?
controller.public_instance_methods(true)
end
-
+
def process(action)
new.process(action.to_s)
end
def hidden_actions
[]
end
-
+
def action_methods
@action_methods ||=
# All public instance methods of this class, including ancestors
@@ -61,13 +60,13 @@ def action_methods
hidden_actions
end
end
-
+
abstract!
-
+
def initialize
self.response_obj = {}
end
-
+
def process(action)
@_action_name = action_name = action.to_s
@@ -78,26 +77,27 @@ def process(action)
process_action(action_name)
self
end
-
+
private
-
def action_methods
self.class.action_methods
end
-
+
def action_method?(action)
action_methods.include?(action)
end
-
+
# It is possible for respond_to?(action_name) to be false and
# respond_to?(:action_missing) to be false if respond_to_action?
# is overridden in a subclass. For instance, ActionController::Base
# overrides it to include the case where a template matching the
# action_name is found.
def process_action(method_name)
- send(method_name)
+ send_action(method_name)
end
+ alias send_action send
+
def _handle_action_missing
action_missing(@_action_name)
end
@@ -112,4 +112,4 @@ def method_for_action(action_name)
end
end
end
-end
+end
@@ -1,9 +1,9 @@
module AbstractController
module Benchmarker
- extend ActiveSupport::DependencyModule
-
- depends_on Logger
-
+ extend ActiveSupport::Concern
+
+ include Logger
+
module ClassMethods
def benchmark(title, log_level = ::Logger::DEBUG, use_silence = true)
if logger && logger.level >= log_level
@@ -25,4 +25,4 @@ def silence
end
end
end
-end
+end
@@ -1,8 +1,8 @@
module AbstractController
module Callbacks
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
- depends_on ActiveSupport::NewCallbacks
+ include ActiveSupport::NewCallbacks
included do
define_callbacks :process_action, "response_body"
@@ -13,19 +13,25 @@ def process_action(method_name)
super
end
end
-
+
module ClassMethods
def _normalize_callback_options(options)
if only = options[:only]
only = Array(only).map {|o| "action_name == '#{o}'"}.join(" || ")
options[:per_key] = {:if => only}
end
if except = options[:except]
- except = Array(except).map {|e| "action_name == '#{e}'"}.join(" || ")
+ except = Array(except).map {|e| "action_name == '#{e}'"}.join(" || ")
options[:per_key] = {:unless => except}
end
end
-
+
+ def skip_filter(*names, &blk)
+ skip_before_filter(*names, &blk)
+ skip_after_filter(*names, &blk)
+ skip_around_filter(*names, &blk)
+ end
+
[:before, :after, :around].each do |filter|
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
def #{filter}_filter(*names, &blk)
@@ -37,6 +43,15 @@ def #{filter}_filter(*names, &blk)
end
end
+ def prepend_#{filter}_filter(*names, &blk)
+ options = names.last.is_a?(Hash) ? names.pop : {}
+ _normalize_callback_options(options)
+ names.push(blk) if block_given?
+ names.each do |name|
+ process_action_callback(:#{filter}, name, options.merge(:prepend => true))
+ end
+ end
+
def skip_#{filter}_filter(*names, &blk)
options = names.last.is_a?(Hash) ? names.pop : {}
_normalize_callback_options(options)
@@ -51,4 +66,4 @@ def skip_#{filter}_filter(*names, &blk)
end
end
end
-end
+end
@@ -1,3 +1,3 @@
module AbstractController
- class ActionNotFound < StandardError ; end
-end
+ class ActionNotFound < StandardError; end
+end
@@ -1,8 +1,8 @@
module AbstractController
module Helpers
- extend ActiveSupport::DependencyModule
+ extend ActiveSupport::Concern
- depends_on Renderer
+ include Renderer
included do
extlib_inheritable_accessor :master_helper_module
@@ -16,12 +16,12 @@ def _action_view
av
end
end
-
+
module ClassMethods
def inherited(klass)
klass.master_helper_module = Module.new
klass.master_helper_module.__send__ :include, master_helper_module
-
+
super
end
@@ -57,7 +57,7 @@ def #{meth}(*args, &blk)
ruby_eval
end
end
-
+
def helper(*args, &block)
args.flatten.each do |arg|
case arg
@@ -68,6 +68,5 @@ def helper(*args, &block)
master_helper_module.module_eval(&block) if block_given?
end
end
-
end
-end
+end
Oops, something went wrong.

0 comments on commit fd3c55f

Please sign in to comment.