Commit Graph

18 Commits

Author SHA1 Message Date
tom-lord 7905bdfd8b Add `:round_mode` parameter support to number helpers
Support handling a `round_mode` in `ActiveSupport::NumberHelper::RoundingHelper`

Add default value to locale file

Update inline documentation with new parameter option

Update CHANGELOG

Add round_mode examples to all the tests

Add I18n test

Simplify logic

Further simpification
2020-01-05 21:23:02 +00:00
Michael Grosser 203998c916
allow running each test with pure ruby path/to/test.rb
also:
 - makes test dependencies obvious
 - makes tests runnable from within subfolders
2019-12-18 08:49:19 -06:00
Ryuta Kamizono 245c1dafa8 Enable `Layout/LeadingCommentSpace` to not allow cosmetic changes in the future
Follow up of #31432.
2017-12-14 17:30:54 +09:00
Ryuta Kamizono 2b35826389 Enable `Layout/SpaceBeforeComma` rubocop rule, and fixed more
Follow up of #31390.
2017-12-12 20:00:50 +09:00
Koichi ITO ac717d65a3 [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` 2017-07-11 13:12:32 +09:00
Kir Shatrov 72950568dd Use frozen-string-literal in ActiveSupport 2017-07-09 15:08:29 +03:00
Matthew Draper 87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590, reversing
changes made to afb66a5a59.
2017-07-02 02:15:17 +09:30
Kir Shatrov cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Akira Matsuda 17848036ad Missing require 'active_support/core_ext/hash/keys'
Without this, the test causes a "method redefined" warning because
* first it loads I18n and defines Hash#deep_symbolize_keys inside I18n's lib/i18n/core_ext/hash.rb
* then it loads AS/core_ext/hash/keys.rb afterwards
2017-01-29 08:41:06 +09:00
Rafael Mendonça França 55f9b8129a
Add three new rubocop rules
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces

Fix all violations in the repository.
2016-08-16 04:30:11 -03:00
Xavier Noria 411ccbdab2 remove redundant curlies from hash arguments 2016-08-06 19:44:11 +02:00
Xavier Noria 5c315a8fa6 modernizes hash syntax in activesupport 2016-08-06 19:38:33 +02:00
Xavier Noria a731125f12 applies new string literal convention in activesupport/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:10:53 +02:00
Kuldeep Aggarwal 880721434c remove unnecessary calling of `I18n.backend.store_translations(empty, {})`
Clean up I18n stored translations after test
continuation with #15714
2014-06-15 08:53:58 +05:30
Carlos Antonio da Silva 47b4d13c8d Ensure I18n format values always have precedence over defaults
Always merge I18n format values, namespaced or not, over the default
ones, to ensure I18n format defaults will have precedence over our
namespaced values.

Precedence should happen like this:

    default :format
    default :namespace :format
    i18n    :format
    i18n    :namespace :format

Because we cannot allow our namespaced default to override a I18n
:format config - ie precision in I18n :format should always have higher
precedence than our default precision for a particular :namespace.

Also simplify default format options logic.
2012-08-11 00:20:19 -03:00
Carlos Antonio da Silva a9dccda936 Fallback to :en locale instead of handling a constant with defaults
Action Pack already comes with a default locale fine for :en, that is
always loaded. We can just fallback to this locale for defaults, if
values for the current locale cannot be found.

Closes #4420, #2802, #2890.
2012-08-11 00:20:19 -03:00
Carlos Antonio da Silva d6aea126de Get rid of the clear_i18n hack by using a different locale
Use a different and very specific locale for testing currency negative
format, and an empty store for currency defaults.
2012-06-24 19:30:06 -03:00
Carlos Antonio da Silva dc766c9e7b Move number helper i18n related tests to AS
They also make more sense here since all the related logic with I18n is
handled by AS::NumberHelper, and not by AV anymore.
2012-06-24 19:30:06 -03:00