Commit Graph

1554 Commits

Author SHA1 Message Date
John Barnette
7a559d389c Force a period when local times are ambiguous
This commit includes the essence of
https://github.com/rails/rails/pull/17409.
2014-11-10 12:56:35 +11:00
Dirkjan Bussink
c831f67d8b Remove Proc#bind from Rails 3.2 2014-10-08 14:08:40 +02:00
Charlie Somerville
24bdb8141e fix tests 2014-09-19 17:51:27 +10:00
Charlie Somerville
c9acba55f1 define info_signal for new minitests 2014-04-10 19:47:39 +10:00
Rafael Mendonça França
50a96446bc Use Ruby 1.8 hash syntax 2013-09-28 20:56:15 -03:00
Rafael Mendonça França
c539c684aa Merge pull request #12196 from h-lame/fix-activesupport-cache-filestore-cleanup
Fix FileStore#cleanup to no longer rely on missing each_key method
Conflicts:
	activesupport/CHANGELOG.md
	activesupport/test/caching_test.rb
2013-09-12 16:04:10 -03:00
Wolfram Arnold
803008eb97 Add respond_to_missing? for TaggedLogging which is needed if another log abstracter wraps a TaggedLogging instance.
It's also best practice when overriding method_missing.
2013-07-17 18:26:55 -07:00
Andrew White
b775987e72 Return local time for backwards compatibility 2013-07-09 15:40:59 +01:00
Andrew White
ccad803bf4 Retain offset and fraction when using Time.at_with_coercion
The standard Ruby behavior for Time.at is to return the same type of
time when passing an instance of Time as a single argument. Since the
an ActiveSupport::TimeWithZone instance may be a different timezone than
the system timezone and DateTime just understands offsets the best we
can do is to return an instance of Time with the correct offset.

It also maintains the correct fractional second value as well.

Fixes #11350.

Backports:
484253515c0e05760541dc48946361185c9e6904
1b3873730b96035a238dbff7627bd5942e6dc4e7
2013-07-09 14:04:49 +01:00
Carson Reinke
4265f1bccb Incorrectly providing program name the same as log message even when block is not provided. 2013-07-01 10:11:43 -04:00
Andrew White
f42e0fd3f4 Override Time.at to work with Time-like values
Time.at allows passing a single Time argument which is then converted
to an integer. The conversion code since 1.9.3r429 explicitly checks
for an instance of Time so we need to override it to allow DateTime
and ActiveSupport::TimeWithZone values.
2013-06-08 09:45:45 +01:00
Rafael Mendonça França
a59d661a82 Fix test to ruby 2.0
The default enconding changed on Ruby 2.0
2013-05-10 13:36:42 -03:00
Rafael Mendonça França
c910388587 Revert "Remove unicode character encoding from ActiveSupport::JSON.encode"
This reverts commit 815a9431ab.

Conflicts:
	activesupport/test/json/encoding_test.rb

Reason: This was causing a regression where the resulting string is always
returning UTF-8. Also it changes the behavior of this method on a stable release.

Fixes #9498.
2013-05-08 21:03:37 -03:00
Carlos Antonio da Silva
9194221921 Fix method name indent [ci skip] 2013-03-18 18:28:07 -03:00
Aaron Patterson
afcd01bf25 Merge branch '3-2-13' into 3-2-stable
* 3-2-13:
  bumping to 3.2.13
  fix protocol checking in sanitization [CVE-2013-1857]
  JDOM XXE Protection [CVE-2013-1856]
  fix incorrect ^$ usage leading to XSS in sanitize_css [CVE-2013-1855]
  stop calling to_sym when building arel nodes [CVE-2013-1854]
  Merge pull request #9616 from exviva/multiple_select_name_double_square_brackets
  bumping to rc2
  Revert "Merge pull request #8209 from senny/backport_8176"
  Freeze columns only once per Result
  Preparing for 3.2.13.rc1 release
  Update CHANGELOGs for 3.2.13 release.

Conflicts:
	actionmailer/CHANGELOG.md
	actionpack/CHANGELOG.md
	activemodel/CHANGELOG.md
	activeresource/CHANGELOG.md
	activesupport/CHANGELOG.md
	railties/CHANGELOG.md
2013-03-18 10:17:04 -07:00
Ben Murphy
c0d06633f0 JDOM XXE Protection [CVE-2013-1856]
Conflicts:
	activesupport/test/xml_mini/jdom_engine_test.rb
2013-03-15 17:48:27 -07:00
Andrew White
ba910d7650 Fix ActiveSupport::TimeZone.parse when time is a local DST jump
The previous implementation `ActiveSupport::TimeZone.parse` used `Time.parse`
which applies the system time DST rules to the parsed time. Instead we now
use `Time.utc` and manually apply the offset.

Backport tests from:
005d910624bbfa724b638426a000c8074d4201a2
c89b6c4cdce7ee55ed3665c099d914222fe0344a
03becb13099c439f6aea5058546bc8b0b19b8db8

Fixes #9678.
2013-03-13 05:40:25 +00:00
Prem Sichanugrist
8598633cc1 Do not redirect cache logger to /dev/null in test
For some reason, redirecting cache's logger to '/dev/null' resulting in
a test failures and LoadError. I think it's because of Thread issue.
Instead of trying to make every logger threadsafe for Rails 3.2, I think
it's better to just don't set the logger for now.

(Note: resetting the logger back to original value in the teardown block
didn't fix the problem.)
2013-02-24 16:32:25 -05:00
Jeremy Kemper
5693d44468 Ruby 2 compat. Hash[] now raises on bad elements rather than ignoring them. No sense over-testing this MRI-specific behavior. See ruby/ruby@8d6add973e 2013-02-24 16:32:25 -05:00
Rafael Mendonça França
0190dcae3c Make the tests pass with minitest 4.2 2013-02-24 16:32:25 -05:00
gsphanikumar
b1a501e6fb Test to allow Range including DateTime and DateTime::Infinity
Closes #8587
2013-01-13 20:27:42 -08:00
Aaron Patterson
48810a52df Merge branch '3-2-sec' into 3-2-secmerge
* 3-2-sec:
  bumping version
  CVE-2013-0156: Safe XML params parsing. Doesn't allow symbols or yaml.
  * Strip nils from collections on JSON and XML posts. [CVE-2013-0155] * dealing with empty hashes. Thanks Damien Mathieu
  Avoid Rack security warning no secret provided

Conflicts:
	actionpack/CHANGELOG.md
	activerecord/CHANGELOG.md
	activesupport/CHANGELOG.md
2013-01-08 11:37:48 -08:00
Jeremy Kemper
43109ecb98 CVE-2013-0156: Safe XML params parsing. Doesn't allow symbols or yaml. 2013-01-08 11:09:50 -08:00
Vasiliy Ermolovich
d39d878d2b Wrap time ranges with timezones, closes #8807
(cherry picked from commit e2e513621d732abb8efff9120bd9a444836720d6)
(cherry picked from commit dcdde7da481e11660634278a8004175a1ce20f39)

Backport of #6183, original issue was #6179

Conflicts:
	activesupport/lib/active_support/core_ext/time/calculations.rb
	activesupport/test/core_ext/time_ext_test

Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
2013-01-08 10:33:45 +00:00
Carlos Antonio da Silva
df048b574b Use 1.8 style hash in json encoding test 2012-12-14 23:33:53 -02:00
Brett Carter
815a9431ab Remove unicode character encoding from ActiveSupport::JSON.encode
The encoding scheme (e.g. ☠ -> "\u2620") was broken for characters
not in the Basic Multilingual Plane.  It is possible to escape them
for json using the weird encoding scheme of a twelve-character
sequence representing the UTF-16 surrogate pair (e.g. '𠜎' ->
"\u270e\u263a") but this wasn't properly handled in the escaping code.
Since raw UTF-8 is allowed in json, it was decided to simply pass
through the raw bytes rather than attempt to escape them.

Backport of 9ace3a8820

Conflicts:

	activesupport/CHANGELOG.md
	activesupport/lib/active_support/json/encoding.rb
	activesupport/test/json/encoding_test.rb
2012-12-14 20:09:56 -05:00
Carlos Antonio da Silva
64281fb6e7 Add :nsec format only for Ruby 1.9
Ruby 1.8 does not support this format in Time, so the format will only
be added to the available date formats on Ruby 1.9. Changelog entry was
changed to explain that as well.
2012-12-11 21:38:49 -02:00
Jeremy Kemper
09a8b146ef Merge pull request #6376 from jgaskins/timestamp-microseconds
Increase numeric-timestamp precision to nanoseconds
Conflicts:
	activesupport/lib/active_support/core_ext/time/conversions.rb
2012-12-10 15:33:01 -03:00
Carlos Antonio da Silva
17ccefc436 Update mocha version to 0.13.0 and change requires 2012-11-13 09:24:43 -02:00
Carlos Antonio da Silva
25b23d7ecc Fix json encoding test with ruby 1.8.7 and random hash order
Introduced in 3e53fe6.
2012-11-13 09:17:48 -02:00
Yves Senn
be79632b96 backport #8185, #as_json isolates options when encoding a hash.
Setting options in a custom `#as_json` method had side effects.
Modifications of the `options` hash leaked outside and influenced
the conversion of other objects contained in the hash.

Conflicts:

	activesupport/CHANGELOG.md
2012-11-13 08:44:47 +01:00
Jeremy Kemper
20f5f08d3b Add logger.push_tags and .pop_tags to complement logger.tagged
Avoid memory leak from unflushed logs on other threads leaving tags behind.

Conflicts:
	activesupport/CHANGELOG.md
	activesupport/lib/active_support/tagged_logging.rb
	activesupport/test/tagged_logging_test.rb
2012-09-27 10:46:50 -07:00
kennyj
4e715e33af Fix #6962. AS::TimeWithZone#strftime responds incorrectly to %:z and %::z format strings. 2012-09-20 22:04:52 +09:00
Carlos Antonio da Silva
146eaf3818 Fix AS tests due to builder change with nil values / empty strings
Check 0180e090ab6cbe66f7b521a0c03e278a0463accd for more reasoning about
that.
2012-09-07 13:43:57 -03:00
Santiago Pastorino
2bdb4ec6ad html_escape should escape single quotes
https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet#RULE_.231_-_HTML_Escape_Before_Inserting_Untrusted_Data_into_HTML_Element_Content
Closes #7215

Conflicts:
	actionpack/test/template/erb_util_test.rb
	actionpack/test/template/form_tag_helper_test.rb
	actionpack/test/template/text_helper_test.rb
	actionpack/test/template/url_helper_test.rb
	activesupport/lib/active_support/core_ext/string/output_safety.rb
2012-08-02 17:09:37 -03:00
Rafael Mendonça França
af65b8c9e7 Revert "Deprecate ActiveSupport::JSON::Variable"
This reverts commit bcfa013399.
2012-08-01 15:56:38 -03:00
Niranjan Paranjape
01f8f29dc9 buffered logger is initialized with the log level passed trough the initializer 2012-06-09 12:23:18 +05:30
Erich Menge
bcfa013399 Deprecate ActiveSupport::JSON::Variable 2012-05-30 14:32:24 -05:00
Erich Menge
624f801d27 True, False, and Nil should be represented in as_json as themselves.
Conflicts:

	activesupport/lib/active_support/json/encoding.rb
	activesupport/test/json/encoding_test.rb
2012-05-30 10:24:23 -05:00
James Mead
0813b45127 Exceptions like Interrupt should not be rescued in tests.
This is a back-port of rails/rails#6525. See the commit notes there for
details.
2012-05-29 11:14:50 +01:00
Mark J. Titorenko
145cc69524 added beginning_of_hour support to core_ext calculations for Time and DateTime 2012-05-04 20:27:32 +01:00
Aaron Patterson
2991370a40 bigdecimal can be duped on Ruby 2.0
Conflicts:

	activesupport/test/core_ext/duplicable_test.rb
2012-04-10 21:06:17 +05:30
Aaron Patterson
ca0c0a20ac add the class name to the assertion message 2012-04-10 21:05:47 +05:30
José Valim
c0a5b8505d Ensure load hooks can be called more than once with different contexts. 2012-03-17 17:21:02 -03:00
Aaron Patterson
c60c1c0812 Merge branch '3-2-stable-security' into 3-2-2
* 3-2-stable-security:
  Ensure [] respects the status of the buffer.
  delete vulnerable AS::SafeBuffer#[]
  use AS::SafeBuffer#clone_empty for flushing the output_buffer
  add AS::SafeBuffer#clone_empty
  fix output safety issue with select options
2012-03-01 09:05:34 -08:00
José Valim
55ac1b9d88 Ensure [] respects the status of the buffer. 2012-02-29 16:13:29 -08:00
kennyj
39d4617033 Fix some warnings on 3-2-stable 2012-02-21 12:43:41 +09:00
Akira Matsuda
dfa33fa3da delete vulnerable AS::SafeBuffer#[] 2012-02-20 16:14:56 -08:00
Akira Matsuda
621d219959 add AS::SafeBuffer#clone_empty 2012-02-20 16:14:47 -08:00
Arun Agrawal
c17608fe8f Fixes failing test with ruby 1.8.7-p358
Same as 91a9b24417
2012-02-17 14:43:34 +05:30