1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

22 commits

Author SHA1 Message Date
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
c81af6ae72 Enable Layout/EmptyLinesAroundAccessModifier cop
We sometimes say "✂️ newline after `private`" in a code review (e.g.
https://github.com/rails/rails/pull/18546#discussion_r23188776,
https://github.com/rails/rails/pull/34832#discussion_r244847195).

Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style
`EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059).

That cop and enforced style will reduce the our code review cost.
2019-06-13 12:00:45 +09:00
Ryuta Kamizono
8afdfdcfc9 Refactor ActiveSupport::Deprecation.deprecate_methods not to expose internal methods
In #33325, `deprecate_methods` is replaced from `prepend` to completely
emurated `alias_method_chain`, it exposed two internal methods
`xxx_with_deprecation` and `xxx_without_deprecation`.

After that, #34648 restored the `prepend` implementation, which doesn't
expose any internal methods, so we no longer be able to ensure to always
expose that internal methods.

As I said at https://github.com/rails/rails/pull/33325#issuecomment-409016725,
I think that internal methods exposed is not a specification but a
limitation when using `alias_method_chain`, there is no longer a reason
to follow that limitation.
2019-04-19 22:00:09 +09:00
Yosuke Kabuto
ccbdbca364 Test ActiveSupport::Deprecation.deprecate_methods
There was no test without an alternate method name is given.
2018-12-14 11:49:54 +09:00
Edouard CHIN
015477ae91 A regression in deprecate_methods was introduced in a982a42:
- Refactoring alias_chain to Module#prepend broke the possibility to deprecate class methods since the module
  generated was prepended to the target's instance.

  A suggestion to fix this was  to use `AS#redefine_method` which would solve the
  problem but with the cost of redefining directly the method.
  Decided to go with the same alias_chain implementation as before instead.

- Fixes #33253
2018-07-30 18:12:56 -04:00
Daniel Colson
a1ac18671a Replace assert ! with assert_not
This autocorrects the violations after adding a custom cop in
3305c78dcd.
2018-04-19 08:11:33 -04:00
Jordan Brough
9adaf605b4 Preserve original method visibility when deprecating a method
This commit fixes `deprecate` so that it preserves method visibility (like it
did previously when it was utilizing `alias_method_chain`).

When Module#prepend replaced alias_method_chain in a982a42 it caused deprecated
methods to always become public.

`alias_method_chain` had this bit of code:
https://github.com/rails/rails/blob/v5.0.6/activesupport/lib/active_support/core_ext/module/aliasing.rb#L40-L47
which preserved method visibility.

Without this fix, a workaround would be:

```ruby
class C8
  private

  def new_method
  end

  def old_method
  end
  deprecate :old_method, :new_method
  # workaround:
  instance_method(:old_method).owner.send(:private, :old_method)
end
```

Because the visibility needs to be fixed on the Module prepended by
MethodWrapper.
2017-12-13 13:18:03 -07: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
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
Brandon Dunne
6c98fbd9c3 Fix bug where custom deprecators are not used.
Add tests for ActiveSupport::Deprecation.deprecate_methods
Modify ActiveSupport::Testing::Deprecation to allow a custom deprecator
Leverage ActiveSupport::Testing::Deprecation assert_deprecated
Update documentation for ActiveSupport::Deprecation.deprecate_methods

Use cases:
Using the default deprecator => "removed from Rails X.Y"
Passing a custom deprecator in the options hash => "removed from MyGem next-release"
Deprecating methods directly from custom deprecator => "removed from MyGem next-release"
2015-10-14 07:49:39 -04:00
Carlos Antonio da Silva
cad3a13086 Remove deprecated AS::BasicObject, use AS::ProxyObject instead 2013-07-01 22:26:54 -03:00
Yves Senn
cfa35c55bb remove deprecated BufferedLogger. 2013-07-01 22:16:37 +02:00
Yves Senn
8787c6e0e5 deprecation warning when BufferedLogger is instantiated 2012-12-25 20:21:14 +01:00
Yves Senn
433ebbdc4c ActiveSupport::BufferedLogger can be subclassed 2012-12-25 15:50:35 +01:00
Pavel Pravosud
bb1d3c1f8e AS::BasicObject can be inherited from 2012-12-15 20:57:45 +07:00
Aaron Patterson
b8d8c50785 use AS::TestCase as the base class 2012-01-05 17:12:46 -08:00
Aaron Patterson
32844cbc02 fixing space errors 2010-07-26 09:58:35 -07:00
Leigh Caplan
37d82f2ca0 Test to ensure that falsy objects aren't wrapped by deprecation proxies 2010-07-26 09:53:42 -07:00