Commit Graph

7226 Commits

Author SHA1 Message Date
Sean Griffin
13fd153429 Fix changelog format 2017-08-03 11:33:07 -04:00
Ricardo Díaz
1d65185c90 Update String#camelize to provide feedback when wrong option is passed
String#camelize was returning nil without any feedback when an
invalid option was passed as parameter. This update makes the method
to raises an ArgumentError when the option passed is invalid, similar
to what Ruby does for String#downcase (and others) in 2.4.1.

https://ruby-doc.org/core-2.4.1/String.html#method-i-downcase
2017-08-02 00:41:09 -05:00
Boris Slobodin
d76ed9e47e fix typo in assert_changes error message 2017-07-31 11:10:59 -07:00
Sayan Chakraborty
a54e13bd2e Add missing support for modulo operations on durations
Rails 5.1 introduce an `ActiveSupport::Duration::Scalar` class as
a wrapper around a numeric value as a way of ensuring a duration
was the outcome of an expression. However the implementation was
missing support for modulo operations. This commit adds support
for those operations and should result in a duration being
returned from expressions involving them.

Fixes #29603 and #29743.
2017-07-28 14:06:53 +01:00
Andrew White
bfa878d3b2 Fix division where a duration is the denominator
PR #29163 introduced a change in behavior when a duration was
the denominator in a calculation - this was incorrect as dividing
by a duration should always return a `Numeric`. The behavior of
previous versions of Rails has been restored.

Fixes #29592.
2017-07-27 13:41:44 +01:00
Christina Thompson
65d592842a remove depreciated assertion to eliminate warning
Signed-off-by: Yuki Nishijima <yk.nishijima@gmail.com>
2017-07-24 16:48:58 -04:00
Kasper Timm Hansen
b5ba8d715a Merge pull request #29907 from deivid-rodriguez/fix_flaky_message_verifier_test
Fix test failure in message verifier tests
2017-07-24 12:49:29 +02:00
David Rodríguez
e9a631aca9 Fix test failure in message verifier tests
Without this, I get the following result on my machine

```
# Running:

F

Failure:
MessageVerifierTest#test_backward_compatibility_messages_signed_without_metadata [/home/deivid/Code/rails/activesupport/test/message_verifier_test.rb:91]:
--- expected
+++ actual
@@ -1 +1 @@
-{:some=>"data", :now=>2010-01-01 00:00:00 +0100}
+{:some=>"data", :now=>2010-01-01 00:00:00 +0000}

bin/test test/message_verifier_test.rb:89
```
2017-07-24 11:58:18 +02:00
Assain
db5e6912da add metadata tests: verify method 2017-07-24 14:57:24 +05:30
Kasper Timm Hansen
2ee46434e0
[ci skip] Remove superfluous paragraphs; fully qualify constants.
The paragraphs retread ground covered by the title and the usage examples,
so let's just remove them.

[ Assain Jaleel & Kasper Timm Hansen ]
2017-07-24 10:25:57 +02:00
Kasper Timm Hansen
e4bf6b05e2 Merge pull request #29892 from assain/documenation_for_metadata
Document metadata support for MessageEncryptor
2017-07-24 10:24:11 +02:00
Assain
97cd2df042 add to changelog: purpose and expiry support
[ci skip]
2017-07-24 13:45:34 +05:30
Assain
fbffd2bea5 document metadata support added to message encryptor and message verifier
[ci skip]
2017-07-24 13:21:42 +05:30
Rafael França
57a103c393 Merge pull request #29860 from georgeclaghorn/travel-back-automatically
Remove time stubs after each test
2017-07-24 01:01:25 -04:00
Kasper Timm Hansen
8ee9ace27b
Let Metadata instance handle purpose coercion.
[ Assain Jaleel & Kasper Timm Hansen ]
2017-07-23 12:31:41 +02:00
Kasper Timm Hansen
9fbfb4bffe
Remove dependency on from_now extension.
[ Assain Jaleel & Kasper Timm Hansen ]
2017-07-23 12:29:03 +02:00
George Claghorn
f51cf2e4b5 Remove time stubs after each test
Reverts 7abb6e0.
2017-07-22 10:56:26 -04:00
Assain
3bf3653a69 add metadata support to message verifier 2017-07-19 23:43:42 +05:30
Assain
3b506ee0d8 Add expires_at, expires_in, and purpose meta_data to messages. 2017-07-19 17:19:16 +05:30
Sean Griffin
a3d704bd11 Merge pull request #29757 from lugray/hash_with_indifferent_access_default
Fix HashWithIndifferentAccess#default when include?(nil)
2017-07-17 13:41:56 -05:00
Lisa Ugray
a218a35e66 Fix HashWithIndifferentAccess#default when include?(nil)
The implementation of HashWithIndifferentAccess#default didn't
distinguish `default` from `default(nil)`, which caused an incorrect
result for `default` if `nil` was used as a key.

Define HashWithIndifferentAccess#dig so that hackery that behaves
differently from Hash#default can be removed from
HashWithIndifferentAccess#default.
2017-07-17 14:37:53 -04:00
Sean Griffin
828b05f5f9 Merge pull request #29758 from glaucocustodio/patch-1 [ci skip]
Add documentation for class_attribute default option
2017-07-17 10:53:59 -04:00
Glauco Custódio
5fa6563f09 Add documentation for class_attribute options 2017-07-17 11:36:05 -03:00
Sean Griffin
404eceba8c Merge branch 'master' into make-reverse-merge-bang-order-consistent 2017-07-17 07:10:27 -06:00
Ryuta Kamizono
4183d5dfa1 Enable Layout/FirstParameterIndentation cop
We have some indentation cops. But now there is a little inconsistent
params indentations. Enable `Layout/FirstParameterIndentation` cop to
prevent newly inconsistent indentation added and auto-correct to
existing violations.
2017-07-17 14:08:32 +09:00
Xavier Noria
83f39a3bcf explain why require_relative is not used here [ci skip] 2017-07-16 17:55:58 +02:00
Koichi ITO
412156f00f Remove encoding utf-8 magic comment 2017-07-15 19:29:45 +09:00
yuuji.yaginuma
63197f2aa2 Fix doc format for ActiveSupport::Testing::TimeHelpers [ci skip] 2017-07-15 10:18:44 +09:00
George Claghorn
4816e823e7 Fix configuring third-party cache stores such as ActiveSupport::Cache::RedisStore
Broken in 8da30ad.
2017-07-12 09:25:03 -04:00
Koichi ITO
ac717d65a3 [Active Support] rubocop -a --only Layout/EmptyLineAfterMagicComment 2017-07-11 13:12:32 +09:00
Ryuta Kamizono
bfbae885b2 ✂️
[ci skip]
2017-07-11 06:49:05 +09:00
Kasper Timm Hansen
0d72489b2a * Don't eagerly require Rails' minitest plugin.
By making the Rails minitest behave like a standard minitest plugin
we're much more likely to not break when people use other minitest
plugins. Like minitest-focus and pride.

To do this, we need to behave like minitest: require files up front
and then perform the plugin behavior via the at_exit hook.
This also saves us a fair bit of wrangling with test file loading.

Finally, since the environment and warnings options have to be applied
as early as possible, and since minitest loads plugins at_exit, they
have to be moved to the test command.

* Don't expect the root method.

It's likely this worked because we eagerly loaded the Rails minitest plugin
and that somehow defined a root method on `Rails`.

* Assign a backtrace to failed exceptions.

Otherwise Minitest pukes when attempting to filter the backtrace (which
Rails' backtrace cleaner then removes).

Means the exception message test has to be revised too.

This is likely caused by the rails minitest plugin now being loaded for
these tests and assigning a default backtrace cleaner.
2017-07-10 20:40:16 +02:00
प्रथमेश Sonpatki
b6300f3ecc Added time helper method freeze_time which is an alias for travel_to Time.now (#29681) 2017-07-10 12:13:37 +02:00
Kasper Timm Hansen
85d154f052 Merge pull request #29730 from bdewater/update-encryptor-docs
Update MessageEncryptor example to use dynamic key length
2017-07-09 18:24:12 +02:00
Bart de Water
062283d9d3 [ci skip] update MessageEncryptor example to use the key length as returned by OpenSSL 2017-07-09 11:17:47 -04:00
Matthew Draper
8d98bb0cc6 Merge pull request #29728 from kirs/frozen-activesupport
Use frozen-string-literal in ActiveSupport
2017-07-09 22:58:40 +09:30
Kir Shatrov
72950568dd Use frozen-string-literal in ActiveSupport 2017-07-09 15:08:29 +03:00
Aaron Patterson
81492d8f91 Merge pull request #28668 from Dorian/mention-time-parse-argument-error
Mention Time.zone.parse possibly throwing ArgumentError
2017-07-05 10:57:07 -07:00
Ryuta Kamizono
6bb115a661 Fix warning: `*' interpreted as argument prefix
```
/Users/kamipo/src/github.com/rails/rails/activesupport/test/core_ext/module_test.rb:402: warning: `*' interpreted as argument prefix
/Users/kamipo/src/github.com/rails/rails/activesupport/test/core_ext/module_test.rb:420: warning: `*' interpreted as argument prefix
```
2017-07-06 00:16:19 +09:00
Matthew Draper
019238385c Merge pull request #29687 from k3rni/private-prefixed-delegate
Return prefixed method names from `Module.delegate`, if using prefixes
2017-07-06 00:26:16 +09:30
Krzysztof Zych
8eea74c965 Use map in delegate so that actual prefixed method names are returned, if using prefix version. 2017-07-05 15:38:54 +02:00
Xavier Noria
92c29d82eb Merge branch 'master' into require_relative_2017 2017-07-02 13:50:25 -07:00
Akira Matsuda
6642b112cd Expectation first 2017-07-02 23:11:20 +09:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Matthew Draper
3420a14590 Merge pull request #29540 from kirs/rubocop-frozen-string
Enforce frozen string in Rubocop
2017-07-02 01:11:50 +09:30
Matthew Draper
afb66a5a59 Merge pull request #29506 from pat/frozen-string-literals
Make ActiveSupport frozen-string-literal friendly.
2017-07-02 01:07:12 +09:30
Akira Matsuda
8da30ad6be [Active Support] require => require_relative 2017-07-01 18:38:04 +09:00
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Koichi ITO
43c8877c29 Fix the next version of Rails from 5.3 to 6.0 2017-06-30 00:48:03 +09:00
Rafael França
cf8c46938b Merge pull request #29588 from greysteil/add-gemspec-links
Add source code and changelog links to gemspecs
2017-06-28 11:24:02 -04:00