| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|\
| |
| | |
Improve String#squish whitespaces matching
|
| | |
|
| | |
|
| |
| |
| |
| | |
this would give us some more clues in case a test silently dies inside Thread
|
| |
| |
| |
| |
| |
| | |
* ASCII_STRING was not an ASCII String
* BYTE_STRING was not an in valid UTF-8 String
* added an assertion for non-UTF-8 String
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
|/ |
|
|\
| |
| | |
Inflector irregular singularize rules
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Use the standard library's `DateTime.parse` because it's marginally
faster and supports partial date/time strings.
Benchmark:
user system total real
old 3.980000 0.000000 3.980000 ( 3.987606)
new 3.640000 0.010000 3.650000 ( 3.641342)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit standardises the return value of `to_time` to an instance
of `Time` in the local system timezone, matching the Ruby core and
standard library behavior.
The default form for `String#to_time` has been changed from :utc to
:local but research seems to suggest the latter is the more common form.
Also fix an edge condition with `String#to_time` where the string has
a timezone offset in it and the mode is :local. e.g:
# Before:
>> "2000-01-01 00:00:00 -0500".to_time(:local)
=> 2000-01-01 05:00:00 -0500
# After:
>> "2000-01-01 00:00:00 -0500".to_time(:local)
=> 2000-01-01 00:00:00 -0500
Closes #2453
|
| |
| |
| |
| | |
Introduced in b718998f3e8e6f3d01ad138e40f08fbcc3736285.
|
| |
| |
| |
| | |
Closes #8587
|
| | |
|
| | |
|
|\ \
| | |
| | | |
Fix a typo in a test.
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
This reverts commit 88cc1688d0cb828c17706b41a8bd27870f2a2beb, reversing
changes made to f049016cd348627bf8db0d72382d7580bf802a79.
|
|/ / |
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
They don't add any benefits over `assert object.blank?`
and `assert object.present?`
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
I did this because to_date gives a very unhelpful error message if you
do not pass in a correct date. In the process I think this cleans up the
code nicely and even better it tends to be slightly faster than the
current implementation.
Benchmark
https://gist.github.com/4440875
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Date, DateTime, Time and TimeWithZone can now be compared to infinity,
so it's now possible to create ranges with one infinite bound and
date/time object as another bound.
Ex.: @range = Range.new(Date.today, Float::INFINITY)
Also it's possible to check inclusion of date/time in range with
conversion.
Ex.: @range.include?(Time.now + 1.year) # => true
@range.include?(DateTime.now + 1.year) # => true
Ability to create date/time ranges with infinite bound is required
for handling postgresql range types.
|
| |
|
| |
|
|
|
|
| |
These tests are needed only if we are using MiniTest::Spec
|
|
|
|
|
| |
minitest/autorun load minitest/spec polluting the global namespace with
the DSL that we don't want on Rails
|
|
|
|
| |
begin/rescue/else.
|
| |
|
|
|
|
|
|
| |
As reported (https://github.com/rails/rails/pull/8185#issuecomment-11702226)
this test relied on the order a hash was serialized. Comparing the parsed
hash makes the test no longer order dependent.
|
|
|
|
|
|
| |
Tagging every message in tests makes the logs really wide. It's great
for grepping, but annoying to open in an editor or a narrow terminal.
Try out a different approach: spit out a heading before each test.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The AS utility silence_warnings does not really silence this
one, because it is issued at parse-time. It seemed to in
some places because the constant was the only expression in
the block and therefore it was its return value, that could
potentially be used by silence_warnings are return value of
the yield call.
To bypass the warning we assign to a variable. The chosen
variable is "_" because it is special-cased in parse.c not
to issue an "assigned but unused variable" warning in turn.
|
|
|
|
| |
with Rails 4.0.
|
|\
| |
| | |
WIP Refactor xml conversion to hash
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Three basic refactors in this PR:
* We extracted the logic into a method object. We now don't define a tone of extraneous methods on Hash, even if they were private.
* Extracted blocks of the case statement into methods that do the work. This makes the logic more clear.
* Extracted complicated if clauses into their own query methods. They often have two or three terms, this makes it much easier to see what they _do_.
We took care not to refactor too much as to not break anything, and put comments where we suspect tests are missing.
We think ActiveSupport::XMLMini might be a good candidate to move to a plugin in the future.
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
dmitriy-kiriyenko/fix-double-callback-in-same-statement
Prevent callback from being set twice.
Conflicts:
activesupport/CHANGELOG.md
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
When you add one callack in two separate `set_callback` calls - it is
only called once.
When you do it in one `set_callback` call - it is called twice.
This violates the principle of least astonishment for me. Duplicating
callback is usually an error. There is a correct and obvious way to do
anything without this "feature".
If you want to do
before_save :clear_balance, :calculate_tax, :clear_balance
or whatever, you should better do
before_save :carefully_calculate_tax
def carefully_calculate_tax
clear_balance
calculate_tax
clear_balance
end
And this even opens gates for some advanced refactorings, unlike the
first approach.
My assumptions are:
- Principle of least astonishment is violated, when callbacks are either
prevented from duplication, or not.
- Duplicating callbacks is usually an error. When it is intentional -
it's a smell of a bad design and can be approached without abusing
this "feature".
My suggestion is: do not allow duplicating callbacks in one callback
call, like it is not allowed in separate callbacks call.
|
| | |
| | |
| | |
| | | |
Logger#silence extension
|