Permalink
Browse files

Upgrade Rails

  • Loading branch information...
joshuaclayton committed Dec 21, 2009
1 parent 58625a1 commit 1d849ad3423f05201c6767142be4fa6e6b0dd2bf
Showing with 3,730 additions and 602 deletions.
  1. +1 −1 config/environment.rb
  2. +4 −0 vendor/rails/actionmailer/CHANGELOG
  3. +1 −1 vendor/rails/actionmailer/Rakefile
  4. +2 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.2.3/tmail/parser.rb
  5. +1 −1 vendor/rails/actionmailer/lib/action_mailer/version.rb
  6. +1 −0 vendor/rails/actionmailer/lib/actionmailer.rb
  7. +1 −1 vendor/rails/actionmailer/test/fixtures/helpers/example_helper.rb
  8. +3 −1 vendor/rails/actionmailer/test/mail_service_test.rb
  9. +12 −0 vendor/rails/actionpack/CHANGELOG
  10. +1 −1 vendor/rails/actionpack/Rakefile
  11. +3 −1 vendor/rails/actionpack/lib/action_controller.rb
  12. +19 −3 vendor/rails/actionpack/lib/action_controller/assertions/dom_assertions.rb
  13. +16 −10 vendor/rails/actionpack/lib/action_controller/assertions/selector_assertions.rb
  14. +1 −1 vendor/rails/actionpack/lib/action_controller/base.rb
  15. +1 −0 vendor/rails/actionpack/lib/action_controller/caching.rb
  16. +2 −1 vendor/rails/actionpack/lib/action_controller/cookies.rb
  17. +3 −2 vendor/rails/actionpack/lib/action_controller/http_authentication.rb
  18. +15 −3 vendor/rails/actionpack/lib/action_controller/integration.rb
  19. +6 −1 vendor/rails/actionpack/lib/action_controller/layout.rb
  20. +2 −0 vendor/rails/actionpack/lib/action_controller/middlewares.rb
  21. +6 −21 vendor/rails/actionpack/lib/action_controller/polymorphic_routes.rb
  22. +36 −0 vendor/rails/actionpack/lib/action_controller/rack_lint_patch.rb
  23. +6 −2 vendor/rails/actionpack/lib/action_controller/request_forgery_protection.rb
  24. +2 −1 vendor/rails/actionpack/lib/action_controller/response.rb
  25. +29 −0 vendor/rails/actionpack/lib/action_controller/string_coercion.rb
  26. +6 −1 vendor/rails/actionpack/lib/action_controller/test_case.rb
  27. +1 −1 vendor/rails/actionpack/lib/action_controller/test_process.rb
  28. +2 −2 vendor/rails/actionpack/lib/action_controller/translation.rb
  29. +2 −2 vendor/rails/actionpack/lib/action_controller/uploaded_file.rb
  30. +1 −1 vendor/rails/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb
  31. +1 −1 vendor/rails/actionpack/lib/action_pack/version.rb
  32. +3 −3 vendor/rails/actionpack/lib/action_view.rb
  33. +6 −1 vendor/rails/actionpack/lib/action_view/base.rb
  34. +6 −0 vendor/rails/actionpack/lib/action_view/erb/util.rb
  35. +2 −0 vendor/rails/actionpack/lib/action_view/helpers.rb
  36. +3 −3 vendor/rails/actionpack/lib/action_view/helpers/active_record_helper.rb
  37. +2 −2 vendor/rails/actionpack/lib/action_view/helpers/asset_tag_helper.rb
  38. +2 −2 vendor/rails/actionpack/lib/action_view/helpers/capture_helper.rb
  39. +27 −15 vendor/rails/actionpack/lib/action_view/helpers/date_helper.rb
  40. +32 −11 vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb
  41. +1 −1 vendor/rails/actionpack/lib/action_view/helpers/form_options_helper.rb
  42. +3 −3 vendor/rails/actionpack/lib/action_view/helpers/form_tag_helper.rb
  43. +6 −1 vendor/rails/actionpack/lib/action_view/helpers/number_helper.rb
  44. +1 −1 vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb
  45. +9 −0 vendor/rails/actionpack/lib/action_view/helpers/raw_output_helper.rb
  46. +10 −2 vendor/rails/actionpack/lib/action_view/helpers/sanitize_helper.rb
  47. +4 −4 vendor/rails/actionpack/lib/action_view/helpers/tag_helper.rb
  48. +1 −1 vendor/rails/actionpack/lib/action_view/helpers/translation_helper.rb
  49. +3 −3 vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb
  50. +3 −0 vendor/rails/actionpack/lib/action_view/locale/en.yml
  51. +1 −1 vendor/rails/actionpack/lib/action_view/partials.rb
  52. +28 −0 vendor/rails/actionpack/lib/action_view/safe_buffer.rb
  53. +8 −2 vendor/rails/actionpack/lib/action_view/template.rb
  54. +102 −27 vendor/rails/actionpack/lib/action_view/test_case.rb
  55. +1 −0 vendor/rails/actionpack/lib/actionpack.rb
  56. +7 −0 vendor/rails/actionpack/test/controller/cookie_test.rb
  57. +53 −0 vendor/rails/actionpack/test/controller/dom_assertions_test.rb
  58. +1 −0 vendor/rails/actionpack/test/controller/filter_params_test.rb
  59. +1 −0 vendor/rails/actionpack/test/controller/html-scanner/sanitizer_test.rb
  60. +22 −0 vendor/rails/actionpack/test/controller/http_digest_authentication_test.rb
  61. +38 −0 vendor/rails/actionpack/test/controller/integration_test.rb
  62. +11 −0 vendor/rails/actionpack/test/controller/layout_test.rb
  63. +4 −0 vendor/rails/actionpack/test/controller/polymorphic_routes_test.rb
  64. +19 −1 vendor/rails/actionpack/test/controller/request_forgery_protection_test.rb
  65. +23 −15 vendor/rails/actionpack/test/controller/routing_test.rb
  66. +2 −2 vendor/rails/actionpack/test/controller/session/test_session_test.rb
  67. +1 −0 vendor/rails/actionpack/test/fixtures/layout_tests/abs_path_layout.rhtml
  68. +1 −0 vendor/rails/actionpack/test/fixtures/test/_from_helper.erb
  69. +1 −1 vendor/rails/actionpack/test/template/active_record_helper_test.rb
  70. +12 −0 vendor/rails/actionpack/test/template/asset_tag_helper_test.rb
  71. +6 −6 vendor/rails/actionpack/test/template/benchmark_helper_test.rb
  72. +2 −1 vendor/rails/actionpack/test/template/compiled_templates_test.rb
  73. +10 −9 vendor/rails/actionpack/test/template/date_helper_i18n_test.rb
  74. +29 −13 vendor/rails/actionpack/test/template/date_helper_test.rb
  75. +90 −10 vendor/rails/actionpack/test/template/form_helper_test.rb
  76. +4 −0 vendor/rails/actionpack/test/template/number_helper_test.rb
  77. +21 −0 vendor/rails/actionpack/test/template/raw_output_helper_test.rb
  78. +10 −1 vendor/rails/actionpack/test/template/sanitize_helper_test.rb
  79. +1 −0 vendor/rails/actionpack/test/template/tag_helper_test.rb
  80. +36 −0 vendor/rails/actionpack/test/view/safe_buffer_test.rb
  81. +173 −5 vendor/rails/actionpack/test/view/test_case_test.rb
  82. +8 −0 vendor/rails/activerecord/CHANGELOG
  83. +1 −1 vendor/rails/activerecord/Rakefile
  84. +10 −7 vendor/rails/activerecord/lib/active_record/associations.rb
  85. +7 −8 vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb
  86. +2 −2 vendor/rails/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
  87. +9 −0 vendor/rails/activerecord/lib/active_record/associations/has_one_association.rb
  88. +32 −23 vendor/rails/activerecord/lib/active_record/autosave_association.rb
  89. +7 −0 vendor/rails/activerecord/lib/active_record/base.rb
  90. +6 −2 vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
  91. +1 −1 vendor/rails/activerecord/lib/active_record/fixtures.rb
  92. +0 −33 vendor/rails/activerecord/lib/active_record/locking/optimistic.rb
  93. +0 −22 vendor/rails/activerecord/lib/active_record/locking/pessimistic.rb
  94. +101 −38 vendor/rails/activerecord/lib/active_record/nested_attributes.rb
  95. +35 −35 vendor/rails/activerecord/lib/active_record/validations.rb
  96. +1 −1 vendor/rails/activerecord/lib/active_record/version.rb
  97. +1 −0 vendor/rails/activerecord/lib/activerecord.rb
  98. +12 −0 vendor/rails/activerecord/test/cases/associations/has_many_associations_test.rb
  99. +22 −0 vendor/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb
  100. +21 −0 vendor/rails/activerecord/test/cases/associations/has_one_associations_test.rb
  101. +230 −11 vendor/rails/activerecord/test/cases/autosave_association_test.rb
  102. +2 −0 vendor/rails/activerecord/test/cases/base_test.rb
  103. +8 −0 vendor/rails/activerecord/test/cases/connection_test_mysql.rb
  104. +2 −2 vendor/rails/activerecord/test/cases/fixtures_test.rb
  105. +0 −18 vendor/rails/activerecord/test/cases/locking_test.rb
  106. +109 −37 vendor/rails/activerecord/test/cases/nested_attributes_test.rb
  107. +3 −3 vendor/rails/activerecord/test/cases/reflection_test.rb
  108. +8 −0 vendor/rails/activerecord/test/cases/validations_i18n_test.rb
  109. +37 −9 vendor/rails/activerecord/test/cases/validations_test.rb
  110. +1 −0 vendor/rails/activerecord/test/fixtures/accounts.yml
  111. BIN vendor/rails/activerecord/test/fixtures/fixture_database.sqlite3
  112. BIN vendor/rails/activerecord/test/fixtures/fixture_database_2.sqlite3
  113. +10 −0 vendor/rails/activerecord/test/models/company.rb
  114. +9 −2 vendor/rails/activerecord/test/models/pirate.rb
  115. +2 −0 vendor/rails/activerecord/test/models/treasure.rb
  116. +12 −0 vendor/rails/activerecord/test/schema/mysql_specific_schema.rb
  117. +1 −0 vendor/rails/activerecord/test/schema/schema.rb
  118. +9 −0 vendor/rails/activeresource/CHANGELOG
  119. +1 −1 vendor/rails/activeresource/Rakefile
  120. +2 −2 vendor/rails/activeresource/lib/active_resource/validations.rb
  121. +1 −1 vendor/rails/activeresource/lib/active_resource/version.rb
  122. +1 −0 vendor/rails/activeresource/lib/activeresource.rb
  123. +2 −2 vendor/rails/activeresource/test/base_errors_test.rb
  124. +1,728 −0 vendor/rails/activeresource/test/debug.log
  125. +8 −0 vendor/rails/activesupport/CHANGELOG
  126. +7 −0 vendor/rails/activesupport/lib/active_support/cache.rb
  127. +5 −0 vendor/rails/activesupport/lib/active_support/cache/mem_cache_store.rb
  128. +5 −5 vendor/rails/activesupport/lib/active_support/cache/strategy/local_cache.rb
  129. +7 −3 vendor/rails/activesupport/lib/active_support/core_ext.rb
  130. +2 −58 vendor/rails/activesupport/lib/active_support/core_ext/blank.rb
  131. +1 −0 vendor/rails/activesupport/lib/active_support/core_ext/kernel/debugger.rb
  132. +3 −1 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
  133. +1 −0 vendor/rails/activesupport/lib/active_support/core_ext/object.rb
  134. +58 −0 vendor/rails/activesupport/lib/active_support/core_ext/object/blank.rb
  135. +2 −0 vendor/rails/activesupport/lib/active_support/core_ext/string.rb
  136. +48 −0 vendor/rails/activesupport/lib/active_support/core_ext/string/output_safety.rb
  137. +2 −1 vendor/rails/activesupport/lib/active_support/core_ext/time/calculations.rb
  138. +1 −1 vendor/rails/activesupport/lib/active_support/deprecation.rb
  139. +2 −3 vendor/rails/activesupport/lib/active_support/json/backends/jsongem.rb
  140. +1 −5 vendor/rails/activesupport/lib/active_support/json/backends/yaml.rb
  141. +2 −0 vendor/rails/activesupport/lib/active_support/json/decoding.rb
  142. +30 −10 vendor/rails/activesupport/lib/active_support/message_verifier.rb
  143. +1 −1 vendor/rails/activesupport/lib/active_support/multibyte/chars.rb
  144. +4 −4 vendor/rails/activesupport/lib/active_support/multibyte/utils.rb
  145. +7 −0 vendor/rails/activesupport/lib/active_support/ordered_hash.rb
  146. +2 −2 vendor/rails/activesupport/lib/active_support/vendor.rb
  147. +1 −1 vendor/rails/activesupport/lib/active_support/version.rb
  148. +8 −2 vendor/rails/activesupport/lib/active_support/whiny_nil.rb
  149. +13 −21 vendor/rails/activesupport/lib/active_support/xml_mini/nokogiri.rb
  150. +1 −0 vendor/rails/activesupport/lib/activesupport.rb
  151. +6 −0 vendor/rails/railties/CHANGELOG
  152. +6 −6 vendor/rails/railties/Rakefile
  153. +1 −1 vendor/rails/railties/lib/commands/plugin.rb
  154. +2 −0 vendor/rails/railties/lib/rails/rack/debugger.rb
  155. +1 −1 vendor/rails/railties/lib/rails/version.rb
  156. +7 −7 vendor/rails/railties/lib/rails_generator/options.rb
  157. +2 −1 vendor/rails/railties/lib/tasks/rails.rb
View
@@ -1,4 +1,4 @@
-RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
+RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
require File.join(File.dirname(__FILE__), 'boot')
@@ -1,3 +1,7 @@
+*2.3.5 (November 25, 2009)*
+
+* Minor Bug Fixes and deprecation warnings
+
*2.3.4 (September 4, 2009)*
* Minor bug fixes.
@@ -54,7 +54,7 @@ spec = Gem::Specification.new do |s|
s.rubyforge_project = "actionmailer"
s.homepage = "http://www.rubyonrails.org"
- s.add_dependency('actionpack', '= 2.3.4' + PKG_BUILD)
+ s.add_dependency('actionpack', '= 2.3.5' + PKG_BUILD)
s.has_rdoc = true
s.requirements << 'none'
@@ -43,6 +43,7 @@ module Racc
class Parser
+ old_verbose, $VERBOSE = $VERBOSE, nil
Racc_Runtime_Version = '1.4.5'
Racc_Runtime_Revision = '$Revision: 1.7 $'.split[1]
@@ -71,6 +72,7 @@ class Parser
Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_R
Racc_Runtime_Type = 'ruby'
end
+ $VERBOSE = old_verbose
def Parser.racc_runtime_type
Racc_Runtime_Type
@@ -2,7 +2,7 @@ module ActionMailer
module VERSION #:nodoc:
MAJOR = 2
MINOR = 3
- TINY = 4
+ TINY = 5
STRING = [MAJOR, MINOR, TINY].join('.')
end
@@ -1 +1,2 @@
require 'action_mailer'
+ActiveSupport::Deprecation.warn 'require "actionmailer" is deprecated and will be removed in Rails 3. Use require "action_mailer" instead.'
@@ -1,5 +1,5 @@
module ExampleHelper
def example_format(text)
- "<em><strong><small>#{text}</small></strong></em>"
+ "<em><strong><small>#{h(text)}</small></strong></em>".html_safe!
end
end
@@ -570,7 +570,9 @@ def test_delivery_logs_sent_mail
mail = TestMailer.create_signed_up(@recipient)
logger = mock()
logger.expects(:info).with("Sent mail to #{@recipient}")
- logger.expects(:debug).with("\n#{mail.encoded}")
+ logger.expects(:debug).with() do |logged_text|
+ logged_text =~ /\[Signed up\] Welcome/
+ end
TestMailer.logger = logger
TestMailer.deliver_signed_up(@recipient)
end
@@ -1,3 +1,15 @@
+*2.3.5 (November 25, 2009)*
+
+* Minor Bug Fixes and deprecation warnings
+
+* Ruby 1.9 Support
+
+* Fix filtering parameters when there are Fixnum or other un-dupable values.
+
+* Improvements to ActionView::TestCase
+
+* Compatiblity with the rails_xss plugin
+
*2.3.4 (September 4, 2009)*
* Sanitize multibyte strings before escaping them with escape_once. CVE-2009-3009
@@ -79,7 +79,7 @@ spec = Gem::Specification.new do |s|
s.has_rdoc = true
s.requirements << 'none'
- s.add_dependency('activesupport', '= 2.3.4' + PKG_BUILD)
+ s.add_dependency('activesupport', '= 2.3.5' + PKG_BUILD)
s.add_dependency('rack', '~> 1.0.0')
s.require_path = 'lib'
@@ -31,8 +31,9 @@
end
end
-gem 'rack', '~> 1.0.0'
+gem 'rack', '~> 1.0.1'
require 'rack'
+require 'action_controller/cgi_ext'
module ActionController
# TODO: Review explicit to see if they will automatically be handled by
@@ -70,6 +71,7 @@ def self.load_all!
autoload :SessionManagement, 'action_controller/session_management'
autoload :StatusCodes, 'action_controller/status_codes'
autoload :Streaming, 'action_controller/streaming'
+ autoload :StringCoercion, 'action_controller/string_coercion'
autoload :TestCase, 'action_controller/test_case'
autoload :TestProcess, 'action_controller/test_process'
autoload :Translation, 'action_controller/translation'
@@ -1,6 +1,18 @@
module ActionController
module Assertions
module DomAssertions
+ def self.strip_whitespace!(nodes)
+ nodes.reject! do |node|
+ if node.is_a?(HTML::Text)
+ node.content.strip!
+ node.content.empty?
+ else
+ strip_whitespace! node.children
+ false
+ end
+ end
+ end
+
# Test two HTML strings for equivalency (e.g., identical up to reordering of attributes)
#
# ==== Examples
@@ -12,13 +24,15 @@ def assert_dom_equal(expected, actual, message = "")
clean_backtrace do
expected_dom = HTML::Document.new(expected).root
actual_dom = HTML::Document.new(actual).root
- full_message = build_message(message, "<?> expected to be == to\n<?>.", expected_dom.to_s, actual_dom.to_s)
+ DomAssertions.strip_whitespace!(expected_dom.children)
+ DomAssertions.strip_whitespace!(actual_dom.children)
+ full_message = build_message(message, "<?> expected but was\n<?>.", expected_dom.to_s, actual_dom.to_s)
assert_block(full_message) { expected_dom == actual_dom }
end
end
- # The negated form of +assert_dom_equivalent+.
+ # The negated form of +assert_dom_equal+.
#
# ==== Examples
#
@@ -29,8 +43,10 @@ def assert_dom_not_equal(expected, actual, message = "")
clean_backtrace do
expected_dom = HTML::Document.new(expected).root
actual_dom = HTML::Document.new(actual).root
- full_message = build_message(message, "<?> expected to be != to\n<?>.", expected_dom.to_s, actual_dom.to_s)
+ DomAssertions.strip_whitespace!(expected_dom.children)
+ DomAssertions.strip_whitespace!(actual_dom.children)
+ full_message = build_message(message, "<?> expected to be != to\n<?>.", expected_dom.to_s, actual_dom.to_s)
assert_block(full_message) { expected_dom != actual_dom }
end
end
@@ -16,14 +16,20 @@ module Assertions
#
# Use +css_select+ to select elements without making an assertions, either
# from the response HTML or elements selected by the enclosing assertion.
- #
+ #
# In addition to HTML responses, you can make the following assertions:
# * +assert_select_rjs+ - Assertions on HTML content of RJS update and insertion operations.
# * +assert_select_encoded+ - Assertions on HTML encoded inside XML, for example for dealing with feed item descriptions.
# * +assert_select_email+ - Assertions on the HTML body of an e-mail.
#
# Also see HTML::Selector to learn how to use selectors.
module SelectorAssertions
+
+ def initialize(*args)
+ super
+ @selected = nil
+ end
+
# :call-seq:
# css_select(selector) => array
# css_select(element, selector) => array
@@ -53,8 +59,8 @@ module SelectorAssertions
# end
#
# # Selects all list items in unordered lists
- # items = css_select("ul>li")
- #
+ # items = css_select("ul>li")
+ #
# # Selects all form tags and then all inputs inside the form
# forms = css_select("form")
# forms.each do |form|
@@ -212,7 +218,7 @@ def assert_select(*args, &block)
# Otherwise just operate on the response document.
root = response_from_page_or_rjs
end
-
+
# First or second argument is the selector: string and we pass
# all remaining arguments. Array and we pass the argument. Also
# accepts selector itself.
@@ -225,7 +231,7 @@ def assert_select(*args, &block)
selector = arg
else raise ArgumentError, "Expecting a selector as the first argument"
end
-
+
# Next argument is used for equality tests.
equals = {}
case arg = args.shift
@@ -315,10 +321,10 @@ def assert_select(*args, &block)
# Returns all matches elements.
matches
end
-
+
def count_description(min, max) #:nodoc:
pluralize = lambda {|word, quantity| word << (quantity == 1 ? '' : 's')}
-
+
if min && max && (max != min)
"between #{min} and #{max} elements"
elsif min && !(min == 1 && max == 1)
@@ -327,7 +333,7 @@ def count_description(min, max) #:nodoc:
"at most #{max} #{pluralize['element', max]}"
end
end
-
+
# :call-seq:
# assert_select_rjs(id?) { |elements| ... }
# assert_select_rjs(statement, id?) { |elements| ... }
@@ -344,7 +350,7 @@ def count_description(min, max) #:nodoc:
# that update or insert an element with that identifier.
#
# Use the first argument to narrow down assertions to only statements
- # of that type. Possible values are <tt>:replace</tt>, <tt>:replace_html</tt>,
+ # of that type. Possible values are <tt>:replace</tt>, <tt>:replace_html</tt>,
# <tt>:show</tt>, <tt>:hide</tt>, <tt>:toggle</tt>, <tt>:remove</tt> and
# <tt>:insert_html</tt>.
#
@@ -488,7 +494,7 @@ def assert_select_rjs(*args, &block)
# end
# end
# end
- #
+ #
#
# # Selects all paragraph tags from within the description of an RSS feed
# assert_select_feed :rss, 2.0 do
@@ -502,7 +502,7 @@ def filter_parameter_logging(*filter_words, &block)
end
elsif block_given?
key = key.dup
- value = value.dup if value
+ value = value.dup if value.duplicable?
yield key, value
filtered_parameters[key] = value
else
@@ -22,6 +22,7 @@ module ActionController #:nodoc:
# ActionController::Base.cache_store = :file_store, "/path/to/cache/directory"
# ActionController::Base.cache_store = :drb_store, "druby://localhost:9192"
# ActionController::Base.cache_store = :mem_cache_store, "localhost"
+ # ActionController::Base.cache_store = :mem_cache_store, Memcached::Rails.new("localhost:11211")
# ActionController::Base.cache_store = MyOwnStore.new("parameter")
module Caching
autoload :Actions, 'action_controller/caching/actions'
@@ -87,8 +87,9 @@ def []=(key, options)
def delete(key, options = {})
options.symbolize_keys!
options[:path] = "/" unless options.has_key?(:path)
- super(key.to_s)
+ value = super(key.to_s)
@controller.response.delete_cookie(key, options)
+ value
end
end
end
@@ -227,9 +227,9 @@ def decode_credentials_header(request)
end
def decode_credentials(header)
- header.to_s.gsub(/^Digest\s+/,'').split(',').inject({}) do |hash, pair|
+ header.to_s.gsub(/^Digest\s+/,'').split(',').inject({}.with_indifferent_access) do |hash, pair|
key, value = pair.split('=', 2)
- hash[key.strip.to_sym] = value.to_s.gsub(/^"|"$/,'').gsub(/'/, '')
+ hash[key.strip] = value.to_s.gsub(/^"|"$/,'').gsub(/'/, '')
hash
end
end
@@ -289,6 +289,7 @@ def nonce(time = Time.now)
# allow a user to use new nonce without prompting user again for their
# username and password.
def validate_nonce(request, value, seconds_to_timeout=5*60)
+ return false if value.nil?
t = Base64.decode64(value).split(":").first.to_i
nonce(t) == value && (t - Time.now.to_i).abs <= seconds_to_timeout
end
@@ -1,6 +1,7 @@
require 'stringio'
require 'uri'
require 'active_support/test_case'
+require 'action_controller/rack_lint_patch'
module ActionController
module Integration #:nodoc:
@@ -268,7 +269,9 @@ def process(method, path, parameters = nil, headers = nil)
env["QUERY_STRING"] ||= ""
- data = data.is_a?(IO) ? data : StringIO.new(data || '')
+ data ||= ''
+ data.force_encoding(Encoding::ASCII_8BIT) if data.respond_to?(:force_encoding)
+ data = data.is_a?(IO) ? data : StringIO.new(data)
env.update(
"REQUEST_METHOD" => method.to_s.upcase,
@@ -476,6 +479,11 @@ def new_with_capture(*args)
end
module Runner
+ def initialize(*args)
+ super
+ @integration_session = nil
+ end
+
# Reset the current session. This is useful for testing multiple sessions
# in a single test case.
def reset!
@@ -543,8 +551,12 @@ def copy_session_variables! #:nodoc:
# Delegate unhandled messages to the current session instance.
def method_missing(sym, *args, &block)
reset! unless @integration_session
- returning @integration_session.__send__(sym, *args, &block) do
- copy_session_variables!
+ if @integration_session.respond_to?(sym)
+ returning @integration_session.__send__(sym, *args, &block) do
+ copy_session_variables!
+ end
+ else
+ super
end
end
end
@@ -194,6 +194,11 @@ def normalize_conditions(conditions)
end
end
+ def initialize(*args)
+ super
+ @real_format = nil
+ end
+
# Returns the name of the active layout. If the layout was specified as a method reference (through a symbol), this method
# is called and the return value is used. Likewise if the layout was specified as an inline method (through a proc or method
# object). If the layout was defined without a directory, layouts is assumed. So <tt>layout "weblog/standard"</tt> will return
@@ -221,7 +226,7 @@ def default_layout #:nodoc:
end
def find_layout(layout, format, html_fallback=false) #:nodoc:
- view_paths.find_template(layout.to_s =~ /layouts\// ? layout : "layouts/#{layout}", format, html_fallback)
+ view_paths.find_template(layout.to_s =~ /\A\/|layouts\// ? layout : "layouts/#{layout}", format, html_fallback)
rescue ActionView::MissingTemplate
raise if Mime::Type.lookup_by_extension(format.to_s).html?
end
@@ -10,3 +10,5 @@
use "ActionController::ParamsParser"
use "Rack::MethodOverride"
use "Rack::Head"
+
+use "ActionController::StringCoercion"
Oops, something went wrong.

0 comments on commit 1d849ad

Please sign in to comment.