Permalink
Browse files

Merge commit 'rails/master'

Conflicts:
	activerecord/lib/active_record/base.rb
  • Loading branch information...
2 parents 9c70442 + db3de78 commit e5b8c4483c8de805d5847563edcf4e5d7e035a87 @miloops miloops committed Jun 30, 2009
Showing with 646 additions and 77 deletions.
  1. +1 −1 actionmailer/Rakefile
  2. +3 −3 actionmailer/lib/action_mailer/version.rb
  3. +1 −1 actionpack/Rakefile
  4. +4 −0 actionpack/lib/action_controller/base/filter_parameter_logging.rb
  5. +3 −3 actionpack/lib/action_pack/version.rb
  6. +5 −0 actionpack/lib/action_view/helpers/form_tag_helper.rb
  7. +2 −1 actionpack/test/controller/filter_params_test.rb
  8. +12 −0 actionpack/test/template/form_tag_helper_test.rb
  9. +1 −1 activerecord/Rakefile
  10. +2 −2 activerecord/lib/active_record/base.rb
  11. +3 −3 activerecord/lib/active_record/version.rb
  12. +7 −1 activerecord/test/cases/reflection_test.rb
  13. +1 −1 activeresource/Rakefile
  14. +3 −3 activeresource/lib/active_resource/version.rb
  15. +1 −0 activesupport/lib/active_support/test_case.rb
  16. +0 −6 activesupport/lib/active_support/testing/declarative.rb
  17. +39 −0 activesupport/lib/active_support/testing/isolation.rb
  18. +0 −2 activesupport/lib/active_support/testing/setup_and_teardown.rb
  19. +3 −3 activesupport/lib/active_support/version.rb
  20. +141 −0 activesupport/test/isolation_test.rb
  21. +5 −5 railties/Rakefile
  22. +15 −35 railties/lib/initializer.rb
  23. +31 −2 railties/lib/rails/configuration.rb
  24. +124 −0 railties/lib/rails/paths.rb
  25. +3 −3 railties/lib/rails/version.rb
  26. +1 −1 railties/lib/railties_path.rb
  27. +1 −0 railties/lib/test_help.rb
  28. +1 −0 railties/test/abstract_unit.rb
  29. +103 −0 railties/test/initializer/path_test.rb
  30. 0 railties/test/initializer/root/app/controllers/.keep
  31. 0 railties/test/initializer/root/app/helpers/.keep
  32. 0 railties/test/initializer/root/app/metal/.keep
  33. 0 railties/test/initializer/root/app/models/.keep
  34. 0 railties/test/initializer/root/app/views/.keep
  35. +4 −0 railties/test/initializer/root/config/database.yml
  36. 0 railties/test/initializer/root/config/environments/.keep
  37. 0 railties/test/initializer/root/config/locales/.keep
  38. 0 railties/test/initializer/root/config/routes.rb
  39. 0 railties/test/initializer/root/lib/.keep
  40. 0 railties/test/initializer/root/tmp/.keep
  41. 0 railties/test/initializer/root/tmp/cache/.keep
  42. 0 railties/test/initializer/root/vendor/.keep
  43. +126 −0 railties/test/paths_test.rb
View
@@ -60,7 +60,7 @@ spec = Gem::Specification.new do |s|
s.rubyforge_project = "actionmailer"
s.homepage = "http://www.rubyonrails.org"
- s.add_dependency('actionpack', '= 2.3.2' + PKG_BUILD)
+ s.add_dependency('actionpack', '= 3.0.pre' + PKG_BUILD)
s.has_rdoc = true
s.requirements << 'none'
@@ -1,8 +1,8 @@
module ActionMailer
module VERSION #:nodoc:
- MAJOR = 2
- MINOR = 3
- TINY = 2
+ MAJOR = 3
+ MINOR = 0
+ TINY = "pre"
STRING = [MAJOR, MINOR, TINY].join('.')
end
View
@@ -115,7 +115,7 @@ spec = Gem::Specification.new do |s|
s.has_rdoc = true
s.requirements << 'none'
- s.add_dependency('activesupport', '= 2.3.2' + PKG_BUILD)
+ s.add_dependency('activesupport', '= 3.0.pre' + PKG_BUILD)
s.require_path = 'lib'
s.autorequire = 'action_controller'
@@ -43,6 +43,10 @@ def filter_parameter_logging(*filter_words, &block)
filtered_parameters[key] = '[FILTERED]'
elsif value.is_a?(Hash)
filtered_parameters[key] = filter_parameters(value)
+ elsif value.is_a?(Array)
+ filtered_parameters[key] = value.collect do |item|
+ filter_parameters(item)
+ end
elsif block_given?
key = key.dup
value = value.dup if value
@@ -1,8 +1,8 @@
module ActionPack #:nodoc:
module VERSION #:nodoc:
- MAJOR = 2
- MINOR = 3
- TINY = 2
+ MAJOR = 3
+ MINOR = 0
+ TINY = "pre"
STRING = [MAJOR, MINOR, TINY].join('.')
end
@@ -231,6 +231,8 @@ def password_field_tag(name = "password", value = nil, options = {})
# * <tt>:rows</tt> - Specify the number of rows in the textarea
# * <tt>:cols</tt> - Specify the number of columns in the textarea
# * <tt>:disabled</tt> - If set to true, the user will not be able to use this input.
+ # * <tt>:escape</tt> - By default, the contents of the text input are HTML escaped.
+ # If you need unescaped contents, set this to false.
# * Any other key creates standard HTML attributes for the tag.
#
# ==== Examples
@@ -258,6 +260,9 @@ def text_area_tag(name, content = nil, options = {})
options["cols"], options["rows"] = size.split("x") if size.respond_to?(:split)
end
+ escape = options.key?("escape") ? options.delete("escape") : true
+ content = html_escape(content) if escape
+
content_tag :textarea, content, { "name" => name, "id" => sanitize_to_id(name) }.update(options.stringify_keys)
end
@@ -40,7 +40,8 @@ def test_filter_parameters
[{'foo'=>'bar', 'bar'=>'foo'},{'foo'=>'[FILTERED]', 'bar'=>'foo'},%w'foo baz'],
[{'foo'=>'bar', 'baz'=>'foo'},{'foo'=>'[FILTERED]', 'baz'=>'[FILTERED]'},%w'foo baz'],
[{'bar'=>{'foo'=>'bar','bar'=>'foo'}},{'bar'=>{'foo'=>'[FILTERED]','bar'=>'foo'}},%w'fo'],
- [{'foo'=>{'foo'=>'bar','bar'=>'foo'}},{'foo'=>'[FILTERED]'},%w'f banana']]
+ [{'foo'=>{'foo'=>'bar','bar'=>'foo'}},{'foo'=>'[FILTERED]'},%w'f banana'],
+ [{'baz'=>[{'foo'=>'baz'}]}, {'baz'=>[{'foo'=>'[FILTERED]'}]}, %w(foo)]]
test_hashes.each do |before_filter, after_filter, filter_words|
FilterParamController.filter_parameter_logging(*filter_words)
@@ -159,6 +159,18 @@ def test_text_area_tag_id_sanitized
assert_match VALID_HTML_ID, input_elem['id']
end
+ def test_text_area_tag_escape_content
+ actual = text_area_tag "body", "<b>hello world</b>", :size => "20x40"
+ expected = %(<textarea cols="20" id="body" name="body" rows="40">&lt;b&gt;hello world&lt;/b&gt;</textarea>)
+ assert_dom_equal expected, actual
+ end
+
+ def test_text_area_tag_unescaped_content
+ actual = text_area_tag "body", "<b>hello world</b>", :size => "20x40", :escape => false
+ expected = %(<textarea cols="20" id="body" name="body" rows="40"><b>hello world</b></textarea>)
+ assert_dom_equal expected, actual
+ end
+
def test_text_field_tag
actual = text_field_tag "title", "Hello!"
expected = %(<input id="title" name="title" type="text" value="Hello!" />)
View
@@ -187,7 +187,7 @@ spec = Gem::Specification.new do |s|
s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
end
- s.add_dependency('activesupport', '= 2.3.2' + PKG_BUILD)
+ s.add_dependency('activesupport', '= 3.0.pre' + PKG_BUILD)
s.files.delete FIXTURES_ROOT + "/fixture_database.sqlite"
s.files.delete FIXTURES_ROOT + "/fixture_database_2.sqlite"
@@ -1403,14 +1403,14 @@ def human_attribute_name(attribute_key_name, options = {})
end
# Transform the modelname into a more humane format, using I18n.
- # Defaults to the basic humanize method.
+ # By default, it will underscore then humanize the class name (BlogPost.human_name #=> "Blog post").
# Default scope of the translation is activerecord.models
# Specify +options+ with additional translating options.
def human_name(options = {})
defaults = self_and_descendants_from_active_record.map do |klass|
:"#{klass.name.underscore}"
end
- defaults << self.name.humanize
+ defaults << self.name.underscore.humanize
I18n.translate(defaults.shift, {:scope => [:activerecord, :models], :count => 1, :default => defaults}.merge(options))
end
@@ -1,8 +1,8 @@
module ActiveRecord
module VERSION #:nodoc:
- MAJOR = 2
- MINOR = 3
- TINY = 2
+ MAJOR = 3
+ MINOR = 0
+ TINY = "pre"
STRING = [MAJOR, MINOR, TINY].join('.')
end
@@ -5,14 +5,20 @@
require 'models/company_in_module'
require 'models/subscriber'
require 'models/pirate'
+require 'models/price_estimate'
class ReflectionTest < ActiveRecord::TestCase
- fixtures :topics, :customers, :companies, :subscribers
+ fixtures :topics, :customers, :companies, :subscribers, :price_estimates
def setup
@first = Topic.find(1)
end
+ def test_human_name
+ assert_equal "Price estimate", PriceEstimate.human_name
+ assert_equal "Subscriber", Subscriber.human_name
+ end
+
def test_column_null_not_null
subscriber = Subscriber.find(:first)
assert subscriber.column_for_attribute("name").null
View
@@ -73,7 +73,7 @@ spec = Gem::Specification.new do |s|
s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
end
- s.add_dependency('activesupport', '= 2.3.2' + PKG_BUILD)
+ s.add_dependency('activesupport', '= 3.0.pre' + PKG_BUILD)
s.require_path = 'lib'
s.autorequire = 'active_resource'
@@ -1,8 +1,8 @@
module ActiveResource
module VERSION #:nodoc:
- MAJOR = 2
- MINOR = 3
- TINY = 2
+ MAJOR = 3
+ MINOR = 0
+ TINY = "pre"
STRING = [MAJOR, MINOR, TINY].join('.')
end
@@ -13,6 +13,7 @@
require 'active_support/testing/deprecation'
require 'active_support/testing/declarative'
require 'active_support/testing/pending'
+require 'active_support/testing/isolation'
module ActiveSupport
class TestCase < ::Test::Unit::TestCase
@@ -15,12 +15,6 @@ def self.name
end
end
- if defined?(Spec)
- class << self
- alias_method :test, :it
- end
- end
-
end
end
@@ -0,0 +1,39 @@
+module ActiveSupport::Testing
+ class ProxyTestResult
+ def initialize
+ @calls = []
+ end
+
+ def __replay__(result)
+ @calls.each do |name, args|
+ result.send(name, *args)
+ end
+ end
+
+ def method_missing(name, *args)
+ @calls << [name, args]
+ end
+ end
+
+ module Isolation
+ def run(result)
+ yield(Test::Unit::TestCase::STARTED, name)
+
+ read, write = IO.pipe
+
+ pid = fork do
+ # child
+ read.close
+ proxy = ProxyTestResult.new
+ super(proxy) { }
+ write.puts [Marshal.dump(proxy)].pack("m")
+ exit!
+ end
+
+ write.close
+ Marshal.load(read.read.unpack("m")[0]).__replay__(result)
+ Process.wait2(pid)
+ yield(Test::Unit::TestCase::FINISHED, name)
+ end
+ end
+end
@@ -10,8 +10,6 @@ def self.included(base)
if defined?(MiniTest::Assertions) && TestCase < MiniTest::Assertions
include ForMiniTest
- elsif defined? Spec
- include ForRspec
else
include ForClassicTestUnit
end
@@ -1,8 +1,8 @@
module ActiveSupport
module VERSION #:nodoc:
- MAJOR = 2
- MINOR = 3
- TINY = 2
+ MAJOR = 3
+ MINOR = 0
+ TINY = "pre"
STRING = [MAJOR, MINOR, TINY].join('.')
end
Oops, something went wrong.

0 comments on commit e5b8c44

Please sign in to comment.