Commit Graph

2027 Commits

Author SHA1 Message Date
Vipul A M
ec620e0984 $SAFE = 4; has been removed with Ruby 2.1
For background -
https://bugs.ruby-lang.org/issues/8468
Changset - https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/41259/diff/test/ruby/test_thread.rb
2013-10-14 21:52:25 +05:30
Jeremy Kemper
365110196a Revert "Merge pull request #12480 from iwiznia/master"
This reverts commit e5f5a838b96a362534d9bb60d02334439ed9784c, reversing
changes made to d7567f3290a50952494e9213556a1f283a6cf3a0.
2013-10-11 13:05:29 -07:00
Ionatan Wiznia
90871f7198 flatten and flatten! methods for ActiveSupport::Duration 2013-10-11 12:50:23 +02:00
Xavier Noria
2254615bff Merge pull request #12412 from bf4/allow_pathname_for_require_dependency
Allow Pathname for require dependency
2013-09-30 23:22:11 -07:00
Benjamin Fleischer
0b0beb71d6 require_dependency should allow Pathname-like objects, not just String 2013-09-30 19:57:03 -05:00
Andrew White
ffc8abd41b Merge pull request #11474 from bogdan/time-with-zone-succ
Prevent server blow up when iterating over TimeWithZone Range
2013-09-22 12:33:12 -07:00
Daniel Schierbeck
d2824a347f Allow attaching to AS::Notifications namespace up front
Before, you were required to attach *after* adding the methods to the
class, since the attachment process needed the methods to be present.

With this change, any new method will also be attached to the configured
namespace.
2013-09-20 10:14:28 +02:00
Rafael Mendonça França
cdc10c898d Merge pull request #12196 from h-lame/fix-activesupport-cache-filestore-cleanup
Fix FileStore#cleanup to no longer rely on missing each_key method
2013-09-12 11:32:45 -07:00
Godfrey Chan
52fb1a9565 Enabled quirks mode on JSON.parse, fixes broken test in af9caae
It turns out that ActionPack depends on the decoder to parse JSON
"fragments" (e.g. '"a string"', '1', 'null', etc), so we need to
enable quirks mode on JSON.parse. Also added coverage on the decoder
side to prevent regression.
2013-09-12 09:58:18 -07:00
Godfrey Chan
b9e142af52 Replace JSON.load with JSON.parse, also removed the proc parameter
Since we are dealing with untrusted user input, we should not be
using JSON.load. According to the docs[1]:

BEWARE: This method is meant to serialise data from trusted user
input, like from your own database server or clients under your
control, it could be dangerous to allow untrusted users to pass
JSON sources into it. The default options for the parser can be
changed via the ::load_default_options method.

[1] http://www.ruby-doc.org/stdlib-2.0/libdoc/json/rdoc/JSON.html#method-i-load
2013-09-11 17:22:09 -07:00
Rafael Mendonça França
bca623bc53 Merge pull request #12200 from dchelimsky/simplify-duration-inspect-even-more
Reduce Duration#inspect to a single series of transformations
2013-09-11 14:58:46 -07:00
David Chelimsky
b16b08ebde Reduce Duration#inspect to a single series of transformations
* eliminates need for temp Hash

Also added a couple of examples to DurationTest to specify:

* duration can be defined with units out of order e.g.
  1.month + 1.year + 1.second + 1.day
* equality with a Fixnum works regardless of which operand is on which
  side of the operator
2013-09-11 15:28:38 +02:00
Murray Steele
accd4926cc Fix FileStore#cleanup to no longer rely on missing each_key method 2013-09-11 13:58:40 +01:00
Akira Matsuda
e837e5a96b Be sure to restore the default I18n.locale after changed its value in a test 2013-09-10 19:54:49 +02:00
Guillermo Iguaran
005b33222d Merge pull request #12173 from arunagw/fixes_reverted_by_revert_commit
Revert fixes
2013-09-10 07:05:17 -07:00
Anupam Choudhury
44f203b0e3 Removed unused modules and classes 2013-09-10 16:44:44 +05:30
Anupam Choudhury
f3e4069ede Removed unnecessary require 2013-09-10 13:22:30 +05:30
Arun Agrawal
6f0b1ae04e Fix order dependent test
see c48cbb02d7e6f585e31b404c0c363f0d6b586811
2013-09-09 17:11:16 +02:00
Simon Coffey
b4a9668626 Ensure all-caps nested consts marked as autoloaded
Previously, an autoloaded constant `HTML::SomeClass` would not be marked
as autoloaded by AS::Dependencies. This is because the
`#loadable_constants_for_path` method uses `String#camelize` on the
inferred file path, which in turn means that, unless otherwise directed,
AS::Dependencies watches for loaded constants in the `Html` namespace.

By passing the original qualified constant name to `#load_or_require`,
this inference step is avoided, and the new constant is picked up in the
correct namespace.
2013-08-27 08:20:33 +01:00
Rafael Mendonça França
7a31388682 Merge pull request #11932 from gaurish/skip-encoding-convertor
[JRuby] Skip few of the ActiveSupport's inflector test cases

Conflicts:
	activesupport/test/abstract_unit.rb
2013-08-21 14:49:03 -03:00
Gaurish Sharma
e998edd2c0 Define jruby_skip to skip test on JRuby 2013-08-21 22:59:32 +05:30
Federico Ravasio
a9f6c8f8e1 Skip tests involving $SAFE, it's not supported on Rubinius. 2013-08-21 17:07:45 +02:00
Federico Ravasio
9773d2c291 Added method to skip tests on Rubinius to AS/abstract_unit. 2013-08-21 17:07:33 +02:00
Gaurish Sharma
a67b956d28 Skip few of the ActiveSupport'sinflector test on JRuby 2013-08-21 09:26:59 +05:30
Nick Howard
dfb923e6e5 ensure freeze on Thread freezes locals 2013-08-19 12:39:40 -06:00
Vijay Dev
9abe72c760 Merge branch 'master' of github.com:rails/docrails
Conflicts:
	actionview/README.rdoc
	activerecord/lib/active_record/migration.rb
	guides/source/development_dependencies_install.md
	guides/source/getting_started.md
2013-08-17 21:49:16 +05:30
Vijay Dev
ec8ef1e105 Revert "Merge branch 'master' of github.com:rails/docrails"
This reverts commit 70d6e16fbad75b89dd1798ed697e7732b8606fa3, reversing
changes made to ea4db3bc078fb3093ecdddffdf4f2f4ff3e1e8f9.

Seems to be a code merge done by mistake.
2013-08-17 21:46:39 +05:30
David Heinemeier Hansson
5da23a3f92 Add String#remove(pattern) as a short-hand for the common pattern of String#gsub(pattern, '') 2013-08-13 12:16:25 -05:00
Xavier Noria
c7ac0a5b28 renames the :abort deprecation behaviour to :raise
That is a better name, thanks @jeremy.
2013-08-13 01:44:52 +02:00
Xavier Noria
73aad75f56 defines a new :abort deprecation behaviour that raises
See the CHANGELONG message in the patch for further details.
2013-08-13 01:27:18 +02:00
Gaurish Sharma
7191a5d830 Avoid defining multibyte method names in JSON decoding test for JRuby Compat
This change is similar to #11736 & in same way switched with fixed string & the index of the hash for method name. the index was added because otherwise, ruby will raise Error.
2013-08-07 13:19:14 +05:30
Andrew White
dfcef831b5 Fix unused variable warning
We need to call `in_time_zone` to test that it isn't modifying the receiver
but since the variable isn't used it raises a warning so add an assertion
to make Ruby think it's being used.
2013-08-04 07:09:30 +01:00
Gaurish Sharma
ab5e99ed63 Avoid calling define_method with non-english chars in InflectorTest
When we call define_method with non-english chars like ¿por qué? it
errors out on JRuby as of 1.7.4 & would leave out the following error

invalid byte sequence in US-ASCII

To work around this issue, I have switched to define_test method call
define method with fixed string & the index of the hash. the index was
added because otherwise, ruby will raise method redefined warning.

As far as I can see there are no side-effect of this change for
other implementations. For readbility I have added a message to
asssert_equal informing for which word/phase the test has passed.

Before this Change:
JRuby:
Tests terminated suddenly with an error. no reported of Failues
or errors
MRI:
All Green.

After this Change,
JRuby:
the `ActiveSupport` TestsSuite gracefully fails with report at the end which test failed & why.
MRI:
All Green(no change)
2013-08-03 18:21:17 +05:30
Gilad Zohari
3102a9aa4c Refactor Date, Time, DateTime timezone methods
Similar implementations of #in_time_zone exists for Date, Time and DateTime so
method is extracted into its own module. Also some logic is extracted into
private method.
2013-08-01 00:27:25 +03:00
Andrew White
2d53ee0f42 Don't mutate the original inflections instance in the tests 2013-07-30 12:01:56 +01:00
Andrew White
c901056131 Merge pull request #10879 from makaroni4/master
Added Time#middle_of_day method
2013-07-29 10:25:06 -07:00
Andrew White
88c0ef4d4f Fix handling of offsets with Time#to_s(:iso8601)
Use a lambda to ensure that the generated string respects the offset of
the time value. Also add DateTime#to_s(:iso8601) and Date#to_s(:iso8601)
for completeness.
2013-07-29 12:31:20 +01:00
David Heinemeier Hansson
b67a80de9b Add Time#to_s(:iso8601) for easy conversion of times to the iso8601 format for easy Javascript date parsing 2013-07-28 16:34:43 -05:00
Anatoli Makarevich
1b6bbb0953 Added Time#middle_of_day
Added middle_of_day method to Date and DateTime
2013-07-28 23:29:50 +04:00
Akira Matsuda
633be2cbbd Be sure to restore the default I18n.locale after changed its value in a test 2013-07-26 04:21:52 +09:00
Akira Matsuda
c48cbb02d7 Fix order dependent tests
Restore default ActiveSupport::XmlMini.backend after tests
2013-07-26 04:17:00 +09:00
Piotr Sarnacki
782d2f6f83 Merge pull request #11546 from swoop-inc/ss_memory_store_cache_size
[Fixes #11512] improves cache size calculation in MemoryStore
2013-07-22 08:05:07 -07:00
Simeon Simeonov
51d9b9a821 [Fixes #11512] improves cache size calculation in ActiveSupport::Cache::MemoryStore
Previously, the cache size of `ActiveSupport::Cache::MemoryStore` was calculated
as the sum of the size of its entries, ignoring the size of keys and any data
structure overhead. This could lead to the calculated cache size sometimes being
10-100x smaller than the memory used, e.g., in the case of small values.

The size of a key/entry pair is now calculated via `#cached_size`:

    def cached_size(key, entry)
      key.to_s.bytesize + entry.size + PER_ENTRY_OVERHEAD
    end

The value of `PER_ENTRY_OVERHEAD` is 240 bytes based on an [empirical
estimation](https://gist.github.com/ssimeonov/6047200) for 64-bit MRI on
1.9.3 and 2.0.

Fixes GH#11512 https://github.com/rails/rails/issues/11512
2013-07-22 09:53:03 -04:00
Damien Mathieu
7aae4e5e66 remove useless duplication in include test 2013-07-22 10:31:14 +02:00
Bogdan Gusiev
f9e60c74b6 Disable ability to iterate over a Range of TimeWithZone 2013-07-19 11:06:11 +03:00
Marat Kazbekov
0ebf45cf5d remove duplication in test 2013-07-18 20:48:19 +05:00
Andrew White
07a4c76a07 Only raise DelegationError if it's is the source of the exception
This fixes situations where nested NoMethodError exceptions are masked
by delegations. This would cause confusion especially where there was a
problem in the Rails booting process because of a delegation in the
routes reloading code.

Fixes #10559
2013-07-11 09:05:32 +01:00
Andrew White
4d733d2dd4 Add failing test for #9562
Rails 4.0.0 fails when trying to encode an ActiveSupport::TimeWithZone
that wraps a DateTime instance. This is fixed on master so add a test
to prevent regression.

(cherry picked from commit ad01b8da354268cebfae1519c28d19d75576ccb1)
2013-07-10 15:49:09 +01:00
Andrew White
c42260a325 Return local time for backwards compatibility 2013-07-09 15:50:14 +01:00
Andrew White
1b3873730b Retain UTC offset 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.

Fixes #11350.
2013-07-09 13:43:56 +01:00