Commit 4aa4a9bd authored by Antonio Terceiro's avatar Antonio Terceiro

Imported Upstream version 4.2.5

parent b8d7a567
......@@ -53,6 +53,7 @@ group :job do
gem 'qu-redis', require: false
gem 'delayed_job_active_record', require: false
gem 'sequel', require: false
gem 'amq-protocol', '< 2.0.0', require: false
end
# Add your own local bundler stuff
......@@ -90,7 +91,7 @@ platforms :ruby do
group :db do
gem 'pg', '>= 0.15.0'
gem 'mysql', '>= 2.9.0'
gem 'mysql2', '>= 0.3.13'
gem 'mysql2', '>= 0.4.0'
end
end
......
......@@ -14,55 +14,55 @@ GIT
PATH
remote: .
specs:
actionmailer (4.2.4.rc1)
actionpack (= 4.2.4.rc1)
actionview (= 4.2.4.rc1)
activejob (= 4.2.4.rc1)
actionmailer (4.2.5)
actionpack (= 4.2.5)
actionview (= 4.2.5)
activejob (= 4.2.5)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.4.rc1)
actionview (= 4.2.4.rc1)
activesupport (= 4.2.4.rc1)
actionpack (4.2.5)
actionview (= 4.2.5)
activesupport (= 4.2.5)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.4.rc1)
activesupport (= 4.2.4.rc1)
actionview (4.2.5)
activesupport (= 4.2.5)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.4.rc1)
activesupport (= 4.2.4.rc1)
activejob (4.2.5)
activesupport (= 4.2.5)
globalid (>= 0.3.0)
activemodel (4.2.4.rc1)
activesupport (= 4.2.4.rc1)
activemodel (4.2.5)
activesupport (= 4.2.5)
builder (~> 3.1)
activerecord (4.2.4.rc1)
activemodel (= 4.2.4.rc1)
activesupport (= 4.2.4.rc1)
activerecord (4.2.5)
activemodel (= 4.2.5)
activesupport (= 4.2.5)
arel (~> 6.0)
activesupport (4.2.4.rc1)
activesupport (4.2.5)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
rails (4.2.4.rc1)
actionmailer (= 4.2.4.rc1)
actionpack (= 4.2.4.rc1)
actionview (= 4.2.4.rc1)
activejob (= 4.2.4.rc1)
activemodel (= 4.2.4.rc1)
activerecord (= 4.2.4.rc1)
activesupport (= 4.2.4.rc1)
rails (4.2.5)
actionmailer (= 4.2.5)
actionpack (= 4.2.5)
actionview (= 4.2.5)
activejob (= 4.2.5)
activemodel (= 4.2.5)
activerecord (= 4.2.5)
activesupport (= 4.2.5)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.4.rc1)
railties (= 4.2.5)
sprockets-rails
railties (4.2.4.rc1)
actionpack (= 4.2.4.rc1)
activesupport (= 4.2.4.rc1)
railties (4.2.5)
actionpack (= 4.2.5)
activesupport (= 4.2.5)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
......@@ -71,78 +71,89 @@ GEM
specs:
amq-protocol (1.9.2)
arel (6.0.3)
backburner (0.4.6)
beaneater (~> 0.3.1)
dante (~> 0.1.5)
backburner (1.1.0)
beaneater (~> 1.0)
dante (> 0.1.5)
bcrypt (3.1.10)
bcrypt (3.1.10-x64-mingw32)
bcrypt (3.1.10-x86-mingw32)
beaneater (0.3.3)
benchmark-ips (2.1.1)
beaneater (1.0.0)
benchmark-ips (2.3.0)
builder (3.2.2)
bunny (1.1.9)
amq-protocol (>= 1.9.2)
celluloid (0.16.0)
timers (~> 4.0.0)
celluloid (0.17.2)
celluloid-essentials
celluloid-extras
celluloid-fsm
celluloid-pool
celluloid-supervision
timers (>= 4.1.1)
celluloid-essentials (0.20.5)
timers (>= 4.1.1)
celluloid-extras (0.20.5)
timers (>= 4.1.1)
celluloid-fsm (0.20.5)
timers (>= 4.1.1)
celluloid-pool (0.20.5)
timers (>= 4.1.1)
celluloid-supervision (0.20.5)
timers (>= 4.1.1)
coffee-rails (4.1.0)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.3.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.9.0)
connection_pool (2.1.1)
dalli (2.7.2)
dante (0.1.5)
delayed_job (4.0.6)
coffee-script-source (1.9.1.1)
connection_pool (2.2.0)
dalli (2.7.4)
dante (0.2.0)
delayed_job (4.1.1)
activesupport (>= 3.0, < 5.0)
delayed_job_active_record (4.0.3)
activerecord (>= 3.0, < 5.0)
delayed_job (>= 3.0, < 4.1)
delayed_job_active_record (4.1.0)
activerecord (>= 3.0, < 5)
delayed_job (>= 3.0, < 5)
erubis (2.7.0)
execjs (2.4.0)
globalid (0.3.6)
activesupport (>= 4.1.0)
hitimes (1.2.2)
hitimes (1.2.2-x86-mingw32)
hitimes (1.2.3)
hitimes (1.2.3-x86-mingw32)
i18n (0.7.0)
jquery-rails (4.0.3)
jquery-rails (4.0.5)
rails-dom-testing (~> 1.0)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.2)
json (1.8.3)
kindlerb (0.1.1)
mustache
nokogiri
loofah (2.0.2)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
metaclass (0.0.4)
mime-types (2.6.1)
mime-types (2.6.2)
mini_portile (0.6.2)
minitest (5.3.3)
mocha (0.14.0)
metaclass (~> 0.0.1)
mono_logger (1.1.0)
multi_json (1.11.0)
multi_json (1.11.2)
mustache (0.99.8)
mysql (2.9.1)
mysql2 (0.3.18)
mysql2 (0.4.1)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
nokogiri (1.6.6.2-x64-mingw32)
mini_portile (~> 0.6.0)
nokogiri (1.6.6.2-x86-mingw32)
mini_portile (~> 0.6.0)
pg (0.18.1)
psych (2.0.13)
que (0.9.2)
pg (0.18.3)
psych (2.0.15)
que (0.11.2)
queue_classic (3.1.0)
pg (>= 0.17, < 0.19)
racc (1.4.12)
rack (1.6.0)
rack-cache (1.2)
racc (1.4.13)
rack (1.6.4)
rack-cache (1.5.0)
rack (>= 0.4)
rack-protection (1.5.3)
rack
......@@ -150,7 +161,7 @@ GEM
rack (>= 1.0)
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.5)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
......@@ -160,7 +171,7 @@ GEM
rdoc (4.2.0)
redcarpet (3.1.2)
redis (3.2.1)
redis-namespace (1.5.1)
redis-namespace (1.5.2)
redis (~> 3.0, >= 3.0.4)
resque (1.25.2)
mono_logger (~> 1.0)
......@@ -174,25 +185,24 @@ GEM
resque (~> 1.25)
rufus-scheduler (~> 3.0)
ruby-prof (0.11.3)
rufus-scheduler (3.0.9)
tzinfo
rufus-scheduler (3.1.7)
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
sequel (4.19.0)
serverengine (1.5.10)
sequel (4.27.0)
serverengine (1.5.11)
sigdump (~> 0.2.2)
sidekiq (3.3.2)
celluloid (>= 0.16.0)
connection_pool (>= 2.1.1)
json
redis (>= 3.0.6)
redis-namespace (>= 1.3.1)
sigdump (0.2.2)
sinatra (1.4.5)
sidekiq (3.5.1)
celluloid (~> 0.17.2)
connection_pool (~> 2.2, >= 2.2.0)
json (~> 1.0)
redis (~> 3.2, >= 3.2.1)
redis-namespace (~> 1.5, >= 1.5.2)
sigdump (0.2.3)
sinatra (1.4.6)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
tilt (>= 1.3, < 3)
sneakers (0.1.1.pre)
bunny (~> 1.1.3)
serverengine
......@@ -200,25 +210,25 @@ GEM
thread
sprockets (3.0.3)
rack (~> 1.0)
sprockets-rails (2.3.2)
sprockets-rails (2.3.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sqlite3 (1.3.10)
sqlite3 (1.3.11)
stackprof (0.2.7)
sucker_punch (1.3.2)
celluloid (~> 0.16.0)
sucker_punch (1.6.0)
celluloid (~> 0.17.2)
thor (0.19.1)
thread (0.1.5)
thread_safe (0.3.4)
tilt (1.4.1)
timers (4.0.1)
thread (0.2.2)
thread_safe (0.3.5)
tilt (2.0.1)
timers (4.1.1)
hitimes
turbolinks (2.5.3)
coffee-rails
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (2.7.0)
uglifier (2.7.2)
execjs (>= 0.3.0)
json (>= 1.8.0)
vegas (0.1.11)
......@@ -236,6 +246,7 @@ DEPENDENCIES
activerecord-jdbcmysql-adapter (>= 1.3.0)
activerecord-jdbcpostgresql-adapter (>= 1.3.0)
activerecord-jdbcsqlite3-adapter (>= 1.3.0)
amq-protocol (< 2.0.0)
backburner
bcrypt (~> 3.1.10)
benchmark-ips
......@@ -251,7 +262,7 @@ DEPENDENCIES
mocha (~> 0.14)
mustache (~> 0.99.8)
mysql (>= 2.9.0)
mysql2 (>= 0.3.13)
mysql2 (>= 0.4.0)
nokogiri (>= 1.4.5)
pg (>= 0.15.0)
psych (~> 2.0)
......@@ -280,4 +291,4 @@ DEPENDENCIES
w3c_validators
BUNDLED WITH
1.10.5
1.10.6
## Rails 4.2.5 (November 12, 2015) ##
* No changes.
## Rails 4.2.4 (August 24, 2015) ##
* No Changes *
......
......@@ -49,3 +49,10 @@ module ActionMailer
autoload :MessageDelivery
autoload :DeliveryJob
end
autoload :Mime, 'action_dispatch/http/mime_type'
ActiveSupport.on_load(:action_view) do
ActionView::Base.default_formats ||= Mime::SET.symbols
ActionView::Template::Types.delegate_to Mime
end
......@@ -7,7 +7,7 @@ def self.gem_version
module VERSION
MAJOR = 4
MINOR = 2
TINY = 4
TINY = 5
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
......
## Rails 4.2.5 (November 12, 2015) ##
* `ActionController::TestCase` can teardown gracefully if an error is raised
early in the `setup` chain.
*Yves Senn*
* Parse RSS/ATOM responses as XML, not HTML.
*Alexander Kaupanin*
* Fix regression in mounted engine named routes generation for app deployed to
a subdirectory. `relative_url_root` was prepended to the path twice (e.g.
"/subdir/subdir/engine_path" instead of "/subdir/engine_path")
Fixes #20920. Fixes #21459.
*Matthew Erhard*
* `url_for` does not modify its arguments when generating polymorphic URLs.
*Bernerd Schaefer*
* Update `ActionController::TestSession#fetch` to behave more like
`ActionDispatch::Request::Session#fetch` when using non-string keys.
*Jeremy Friesen*
## Rails 4.2.4 (August 24, 2015) ##
* ActionController::TestSession now accepts a default value as well as
......
......@@ -55,6 +55,8 @@ def setup_subscriptions
end
def teardown_subscriptions
return unless defined?(@_subscribers)
@_subscribers.each do |subscriber|
ActiveSupport::Notifications.unsubscribe(subscriber)
end
......@@ -327,8 +329,8 @@ def destroy
clear
end
def fetch(*args, &block)
@data.fetch(*args, &block)
def fetch(key, *args, &block)
@data.fetch(key.to_s, *args, &block)
end
private
......
......@@ -5,7 +5,7 @@ module ActionDispatch
module Http
module URL
IP_HOST_REGEXP = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/
HOST_REGEXP = /(^[^:]+:\/\/)?([^:]+)(?::(\d+$))?/
HOST_REGEXP = /(^[^:]+:\/\/)?(\[[^\]]+\]|[^:]+)(?::(\d+$))?/
PROTOCOL_REGEXP = /^([^:]+)(:)?(\/\/)?$/
mattr_accessor :tld_length
......
......@@ -632,6 +632,7 @@ def optimize_routes_generation?; false; end
super(options)
else
prefix_options = options.slice(*_route.segment_keys)
prefix_options[:relative_url_root] = ''.freeze
# we must actually delete prefix segment keys to avoid passing them to next url_for
_route.segment_keys.each { |k| options.delete(k) }
_routes.url_helpers.send("#{name}_path", prefix_options)
......
......@@ -485,14 +485,6 @@ def #{name}
end
def url_helpers(supports_path = true)
if supports_path
@url_helpers_with_paths ||= generate_url_helpers(supports_path)
else
@url_helpers_without_paths ||= generate_url_helpers(supports_path)
end
end
def generate_url_helpers(supports_path)
routes = self
Module.new do
......@@ -763,14 +755,18 @@ def generate(route_key, options, recall = {})
RESERVED_OPTIONS = [:host, :protocol, :port, :subdomain, :domain, :tld_length,
:trailing_slash, :anchor, :params, :only_path, :script_name,
:original_script_name]
:original_script_name, :relative_url_root]
def optimize_routes_generation?
default_url_options.empty?
end
def find_script_name(options)
options.delete(:script_name) || relative_url_root || ''
options.delete(:script_name) || find_relative_url_root(options) || ''
end
def find_relative_url_root(options)
options.delete(:relative_url_root) || relative_url_root
end
def path_for(options, route_name = nil)
......
......@@ -160,7 +160,8 @@ def url_for(options = nil)
when Symbol
HelperMethodBuilder.url.handle_string_call self, options
when Array
polymorphic_url(options, options.extract_options!)
components = options.dup
polymorphic_url(components, components.extract_options!)
when Class
HelperMethodBuilder.url.handle_class_call self, options
else
......
......@@ -12,7 +12,7 @@ module Assertions
include Rails::Dom::Testing::Assertions
def html_document
@html_document ||= if @response.content_type === Mime::XML
@html_document ||= if @response.content_type.to_s =~ /xml$/
Nokogiri::XML::Document.parse(@response.body)
else
Nokogiri::HTML::Document.parse(@response.body)
......
......@@ -7,7 +7,7 @@ def self.gem_version
module VERSION
MAJOR = 4
MINOR = 2
TINY = 4
TINY = 5
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
......
......@@ -247,6 +247,8 @@ def get
format.html { render :text => "OK", :status => 200 }
format.js { render :text => "JS OK", :status => 200 }
format.xml { render :xml => "<root></root>", :status => 200 }
format.rss { render :xml => "<root></root>", :status => 200 }
format.atom { render :xml => "<root></root>", :status => 200 }
end
end
......@@ -303,19 +305,21 @@ def test_get
end
end
def test_get_xml
with_test_route_set do
get "/get", {}, {"HTTP_ACCEPT" => "application/xml"}
assert_equal 200, status
assert_equal "OK", status_message
assert_response 200
assert_response :success
assert_response :ok
assert_equal({}, cookies.to_hash)
assert_equal "<root></root>", body
assert_equal "<root></root>", response.body
assert_instance_of Nokogiri::XML::Document, html_document
assert_equal 1, request_count
def test_get_xml_rss_atom
%w[ application/xml application/rss+xml application/atom+xml ].each do |mime_string|
with_test_route_set do
get "/get", {}, {"HTTP_ACCEPT" => mime_string}
assert_equal 200, status
assert_equal "OK", status_message
assert_response 200
assert_response :success
assert_response :ok
assert_equal({}, cookies.to_hash)
assert_equal "<root></root>", body
assert_equal "<root></root>", response.body
assert_instance_of Nokogiri::XML::Document, html_document
assert_equal 1, request_count
end
end
end
......
......@@ -957,3 +957,22 @@ def test_route_default_is_not_required_for_building_request_uri
assert_equal '/projects/2', @response.body
end
end
class CleanTeardownTest < ActionController::TestCase
test "can teardown gracefully when setup errors early" do
test_case = Class.new(ActionController::TestCase) do
tests BarController
def before_setup
raise "zomg!"
end
def test_success
# noop
end
end
result = Minitest.run_one_method test_case, :test_success
assert_equal ["zomg!"], result.failures.map {|f| f.error.message }
end
end
......@@ -447,6 +447,26 @@ def test_url_generation_with_array_and_hash
end
end
def test_url_for_with_array_is_unmodified
with_routing do |set|
set.draw do
namespace :admin do
resources :posts
end
end
kls = Class.new { include set.url_helpers }
kls.default_url_options[:host] = 'www.basecamphq.com'
original_components = [:new, :admin, :post, { param: 'value' }]
components = original_components.dup
kls.new.url_for(components)
assert_equal(original_components, components)
end
end
private
def extract_params(url)
url.split('?', 2).last.split('&').sort
......
require 'abstract_unit'
class IPv6IntegrationTest < ActionDispatch::IntegrationTest
Routes = ActionDispatch::Routing::RouteSet.new
include Routes.url_helpers
class ::BadRouteRequestController < ActionController::Base
include Routes.url_helpers
def index
render :text => foo_path
end
def foo
redirect_to :action => :index
end
end
Routes.draw do
get "/", :to => 'bad_route_request#index', :as => :index
get "/foo", :to => "bad_route_request#foo", :as => :foo
end
def _routes
Routes
end
APP = build_app Routes
def app
APP
end
test "bad IPv6 redirection" do
# def test_simple_redirect
request_env = {
'REMOTE_ADDR' => 'fd07:2fa:6cff:2112:225:90ff:fec7:22aa',
'HTTP_HOST' => '[fd07:2fa:6cff:2112:225:90ff:fec7:22aa]:3000',
'SERVER_NAME' => '[fd07:2fa:6cff:2112:225:90ff:fec7:22aa]',
'SERVER_PORT' => 3000 }
get '/foo', {}, request_env
assert_response :redirect
assert_equal 'http://[fd07:2fa:6cff:2112:225:90ff:fec7:22aa]:3000/', redirect_to_url
end
end
......@@ -46,6 +46,16 @@ def test_fetch_returns_default
assert_equal('2', session.fetch(:two, '2'))
end
def test_fetch_on_symbol_returns_value
session = ActionController::TestSession.new(one: '1')
assert_equal('1', session.fetch(:one))
end
def test_fetch_on_string_returns_value
session = ActionController::TestSession.new(one: '1')
assert_equal('1', session.fetch('one'))
end
def test_fetch_returns_block_value
session = ActionController::TestSession.new(one: '1')
assert_equal(2, session.fetch('2') { |key| key.to_i })
......
......@@ -30,7 +30,7 @@ def test_path_requirements_override_defaults
path = Path::Pattern.new strexp
defaults = { name: 'tender' }
route = Route.new('name', nil, path, nil, defaults)
assert_equal /love/, route.requirements[:name]
assert_equal(/love/, route.requirements[:name])
end
def test_ip_address
......
## Rails 4.2.5 (November 12, 2015) ##
* Fix `mail_to` when called with `nil` as argument.
*Rafael Mendonça França*
* `url_for` does not modify its arguments when generating polymorphic URLs.
*Bernerd Schaefer*
## Rails 4.2.4 (August 24, 2015) ##
* No Changes *
......
......@@ -7,7 +7,7 @@ def self.gem_version
module VERSION
MAJOR = 4
MINOR = 2
TINY = 4
TINY = 5
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
......
......@@ -463,7 +463,7 @@ def mail_to(email_address, name = nil, html_options = {}, &block)
}.compact
extras = extras.empty? ? '' : '?' + extras.join('&')