aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | | Add support for JSON time_precision to Time and DateTimeAndrew White2014-01-261-1/+19
| | | | | | |
* | | | | | | Rename subsecond_fraction_digits option to time_precisionAndrew White2014-01-261-3/+3
| | | | | | |
* | | | | | | Consolidate JSON encoding tests in one fileAndrew White2014-01-262-46/+48
| | | | | | |
* | | | | | | Customize subsecond digits when encoding DateWithTimeParker Selbert2014-01-261-7/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The subsecond fraction digits had been hardcoded to 3. This forced all timestamps to include the subsecond digits with no way to customize the value. While the subsecond format is part of the ISO8601 spec, it is not adhered to by all parsers (notably mobile clients). This adds the ability to customize the number of digits used, optionally setting them to 0 in order to eliminate the subsecond fraction entirely: ActiveSupport::JSON::Encoding.subsecond_fraction_digits = 0
* | | | | | | Maintain current timezone when changing time during DST overlapAndrew White2014-01-261-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently if a time is changed during DST overlap in the autumn then the method `period_for_local` will return the DST period. However if the original time is not DST then this can be surprising and is not what is generally wanted. This commit changes that behavior to maintain the current period if it's in the list of periods returned by `periods_for_local`. It is possible to alter the behavior of `period_for_local` by specifying a second argument but since we may be change from another time that could be either DST or not then this would give inconsistent results. Fixes #12163.
* | | | | | | Remove warningRafael Mendonça França2014-01-161-2/+2
| | | | | | |
* | | | | | | define the delegate methods on one line. fixes #13724Aaron Patterson2014-01-161-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | sup haters
* | | | | | | standardize on jruby_skip & rbx_skipGaurish Sharma2014-01-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This Adds helpers(jruby_skip & rbx_skip). In Future, Plan is to use these helpers instead of calls directly to RUBY_ENGINE/RbConfig/JRUBY_VERSION
* | | | | | | Fix iterating over DateTime by doing strict checking for Time objectsPrathamesh Sonpatki2014-01-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Fixes #13667
* | | | | | | Merge pull request #13632 from tinogomes/masterRafael Mendonça França2014-01-091-0/+28
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Adding Hash#compact and Hash#compact! methods
| * | | | | | | Adding Hash#compact and Hash#compact! methodstinogomes2014-01-091-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Adding Hash#compact and Hash#compact! methods * Using Ruby 1.9 syntax on documentation * Updating guides for `Hash#compact` and `Hash#compact!` methods * Updating CHANGELOG for ActiveSupport * Removing unecessary protected method and lambda for `Hash#compact` implementations * Performing `Hash#compact` implementation - https://gist.github.com/tinogomes/8332883 * fixing order position * Fixing typo
* | | | | | | | clear cache on body close so that cache remains during renderingAaron Patterson2014-01-081-0/+37
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fixes #13547 The body may use the local cache during rendering. `call`ing the app doesn't mean that rendering is finished, so we need to wait until `close` is called on the body.
* | | | | | | Revert "Speedup String#to"Yves Senn2014-01-081-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 2ef1fb2c455ca53a0c1e1768f50824926ce28bd3. As described in PR #13627 this commit broke functionality when passing a negative Fixnum to the `String#to` method: ```ruby assert_equal "hell", s.to(-2) ``` Before the revert, this failed with: ``` 1) Failure: StringAccessTest#test_#to_with_negative_Fixnum,_position_is_counted_from_the_end [test/core_ext/string_ext_test.rb:275]: Expected: "hell" Actual: nil ``` This revert is to keep the functionality on `master` working. If there is another way to get the performance benefit and keep the documented functionality we can add that. /cc @amatsuda @carlosantoniodasilva
* | | | | | | typo fix in test name. [ci skip].Yves Senn2014-01-081-1/+1
| | | | | | |
* | | | | | | `core_ext/string/access.rb` test what we are documenting.Yves Senn2014-01-081-50/+89
| |/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I also extracted the tests from a single bulk method into a separate test-case. The new tests cover the API described in the docs. There are two skipped tests, which are broken as of 2ef1fb2c455ca53a0c1e1768f50824926ce28bd3 * #to with negative Fixnum, position is counted from the end * #from and #to can be combined This was brought to my attention by #13627. Closes #13627.
* | | | | | Merge pull request #10634 from teleological/time_advance_gregorianAndrew White2014-01-051-0/+7
|\ \ \ \ \ \ | | | | | | | | | | | | | | Maintain proleptic gregorian in Time#advance
| * | | | | | Maintain proleptic gregorian in Time#advanceRiley Lynch2013-05-151-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Time#advance uses Time#to_date and Date#advance to calculate a new date. The Date object returned by Time#to_date is constructed with the assumption that the Time object represents a proleptic gregorian date, but it is configured to observe the default julian calendar reform date (2299161j) for purposes of calculating month, date and year: Time.new(1582, 10, 4).to_date.to_s # => "1582-09-24" Time.new(1582, 10, 4).to_date.gregorian.to_s # => "1582-10-04" This patch ensures that when the intermediate Date object is advanced to yield a new Date object, that the Time object for return is contructed with a proleptic gregorian month, date and year.
* | | | | | | Raise if MemCacheStore doenst receive a Dalli objArthur Neves2014-01-031-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | :mem_cache_store should receive a list of hosts or a dalli client, otherwise raise it. Also adding a changelog.
* | | | | | | mem_cache_store requires dalli, so only accept dalli/clientArthur Neves2014-01-031-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | :mem_cache_store require dalli, rescue Dalli exceptions, and follow Dalli API. Memcached gem, for instance, doesnt work anymore, as the API are different. As we already require one client, we should make sure that client works, and not accept others, and if someone wants to use another memcache client they can write their own store adapter.
* | | | | | | blank? and present? commit to return singletons [Xavier Noria & Pavel Pravosud]Xavier Noria2013-12-281-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The contract of blank? and present? was in principle to return Object, as we generally do, the test suite and description was consistent with that, but some examples had comments like "# => true". This cannot be unclear, we either fix the examples, or update the contract. Since users may be already assuming singletons due to the examples and the fact that they were returned before 30ba7ee, the safest option seems to be to revise the contract and the implementation of String#blank? The motivation for 30ba7ee was to improve the performance of the predicate, the refactor based on === is on par regarding speed. With this commit we start documenting return types using YARD conventions. We plan to document return types gradually.
* | | | | | | Fix AS::NumberHelper results with large precisionsKenta Murata & Akira Matsuda2013-12-201-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | before: ActiveSupport::NumberHelper.number_to_rounded '3.14159', precision: 50 => "3.14158999999999988261834005243144929409027099609375" after: ActiveSupport::NumberHelper.number_to_rounded '3.14159', precision: 50 => "3.14159000000000000000000000000000000000000000000000"
* | | | | | | Make sure multiline string is not accepted by the regexpRafael Mendonça França2013-12-191-1/+9
| | | | | | |
* | | | | | | Merge pull request #13406 from hincupetru/masterRafael Mendonça França2013-12-191-0/+6
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Fixed configurable.rb regular expression name check
| * | | | | | | Fixed configurable.rb regular expression name checkHincu Petru2013-12-191-0/+6
| | | | | | | |
* | | | | | | | Merge pull request #13401 from akshay-vishnoi/refactorRafael Mendonça França2013-12-191-1/+4
|\ \ \ \ \ \ \ \ | |/ / / / / / / |/| | | | | | | Prevent creation of instance methods when `instance_reader = false`, Grammar checks, Conditional statements combined
| * | | | | | | Prevent creation of instance methods when `instance_reader = false`, Grammar ↵Akshay Vishnoi2013-12-191-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | checks, Conditional statements combined
* | | | | | | | Prefer assert_raise instead of flunk + rescue to test for exceptionsCarlos Antonio da Silva2013-12-195-48/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change most tests to make use of assert_raise returning the raised exception rather than relying on a combination of flunk + rescue to check for exception types/messages.
* | | | | | | | Fix asserting the correct exception message in dependencies testCarlos Antonio da Silva2013-12-191-2/+2
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Minitest, the second argument of assert_raise(s) accepts a string as the message that should be shown in case of a failure in the assertion (eg nothing was raised when it should), and not the exception message to be matched. To do that we need to save the exception returned from assert_raise(s) into a local variable and check for the exception message using it.
* | | | | | | Unused classes in AS testsAkira Matsuda2013-12-194-30/+0
| | | | | | |
* | | | | | | Merge pull request #13366 from vipulnsward/minitest-namespace-changeGodfrey Chan2013-12-182-5/+5
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Change all `MiniTest` to `Minitest`
| * | | | | | | Change all `MiniTest` to `Minitest` since, `MiniTest` namespace has been ↵Vipul A M2013-12-182-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | renamed to `Minitest` Ref: https://github.com/seattlerb/minitest/blob/master/History.txt
* | | | | | | | Unused classes in test caseAkira Matsuda2013-12-191-25/+0
|/ / / / / / /
* | | | | | | Disable available locales checks to avoid warnings running the testsCarlos Antonio da Silva2013-12-171-0/+3
| | | | | | |
* | | | | | | Introduce Module#concerningJeremy Kemper2013-12-171-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A natural, low-ceremony way to separate responsibilities within a class. Imported from https://github.com/37signals/concerning#readme
* | | | | | | Fixes interpolation on SafeBufferJulien Letessier2013-12-141-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Interpolation was untested and did not work with hash arguments. Adds - support for interpolation with hash argument - tests for the above - tests for safe/unsafe interpolation
* | | | | | | Merge pull request #13229 from vipulnsward/fix-10635-testsRafael Mendonça França2013-12-121-0/+14
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Fix test-error introduced by #10635.
| * | | | | | | PR #10635 introduces rescue from ArgumentError thrown by ↵Vipul A M2013-12-121-0/+14
| | |_|_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `Base64.strict_decode64`. This broke natural order of things for `StaleSessionCheck#stale_session_check!` which tried auto_loading a class based on `ArgumentError` message , and later retrying the `Marshal#load` of class, successfully allowing auto_loading. This PR tries to fix this behavior by forwarding `ArgumentError` 's not raised by `Base64.strict_decode64` , as is, ahead to `StaleSessionCheck#stale_session_check!`
* / | | | | | Remove not necessary file, move constants to the file they are usedCarlos Antonio da Silva2013-12-113-8/+8
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | File 'empty_bool.rb' was introduced around 4 years ago in c10958fbddb22052e7cbe5fe6b825cda3cb26e48 to remove method redefined warning in AS test suite, however we do not have such need for reuse anymore, so we can safely move the constants back to the file where they are currently used and get rid of the extra file/require.
* | | | | | better error message for constants autoloaded from anonymous modules [fixes ↵Xavier Noria2013-12-061-17/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #13204] load_missing_constant is a private method that basically plays the role of const_missing. This method has an error condition that is surprising: it raises if the class or module already has the missing constant. How is it possible that if the class of module has the constant Ruby has called const_missing in the first place? The answer is that the from_mod argument is self except for anonymous modules, because const_missing passes down Object in such case (see the comment in the source code of the patch for the rationale). But then, it is better to pass down Object *if Object is also missing the constant* and otherwise err with an informative message right away.
* | | | | | Merge pull request #10635 from vipulnsward/change_to_strictJeremy Kemper2013-12-061-1/+12
|\ \ \ \ \ \ | | | | | | | | | | | | | | Use `Base.strict_decode64` instead of `Base.decode64`
| * | | | | | Use `Base.strict_decode64` instead of `Base.decode64` just as we do in encoding;Vipul A M2013-05-161-1/+12
| |/ / / / / | | | | | | | | | | | | | | | | | | Also reduce extra object allocation by creating string directly instead of join on Array
* | | | | | Fix issue with Kernel#silence_stream leaking file descriptorsMario Visic2013-12-061-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling Kernel#silence_stream creates a new file descriptor which isn't closed after it is used. As a result calling silence_stream multiple times leads to a build up of loose file descriptors and can cause issues in environments where garbage collection isn't run often.
* | | | | | removed duplicate test caseKuldeep Aggarwal2013-12-041-1/+0
| | | | | |
* | | | | | Added Date#all_week/month/quarter/year for generating date rangesDimko2013-12-031-0/+17
| | | | | |
* | | | | | Add support for localized date referencesColin Bartlett2013-12-031-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ruby's Date class automatically gives us #yesterday, #today, and #tomorrow. And ActiveSupport has a handy Time.zone.today for getting a localized version. But there was no localized version of #yesterday or #tomorrow. Until now.
* | | | | | Use travel_to convention in existing testColin Bartlett2013-12-031-4/+4
| | | | | |
* | | | | | Tidy up previous commit, fix message assertion and improve testsCarlos Antonio da Silva2013-12-031-1/+6
| | | | | |
* | | | | | Modify the Hash#assert_valid_keys error message so that it shows the valid ↵Nerian2013-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | keys. Also, show the wrong value as it was entered. { :failore => "stuff", :funny => "business" }.assert_valid_keys([ :failure, :funny ]) => ArgumentError: Unknown key: failore { 'failore' => "stuff", :funny => "business" }.assert_valid_keys([ :failure, :funny ]) => ArgumentError: Unknown key: failore { 'failore' => "stuff", :funny => "business" }.assert_valid_keys([ :failure, :funny ]) => ArgumentError: Unknown key: "failore". Valid keys are: :failure, :funny { :failore => "stuff", :funny => "business" }.assert_valid_keys([ :failure, :funny ]) => ArgumentError: Unknown key: :failore. Valid keys are: :failure, :funny Conflicts: activerecord/CHANGELOG.md Closes #11624.
* | | | | | Merge pull request #13060 from chancancode/change_log_for_json_refactorCarlos Antonio da Silva2013-12-021-0/+16
|\ \ \ \ \ \ | | | | | | | | | | | | | | CHANGELOG for JSON refactor + added back the `encode_big_decimal_as_string` option with warning
| * | | | | | Added back the `encode_big_decimal_as_string` option with warningGodfrey Chan2013-12-021-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also added the missing CHANGELOG entry for #12183 @ 80e7552073 and 4d02296cfb.