Browse files

Merge branch '2-3-stable' of git@github.com:rails/rails into 2-3-stable

  • Loading branch information...
2 parents 2255474 + a8bd3c8 commit dfdf8e5dab473019b0ffffdc7b0cba5f54bb711c @jeremy jeremy committed Jul 1, 2009
View
3 actionmailer/test/abstract_unit.rb
@@ -1,9 +1,6 @@
require 'rubygems'
require 'test/unit'
-gem 'mocha', '>= 0.9.5'
-require 'mocha'
-
$:.unshift "#{File.dirname(__FILE__)}/../lib"
$:.unshift "#{File.dirname(__FILE__)}/../../activesupport/lib"
$:.unshift "#{File.dirname(__FILE__)}/../../actionpack/lib"
View
4 actionpack/lib/action_controller/base.rb
@@ -491,6 +491,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
View
2 actionpack/lib/action_controller/routing/route_set.rb
@@ -436,7 +436,7 @@ def call(env)
def recognize(request)
params = recognize_path(request.path, extract_request_environment(request))
request.path_parameters = params.with_indifferent_access
- "#{params[:controller].camelize}Controller".constantize
+ "#{params[:controller].to_s.camelize}Controller".constantize
end
def recognize_path(path, environment={})
View
2 actionpack/lib/action_controller/streaming.rb
@@ -161,7 +161,7 @@ def send_file_headers!(options)
content_type = content_type.to_s.strip # fixes a problem with extra '\r' with some browsers
headers.merge!(
- 'Content-Length' => options[:length],
+ 'Content-Length' => options[:length].to_s,
'Content-Type' => content_type,
'Content-Disposition' => disposition,
'Content-Transfer-Encoding' => 'binary'
View
5 actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -230,6 +230,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
@@ -257,6 +259,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
View
3 actionpack/test/controller/filter_params_test.rb
@@ -23,7 +23,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)
View
11 actionpack/test/controller/routing_test.rb
@@ -1662,6 +1662,17 @@ def test_draw
assert_equal 1, set.routes.size
end
+ def test_draw_symbol_controller_name
+ assert_equal 0, set.routes.size
+ set.draw do |map|
+ map.connect '/users/index', :controller => :users, :action => :index
+ end
+ @request = ActionController::TestRequest.new
+ @request.request_uri = '/users/index'
+ assert_nothing_raised { set.recognize(@request) }
+ assert_equal 1, set.routes.size
+ end
+
def test_named_draw
assert_equal 0, set.routes.size
set.draw do |map|
View
2 actionpack/test/controller/send_file_test.rb
@@ -108,7 +108,7 @@ def test_send_file_headers!
@controller.send(:send_file_headers!, options)
h = @controller.headers
- assert_equal 1, h['Content-Length']
+ assert_equal '1', h['Content-Length']
assert_equal 'image/png', h['Content-Type']
assert_equal 'disposition; filename="filename"', h['Content-Disposition']
assert_equal 'binary', h['Content-Transfer-Encoding']
View
12 actionpack/test/template/form_tag_helper_test.rb
@@ -158,6 +158,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
3 activerecord/test/cases/helper.rb
@@ -5,8 +5,7 @@
require 'rubygems'
require 'test/unit'
-gem 'mocha', '>= 0.9.5'
-require 'mocha'
+require 'stringio'
require 'active_record'
require 'active_record/test_case'
View
4 activeresource/test/abstract_unit.rb
@@ -1,8 +1,6 @@
require 'rubygems'
require 'test/unit'
-
-gem 'mocha', '>= 0.9.5'
-require 'mocha'
+require 'active_support/test_case'
$:.unshift "#{File.dirname(__FILE__)}/../lib"
$:.unshift "#{File.dirname(__FILE__)}/../../activesupport/lib"
View
2 activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
@@ -1,3 +1,5 @@
+require "active_support/core_ext/array"
+
# Extends the module object with module and instance accessors for class attributes,
# just like the native attr* accessors for instance attributes.
#
View
14 activesupport/lib/active_support/test_case.rb
@@ -1,18 +1,18 @@
+require 'test/unit/testcase'
+require 'active_support/testing/setup_and_teardown'
+require 'active_support/testing/assertions'
+require 'active_support/testing/deprecation'
+require 'active_support/testing/declarative'
+
begin
- gem 'mocha', '>= 0.9.3'
+ gem 'mocha', ">= 0.9.7"
require 'mocha'
rescue LoadError
# Fake Mocha::ExpectationError so we can rescue it in #run. Bleh.
Object.const_set :Mocha, Module.new
Mocha.const_set :ExpectationError, Class.new(StandardError)
end
-require 'test/unit/testcase'
-require 'active_support/testing/setup_and_teardown'
-require 'active_support/testing/assertions'
-require 'active_support/testing/deprecation'
-require 'active_support/testing/declarative'
-
module ActiveSupport
class TestCase < ::Test::Unit::TestCase
if defined? MiniTest
View
2 activesupport/lib/active_support/testing/deprecation.rb
@@ -1,3 +1,5 @@
+require "active_support/core_ext/module"
+
module ActiveSupport
module Testing
module Deprecation #:nodoc:
View
1 activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb
@@ -2,7 +2,6 @@
require 'rubygems'
require 'test/unit'
-require 'mocha'
require 'i18n'
require 'active_support'
View
1 activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_test.rb
@@ -2,7 +2,6 @@
require 'rubygems'
require 'test/unit'
-require 'mocha'
require 'i18n'
require 'active_support'
View
1 activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb
@@ -3,7 +3,6 @@
require 'rubygems'
require 'test/unit'
-require 'mocha'
require 'i18n'
require 'time'
require 'yaml'
View
3 activesupport/test/abstract_unit.rb
@@ -1,8 +1,7 @@
require 'rubygems'
require 'test/unit'
-gem 'mocha', '>= 0.9.5'
-require 'mocha'
+ENV['NO_RELOAD'] = '1'
$:.unshift "#{File.dirname(__FILE__)}/../lib"
require 'active_support'
View
3 railties/test/abstract_unit.rb
@@ -9,9 +9,6 @@
require 'rubygems'
require 'test/unit'
-gem 'mocha', '>= 0.9.5'
-require 'mocha'
-
require 'active_support'
require 'active_support/test_case'

0 comments on commit dfdf8e5

Please sign in to comment.