aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | Avoid defining multibyte method names in JSON decoding test for JRuby CompatGaurish Sharma2013-08-071-3/+4
| | | | | | | | | | | | | | | | | | | | 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.
* | | | | Fix unused variable warningAndrew White2013-08-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | Avoid calling define_method with non-english chars in InflectorTestGaurish Sharma2013-08-031-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* | | | | Refactor Date, Time, DateTime timezone methodsGilad Zohari2013-08-011-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | Don't mutate the original inflections instance in the testsAndrew White2013-07-302-20/+22
| | | | |
* | | | | Merge pull request #10879 from makaroni4/masterAndrew White2013-07-293-0/+20
|\ \ \ \ \ | | | | | | | | | | | | Added Time#middle_of_day method
| * | | | | Added Time#middle_of_dayAnatoli Makarevich2013-07-283-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | Added middle_of_day method to Date and DateTime
* | | | | | Fix handling of offsets with Time#to_s(:iso8601)Andrew White2013-07-293-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | Add Time#to_s(:iso8601) for easy conversion of times to the iso8601 format ↵David Heinemeier Hansson2013-07-281-0/+1
| |/ / / / |/| | | | | | | | | | | | | | for easy Javascript date parsing
* | | | | Be sure to restore the default I18n.locale after changed its value in a testAkira Matsuda2013-07-261-3/+3
| | | | |
* | | | | Fix order dependent testsAkira Matsuda2013-07-261-2/+10
| | | | | | | | | | | | | | | | | | | | Restore default ActiveSupport::XmlMini.backend after tests
* | | | | Merge pull request #11546 from swoop-inc/ss_memory_store_cache_sizePiotr Sarnacki2013-07-221-2/+26
|\ \ \ \ \ | | | | | | | | | | | | [Fixes #11512] improves cache size calculation in MemoryStore
| * | | | | [Fixes #11512] improves cache size calculation in ↵Simeon Simeonov2013-07-221-2/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | | remove useless duplication in include testDamien Mathieu2013-07-221-4/+0
|/ / / / /
* | / / / remove duplication in testMarat Kazbekov2013-07-181-6/+0
| |/ / / |/| | |
* | | | Only raise DelegationError if it's is the source of the exceptionAndrew White2013-07-111-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | Add failing test for #9562Andrew White2013-07-101-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* | | | Return local time for backwards compatibilityAndrew White2013-07-091-8/+25
| | | |
* | | | Retain UTC offset when using Time.at_with_coercionAndrew White2013-07-091-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Fix microsecond precision of Time#at_with_coercionNeer Friedman2013-07-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When Time.at_with_coercion (wraps Time.at) is called with a single argument that "acts_like?(:time)" it is coerced to integer thus losing it's microsecond percision. This commits changes this to use `#to_f` to prevent the problem
* | | | Explicitly test for true and false.Jade Tucker2013-07-071-2/+2
| | | |
* | | | Make HashWithIndifferentAccess#select always return the hash.Marc Schütz2013-07-061-0/+6
| | | | | | | | | | | | | | | | | | | | Hash#select! returns nil if the hash didn't change and thus behaves differently from select, so it's return value can't be used as result for the latter.
* | | | Fixed test broken by local_constant_names Arun Agrawal2013-07-031-6/+0
| | | | | | | | | | | | depreciation removed
* | | | Remove deprecated `String#encoding_aware?` Arun Agrawal2013-07-032-7/+0
| | | | | | | | | | | | core extensions (`core_ext/string/encoding`).
* | | | Remove deprecated `Time#time_with_datetime_fallback`, `Time#utc_time`Vipul A M2013-07-031-55/+0
| | | | | | | | | | | | | | | | and `Time#local_time` in favour of `Time#utc` and `Time#local`
* | | | Remove deprecated Hash#diff with no replacement.Carlos Antonio da Silva2013-07-021-6/+0
| | | | | | | | | | | | | | | | | | | | If you're using it to compare hashes for the purpose of testing, please use MiniTest's assert_equal instead.
* | | | Remove deprecated `Date#to_time_in_current_zone`Vipul A M2013-07-021-7/+0
| | | |
* | | | Remove deprecated `Proc#bind` with no replacement.Carlos Antonio da Silva2013-07-011-14/+0
| | | |
* | | | Remove deprecated Array#uniq_by and Array#uniq_by!Carlos Antonio da Silva2013-07-011-30/+0
| | | | | | | | | | | | | | | | Use native Array#uniq and Array#uniq! instead.
* | | | Remove deprecated AS::BasicObject, use AS::ProxyObject insteadCarlos Antonio da Silva2013-07-011-12/+0
| | | |
* | | | remove deprecated `BufferedLogger`.Yves Senn2013-07-011-22/+0
| | | |
* | | | remove deprecated `assert_present` and `assert_blank`.Yves Senn2013-07-011-48/+0
| | | |
* | | | Move delegation error constant to inside ModuleCarlos Antonio da Silva2013-06-261-1/+1
| | | |
* | | | Merge pull request #10828 from southpolesteve/delegation_error_classYves Senn2013-06-261-1/+1
|\ \ \ \ | | | | | | | | | | Create DelegationError class
| * | | | Add DelegationError class. Rasied by delegation to a nil objectSteve Faulkner2013-06-261-1/+1
| | | | |
* | | | | Fix BacktraceCleaner#noise for multiple silencers.Mark J. Titorenko2013-06-201-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous implementation of BacktraceSilencer#noise did not work correctly if more than one silencer was configured -- specifically, it would only return noise which was matched by all silencers. The new implementation is such that anything that has been matched by silencers is removed from the backtrace using Array#- (array difference), ie. we now return all elements within a backtrace that have been matched by any silencer (and are thus removed by #silence). Fixes #11030.
* | | | | Rewind StringIO instances before be parsed againPaco Guzman2013-06-165-0/+5
| | | | |
* | | | | Use xml instead already parsed xmlPaco Guzman2013-06-161-1/+1
| | | | |
* | | | | Merge pull request #10727 from pacoguzman/fix-xml-mini-testsRafael Mendonça França2013-06-156-6/+6
|\ \ \ \ \ | | | | | | | | | | | | Fix XmlMini different backends tests
| * | | | | Compare with the parsed result from REXML backendPaco Guzman2013-05-226-6/+6
| | |_|/ / | |/| | |
* | | | | Merge pull request #10740 from mrsimo/hash-with-indifferent-access-selectRafael Mendonça França2013-06-141-0/+30
|\ \ \ \ \ | | | | | | | | | | | | HashWithIndifferentAccess#select working as intended
| * | | | | HashWithIndifferentAccess#select working as intendedAlbert Llop2013-05-231-0/+30
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, #reject returned a HashWithIndifferentAccess, whereas #select returned a Hash. Now #select also returns a HashWithIndifferentAccess.
* | | | | Merge pull request #10943 from killthekitten/10932_constantize_emptyXavier Noria2013-06-141-4/+4
|\ \ \ \ \ | | | | | | | | | | | | Fix #10932. Treat "" and "::" as invalid on constantize
| * | | | | Fix #10932. Treat "" and "::" as invalid on constantizeNikolay Shebanov2013-06-141-4/+4
| | | | | |
* | | | | | Add missing nsec test for 17f5d8eAndrew White2013-06-131-0/+5
| | | | | |
* | | | | | Keep sub-second resolution when wrapping a DateTime valueAndrew White2013-06-132-0/+15
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add `DateTime#usec` and `DateTime#nsec` so that `ActiveSupport::TimeWithZone` keeps sub-second resolution when wrapping a `DateTime` value. Fixes #10855
* | | | | Drop extra variable from testVipul A M2013-06-121-2/+2
| | | | |
* | | | | Don't blindly call blame_file! on exceptions in ↵Andrew Kreiling2013-06-092-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ActiveSupport::Dependencies::Loadable It is possible under some environments to receive an Exception that is not extended with Blamable (e.g. JRuby). ActiveSupport::Dependencies::Loadable#load_dependency blindly call blame_file! on the exception which throws it's own NoMethodError exception and hides the original Exception. This commit fixes #9521
* | | | | Override Time.at to work with Time-like valuesAndrew White2013-06-081-0/+22
| |_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Merge pull request #10784 from senny/10526_prevent_key_transformationRafael Mendonça França2013-06-031-0/+7
|\ \ \ \ | |_|/ / |/| | | Prevent side effects in `Hash#with_indifferent_access`.