Skip to content

Minitest/AssertTruthy should not be enabled by default #313

@MatzFan

Description

@MatzFan

Is your feature request related to a problem? Please describe.

Yes. I commonly need to assert a test result is true, rather than a truthy value. The way to do this in Minitest is assert_equal true, foo.

Describe the solution you'd like

I disable this cop in every project and would simply like it disabled by default. Those that like it can enable it.

Describe alternatives you've considered

I guess I could ask @zenspider to add an assert_true and assert_false to Minitest..

Additional context

Minitest does not have an assert_true assertion, assert always passes on any truthy value. Therefore assert foo and assert_equal true, foo do different things - the latter is more specific. It was noted in #209 that this cop and RefuteFalse are not safe for autocorrect. Nagging a user who needs to test a value is exactly equal to true is not a matter of style, but of substance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions