Commit Graph

16 Commits

Author SHA1 Message Date
Nikita Vasilevsky 2a00c89a7d
Enable Lint/DuplicateMethods rubocop rule 2021-11-15 13:51:28 -05: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
Daniel Colson 94333a4c31 Use assert_predicate and assert_not_predicate 2018-01-25 23:32:59 -05: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 764bbb801e It would be safer not to totally undef core classes' respond_to_missing?
instead, rewrite them to no-op
2017-01-15 04:42:03 +09:00
Akira Matsuda b89316fed3 This test wasn't actually an effective regression test 2017-01-15 03:31:24 +09:00
Akira Matsuda d5fbb04fab AS::ArrayInquirer#respond_to_missing? should fallback to super
in case Array or any other ancestor class' respond_to_missing? was defined.
2017-01-15 02:44:03 +09: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
Leigh Halliday 7abbe137b7 ArrayInquirer to correctly find symbols or strings
The problem existed where if your ArrayInquirer values were
strings but you checked them using any? with a symbol, it would
not find the value. Now it will correctly check whether both
the String form or the Symbol form are included in the Array.

`
2015-08-28 16:20:02 -04:00
Rafael Mendonça França f9433ef260 Require the extensions to tests pass in isolation 2015-03-30 13:59:50 -03:00
Rafael Mendonça França b5c35023bd Revert "Remove Array#inquiry"
This reverts commit 9420de59f5.

Reason: Turns out we want to keep this method.
2015-03-30 13:38:13 -03:00
Rafael Mendonça França 9420de59f5 Remove Array#inquiry
We are promoting too much a feature that will not be widler used.
So for now lets keep just the ArrayInquirer constructor.
2015-03-27 16:25:13 -03:00
George Claghorn c64b99ecc9 Add ActiveSupport::ArrayInquirer and Array#inquiry
Wrapping an array in an `ArrayInquirer` gives a friendlier way to check its
string-like contents. For example, `request.variant` returns an `ArrayInquirer`
object. To check a request's variants, you can call:

    request.variant.phone?
    request.variant.any?(:phone, :tablet)

...instead of:

    request.variant.include?(:phone)
    request.variant.any? { |v| v.in?([:phone, :tablet]) }

`Array#inquiry` is a shortcut for wrapping the receiving array in an
`ArrayInquirer`:

    pets = [:cat, :dog]
    pets.cat?    # => true
    pets.ferret? # => false
    pets.any?(:cat, :ferret} # => true
2015-03-24 13:33:01 -05:00