aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* | | Merge pull request #10996 from mattdbridges/number-helper-refactorRafael Mendonça França2013-12-021-6/+0
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Refactor and clean up number helpers Conflicts: activesupport/lib/active_support/number_helper.rb
| * | | Extract ActiveSupport::NumberHelper methods to classesMatt Bridges2013-07-011-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to the overall complexity of each method individually as well as the global shared private module methods, this pulls each helper into it's own converter class inheriting from a generic `NumberBuilder` class. * The `NumberBuilder` class contains the private methods needed for each helper method an eliminates the need for special definition of specialized private module methods. * The `ActiveSupport::NumberHelper::DEFAULTS` constant has been moved into the `NumberBuilder` class because the `NumberBuilder` is the only class which needs access to it. * For each of the builders, the `#convert` method is broken down to smaller parts and extracted into private methods for clarity of purpose. * Most of the mutation that once was necessary has now been eliminated. * Several of the mathematical operations for percentage, delimited, and rounded have been moved into private methods to ease readability and clarity. * Internationalization is still a bit crufty, and definitely could be improved, but it is functional and a bit easier to follow. The following helpers were extracted into their respective classes. * `#number_to_percentage` -> `NumberToPercentageConverter` * `#number_to_delimited` -> `NumberToDelimitedConverter` * `#number_to_phone` -> `NumberToPhoneConverter` * `#number_to_currency` -> `NumberToCurrencyConverter` * `#number_to_rounded` -> `NumberToRoundedConverter` * `#number_to_human_size` -> `NumberToHumanSizeConverter` * `#number_to_human` -> `NumberToHumanConverter`
* | | | Merge pull request #11197 from gsamokovarov/unify-mattr-cattrGuillermo Iguaran2013-12-022-74/+22
|\ \ \ \ | | | | | | | | | | Unify cattr and mattr accessors declarations
| * | | | Unify cattr and mattr accessors declarationsGenadi Samokovarov2013-12-022-74/+22
| | |/ / | |/| |
* / | | :scissors:Rafael Mendonça França2013-12-021-4/+4
|/ / / | | | | | | | | | [ci skip]
* | | Fix segmentation fault in Ruby 2.0.0-p353.Dmitriy Kiriyenko2013-11-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ruby 2.0.0-p353 there was a [commit](https://github.com/ruby/ruby/commit/66915c507777c5e3a978fa73de25db763efd9206) that switched case matching from actual sending `===` method to magic lookup, that does not see it in `method_missing`. It's hard to predict how exactly and when exactly this bug will be solved so here I suggest a solution of defining it in Duration directly. In Ruby 2.0.0-p353 without the added fix added test crashes to segmentation fault.