Commit 6c318ccb authored by Antonio Terceiro's avatar Antonio Terceiro

Imported Upstream version 4.2.6

parent c3b0a454
......@@ -23,7 +23,8 @@ rvm:
- 1.9.3
- 2.0.0
- 2.1
- 2.2
- 2.2.4
- 2.3.0
- ruby-head
matrix:
allow_failures:
......
......@@ -43,7 +43,7 @@ group :job do
gem 'resque', require: false
gem 'resque-scheduler', require: false
gem 'sidekiq', require: false
gem 'sucker_punch', require: false
gem 'sucker_punch', '< 2.0', require: false
gem 'delayed_job', require: false
gem 'queue_classic', require: false, platforms: :ruby
gem 'sneakers', '0.1.1.pre', require: false
......
......@@ -14,55 +14,55 @@ GIT
PATH
remote: .
specs:
actionmailer (4.2.5.2)
actionpack (= 4.2.5.2)
actionview (= 4.2.5.2)
activejob (= 4.2.5.2)
actionmailer (4.2.6)
actionpack (= 4.2.6)
actionview (= 4.2.6)
activejob (= 4.2.6)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.5.2)
actionview (= 4.2.5.2)
activesupport (= 4.2.5.2)
actionpack (4.2.6)
actionview (= 4.2.6)
activesupport (= 4.2.6)
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.5.2)
activesupport (= 4.2.5.2)
actionview (4.2.6)
activesupport (= 4.2.6)
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.5.2)
activesupport (= 4.2.5.2)
activejob (4.2.6)
activesupport (= 4.2.6)
globalid (>= 0.3.0)
activemodel (4.2.5.2)
activesupport (= 4.2.5.2)
activemodel (4.2.6)
activesupport (= 4.2.6)
builder (~> 3.1)
activerecord (4.2.5.2)
activemodel (= 4.2.5.2)
activesupport (= 4.2.5.2)
activerecord (4.2.6)
activemodel (= 4.2.6)
activesupport (= 4.2.6)
arel (~> 6.0)
activesupport (4.2.5.2)
activesupport (4.2.6)
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.5.2)
actionmailer (= 4.2.5.2)
actionpack (= 4.2.5.2)
actionview (= 4.2.5.2)
activejob (= 4.2.5.2)
activemodel (= 4.2.5.2)
activerecord (= 4.2.5.2)
activesupport (= 4.2.5.2)
rails (4.2.6)
actionmailer (= 4.2.6)
actionpack (= 4.2.6)
actionview (= 4.2.6)
activejob (= 4.2.6)
activemodel (= 4.2.6)
activerecord (= 4.2.6)
activesupport (= 4.2.6)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.5.2)
railties (= 4.2.6)
sprockets-rails
railties (4.2.5.2)
actionpack (= 4.2.5.2)
activesupport (= 4.2.5.2)
railties (4.2.6)
actionpack (= 4.2.6)
activesupport (= 4.2.6)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
......@@ -71,7 +71,7 @@ GEM
specs:
amq-protocol (1.9.2)
arel (6.0.3)
backburner (1.1.0)
backburner (1.2.0)
beaneater (~> 1.0)
dante (> 0.1.5)
bcrypt (3.1.10)
......@@ -82,32 +82,18 @@ GEM
builder (3.2.2)
bunny (1.1.9)
amq-protocol (>= 1.9.2)
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)
celluloid (0.15.2)
timers (~> 1.1.0)
coffee-rails (4.1.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
railties (>= 4.0.0, < 5.1.x)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.9.1.1)
coffee-script-source (1.10.0)
concurrent-ruby (1.0.0)
connection_pool (2.2.0)
dalli (2.7.4)
dalli (2.7.5)
dante (0.2.0)
delayed_job (4.1.1)
activesupport (>= 3.0, < 5.0)
......@@ -118,8 +104,6 @@ GEM
execjs (2.4.0)
globalid (0.3.6)
activesupport (>= 4.1.0)
hitimes (1.2.3)
hitimes (1.2.3-x86-mingw32)
i18n (0.7.0)
jquery-rails (4.0.5)
rails-dom-testing (~> 1.0)
......@@ -134,8 +118,8 @@ GEM
mail (2.6.3)
mime-types (>= 1.16, < 3)
metaclass (0.0.4)
mime-types (2.6.2)
mini_portile (0.6.2)
mime-types (2.99.1)
mini_portile2 (2.0.0)
minitest (5.3.3)
mocha (0.14.0)
metaclass (~> 0.0.1)
......@@ -143,17 +127,21 @@ GEM
multi_json (1.11.2)
mustache (0.99.8)
mysql (2.9.1)
mysql2 (0.4.1)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
pg (0.18.3)
psych (2.0.15)
mysql2 (0.4.2)
nokogiri (1.6.7.1)
mini_portile2 (~> 2.0.0.rc2)
nokogiri (1.6.7.1-x64-mingw32)
mini_portile2 (~> 2.0.0.rc2)
nokogiri (1.6.7.1-x86-mingw32)
mini_portile2 (~> 2.0.0.rc2)
pg (0.18.4)
psych (2.0.17)
que (0.11.2)
queue_classic (3.1.0)
pg (>= 0.17, < 0.19)
racc (1.4.13)
racc (1.4.14)
rack (1.6.4)
rack-cache (1.5.0)
rack-cache (1.5.1)
rack (>= 0.4)
rack-protection (1.5.3)
rack
......@@ -165,12 +153,13 @@ GEM
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.2)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rake (10.4.2)
rdoc (4.2.0)
rdoc (4.2.1)
json (~> 1.4)
redcarpet (3.1.2)
redis (3.2.1)
redis (3.2.2)
redis-namespace (1.5.2)
redis (~> 3.0, >= 3.0.4)
resque (1.25.2)
......@@ -185,19 +174,18 @@ GEM
resque (~> 1.25)
rufus-scheduler (~> 3.0)
ruby-prof (0.11.3)
rufus-scheduler (3.1.7)
rufus-scheduler (3.1.10)
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
sequel (4.27.0)
sequel (4.29.0)
serverengine (1.5.11)
sigdump (~> 0.2.2)
sidekiq (3.5.1)
celluloid (~> 0.17.2)
sidekiq (4.0.1)
concurrent-ruby (~> 1.0)
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)
......@@ -210,20 +198,19 @@ GEM
thread
sprockets (3.0.3)
rack (~> 1.0)
sprockets-rails (2.3.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sprockets-rails (3.0.4)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.11)
stackprof (0.2.7)
sucker_punch (1.6.0)
celluloid (~> 0.17.2)
sucker_punch (1.0.5)
celluloid (~> 0.15.2)
thor (0.19.1)
thread (0.2.2)
thread_safe (0.3.5)
tilt (2.0.1)
timers (4.1.1)
hitimes
timers (1.1.0)
turbolinks (2.5.3)
coffee-rails
tzinfo (1.2.2)
......@@ -285,10 +272,10 @@ DEPENDENCIES
sprockets (~> 3.0.0.rc.1)
sqlite3 (~> 1.3.6)
stackprof
sucker_punch
sucker_punch (< 2.0)
turbolinks
uglifier (>= 1.3.0)
w3c_validators
BUNDLED WITH
1.10.6
1.11.2
## Rails 4.2.6 (March 07, 2016) ##
* No changes.
## Rails 4.2.5.2 (February 26, 2016) ##
* No changes.
......
......@@ -7,8 +7,8 @@ def self.gem_version
module VERSION
MAJOR = 4
MINOR = 2
TINY = 5
PRE = "2"
TINY = 6
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end
......
## Rails 4.2.6 (March 07, 2016) ##
* No changes.
## Rails 4.2.5.2 (February 26, 2016) ##
* Do not allow render with unpermitted parameter.
......
......@@ -22,7 +22,7 @@ def initialize(root, cache_control)
def match?(path)
path = URI.parser.unescape(path)
return false unless path.valid_encoding?
return false unless valid_path?(path)
paths = [path, "#{path}#{ext}", "#{path}/index#{ext}"].map { |v|
Rack::Utils.clean_path_info v
......@@ -86,6 +86,10 @@ def gzip_file_path(path)
false
end
end
def valid_path?(path)
path.valid_encoding? && !path.include?("\0")
end
end
# This middleware will attempt to return the contents of a file's body from
......
......@@ -469,9 +469,11 @@ def define_mounted_helper(name)
return if MountedHelpers.method_defined?(name)
routes = self
helpers = routes.url_helpers
MountedHelpers.class_eval do
define_method "_#{name}" do
RoutesProxy.new(routes, _routes_context)
RoutesProxy.new(routes, _routes_context, helpers)
end
end
......
......@@ -8,8 +8,9 @@ class RoutesProxy #:nodoc:
attr_accessor :scope, :routes
alias :_routes :routes
def initialize(routes, scope)
def initialize(routes, scope, helpers)
@routes, @scope = routes, scope
@helpers = helpers
end
def url_options
......@@ -19,16 +20,16 @@ def url_options
end
def respond_to?(method, include_private = false)
super || routes.url_helpers.respond_to?(method)
super || @helpers.respond_to?(method)
end
def method_missing(method, *args)
if routes.url_helpers.respond_to?(method)
if @helpers.respond_to?(method)
self.class.class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{method}(*args)
options = args.extract_options!
args << url_options.merge((options || {}).symbolize_keys)
routes.url_helpers.#{method}(*args)
@helpers.#{method}(*args)
end
RUBY
send(method, *args)
......
......@@ -7,8 +7,8 @@ def self.gem_version
module VERSION
MAJOR = 4
MINOR = 2
TINY = 5
PRE = "2"
TINY = 6
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end
......
......@@ -27,6 +27,27 @@ def assert_filtered_out(params, key)
end
end
def walk_permitted params
params.each do |k,v|
case v
when ActionController::Parameters
walk_permitted v
when Array
v.each { |x| walk_permitted v }
end
end
end
test 'iteration should not impact permit' do
hash = {"foo"=>{"bar"=>{"0"=>{"baz"=>"hello", "zot"=>"1"}}}}
params = ActionController::Parameters.new(hash)
walk_permitted params
sanitized = params[:foo].permit(bar: [:baz])
assert_equal({"0"=>{"baz"=>"hello"}}, sanitized[:bar].to_unsafe_h)
end
test 'if nothing is permitted, the hash becomes empty' do
params = ActionController::Parameters.new(id: '1234')
permitted = params.permit
......
......@@ -32,6 +32,10 @@ def test_handles_urls_with_ascii_8bit_on_win_31j
assert_equal "Hello, World!", get("/doorkeeper%E3E4".force_encoding('ASCII-8BIT')).body
end
def test_handles_urls_with_null_byte
assert_equal "Hello, World!", get("/doorkeeper%00").body
end
def test_sets_cache_control
response = get("/index.html")
assert_html "/index.html", response
......
## Rails 4.2.6 (March 07, 2016) ##
* Fix stripping the digest from the automatically generated img tag alt
attribute when assets are handled by Sprockets >=3.0.
*Bart de Water*
* Create a new `ActiveSupport::SafeBuffer` instance when `content_for` is flushed.
Fixes #19890
*Yoong Kang Lim*
* Respect value of `:object` if `:object` is false when rendering.
Fixes #22260.
*Yuichiro Kaneko*
* Generate `week_field` input values using a 1-based index and not a 0-based index
as per the W3 spec: http://www.w3.org/TR/html-markup/datatypes.html#form.data.week
*Christoph Geschwind*
## Rails 4.2.5.2 (February 26, 2016) ##
* Do not allow render with unpermitted parameter.
......
......@@ -15,7 +15,7 @@ def get(key)
# Called by each renderer object to set the layout contents.
def set(key, value)
@content[key] = value
@content[key] = ActiveSupport::SafeBuffer.new(value)
end
# Called by content_for
......
......@@ -7,8 +7,8 @@ def self.gem_version
module VERSION
MAJOR = 4
MINOR = 2
TINY = 5
PRE = "2"
TINY = 6
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end
......
......@@ -236,7 +236,7 @@ def image_tag(source, options={})
# image_alt('underscored_file_name.png')
# # => Underscored file name
def image_alt(src)
File.basename(src, '.*').sub(/-[[:xdigit:]]{32}\z/, '').tr('-_', ' ').capitalize
File.basename(src, '.*').sub(/-[[:xdigit:]]{32,64}\z/, '').tr('-_', ' ').capitalize
end
# Returns an HTML video tag for the +sources+. If +sources+ is a string,
......
......@@ -5,7 +5,7 @@ class WeekField < DatetimeField # :nodoc:
private
def format_date(value)
value.try(:strftime, "%Y-W%W")
value.try(:strftime, "%Y-W%V")
end
end
end
......
......@@ -333,7 +333,7 @@ def render_partial
layout = find_template(layout.to_s, @template_keys)
end
object ||= locals[as]
object = locals[as] if object.nil? # Respect object when object is false
locals[as] = object
content = @template.render(view, locals) do |*name|
......
......@@ -113,7 +113,7 @@ def test_symbol_with_options
def test_passing_routes_proxy
with_namespaced_routes(:blog) do
proxy = ActionDispatch::Routing::RoutesProxy.new(_routes, self)
proxy = ActionDispatch::Routing::RoutesProxy.new(_routes, self, _routes.url_helpers)
@blog_post.save
assert_url "http://example.com/posts/#{@blog_post.id}", [proxy, @blog_post]
end
......
<%= klass.class.name %>
\ No newline at end of file
......@@ -448,6 +448,7 @@ def test_image_alt
[nil, '/', '/foo/bar/', 'foo/bar/'].each do |prefix|
assert_equal 'Rails', image_alt("#{prefix}rails.png")
assert_equal 'Rails', image_alt("#{prefix}rails-9c0a079bdd7701d7e729bd956823d153.png")
assert_equal 'Rails', image_alt("#{prefix}rails-f56ef62bc41b040664e801a38f068082a75d506d9048307e8096737463503d0b.png")
assert_equal 'Long file name with hyphens', image_alt("#{prefix}long-file-name-with-hyphens.png")
assert_equal 'Long file name with underscores', image_alt("#{prefix}long_file_name_with_underscores.png")
end
......
......@@ -148,6 +148,19 @@ def test_content_for_question_mark
assert ! content_for?(:something_else)
end
def test_content_for_should_be_html_safe_after_flush_empty
assert ! content_for?(:title)
content_for :title do
content_tag(:p, 'title')
end
assert content_for(:title).html_safe?
content_for :title, "", flush: true
content_for(:title) do
content_tag(:p, 'title')
end
assert content_for(:title).html_safe?
end
def test_provide
assert !content_for?(:title)
provide :title, "hi"
......
......@@ -1262,7 +1262,7 @@ def test_month_field_with_timewithzone_value
end
def test_week_field
expected = %{<input id="post_written_on" name="post[written_on]" type="week" value="2004-W24" />}
expected = %{<input id="post_written_on" name="post[written_on]" type="week" value="2004-W25" />}
assert_dom_equal(expected, week_field("post", "written_on"))
end
......@@ -1273,13 +1273,13 @@ def test_week_field_with_nil_value
end
def test_week_field_with_datetime_value
expected = %{<input id="post_written_on" name="post[written_on]" type="week" value="2004-W24" />}
expected = %{<input id="post_written_on" name="post[written_on]" type="week" value="2004-W25" />}
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
assert_dom_equal(expected, week_field("post", "written_on"))
end
def test_week_field_with_extra_attrs
expected = %{<input id="post_written_on" step="2" max="2010-W51" min="2000-W06" name="post[written_on]" type="week" value="2004-W24" />}
expected = %{<input id="post_written_on" step="2" max="2010-W51" min="2000-W06" name="post[written_on]" type="week" value="2004-W25" />}
@post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3)
min_value = DateTime.new(2000, 2, 13)
max_value = DateTime.new(2010, 12, 23)
......@@ -1289,13 +1289,19 @@ def test_week_field_with_extra_attrs
def test_week_field_with_timewithzone_value
previous_time_zone, Time.zone = Time.zone, 'UTC'
expected = %{<input id="post_written_on" name="post[written_on]" type="week" value="2004-W24" />}
expected = %{<input id="post_written_on" name="post[written_on]" type="week" value="2004-W25" />}
@post.written_on = Time.zone.parse('2004-06-15 15:30:45')
assert_dom_equal(expected, week_field("post", "written_on"))
ensure
Time.zone = previous_time_zone
end
def test_week_field_week_number_base
expected = %{<input id="post_written_on" name="post[written_on]" type="week" value="2015-W01" />}
@post.written_on = DateTime.new(2015, 1, 1, 1, 2, 3)
assert_dom_equal(expected, week_field("post", "written_on"))
end
def test_url_field
expected = %{<input id="user_homepage" name="user[homepage]" type="url" />}
assert_dom_equal(expected, url_field("user", "homepage"))
......
......@@ -275,6 +275,8 @@ def test_render_file_with_errors
def test_render_object
assert_equal "Hello: david", @view.render(:partial => "test/customer", :object => Customer.new("david"))
assert_equal "FalseClass", @view.render(:partial => "test/klass", :object => false)
assert_equal "NilClass", @view.render(:partial => "test/klass", :object => nil)
end
def test_render_object_with_array
......
## Rails 4.2.6 (March 07, 2016) ##
* No changes.
## Rails 4.2.5.2 (February 26, 2016) ##
* No changes.
......
......@@ -7,8 +7,8 @@ def self.gem_version
module VERSION
MAJOR = 4
MINOR = 2
TINY = 5
PRE = "2"
TINY = 6
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end
......
## Rails 4.2.6 (March 07, 2016) ##
* No changes.
## Rails 4.2.5.2 (February 26, 2016) ##
* No changes.
......
......@@ -27,6 +27,10 @@ module ActiveModel
#
# define_attribute_methods :name
#
# def initialize(name)
# @name = name
# end
#
# def name
# @name
# end
......@@ -55,7 +59,7 @@ module ActiveModel
#
# A newly instantiated +Person+ object is unchanged:
#
# person = Person.new
# person = Person.new("Uncle Bob")
# person.changed? # => false
#
# Change the name:
......
......@@ -7,8 +7,8 @@ def self.gem_version
module VERSION
MAJOR = 4
MINOR = 2
TINY = 5
PRE = "2"
TINY = 6
PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end
......
## Rails 4.2.6 (March 07, 2016) ##
* Fix a bug where using `t.foreign_key` twice with the same `to_table` within
the same table definition would only create one foreign key.
*George Millo*
* Fix regression in dirty attribute tracking after #dup. Changes to the
clone no longer show as changed attributes in the original object.
*Dominic Cleal*
* Fix regression when loading fixture files with symbol keys.
Closes #22584.
*Yves Senn*
* Fix `rake db:structure:dump` on Postgres when multiple schemas are used.
Fixes #22346.
*Nick Muerdter*, *ckoenig*
* Introduce `connection.data_sources` and `connection.data_source_exists?`.
These methods determine what relations can be used to back Active Record
models (usually tables and views).
*Yves Senn*, *Matthew Draper*
## Rails 4.2.5.2 (February 26, 2016) ##
* No changes.
......
......@@ -94,6 +94,11 @@ def build_through_record(record)
through_record = through_association.build(*options_for_through_record)
through_record.send("#{source_reflection.name}=", record)
if options[:source_type]
through_record.send("#{source_reflection.foreign_type}=", options[:source_type])
end
through_record
end
end
......