Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails/Validation does not cover validates_comparison_of #1295

Closed
ChaelCodes opened this issue Jun 13, 2024 · 0 comments · Fixed by #1297
Closed

Rails/Validation does not cover validates_comparison_of #1295

ChaelCodes opened this issue Jun 13, 2024 · 0 comments · Fixed by #1297

Comments

@ChaelCodes
Copy link
Contributor

Currently Rails/Validation does not cover the validation helper validates_comparison_of.

Expected behavior

For a model with the following validations:

  validates_presence_of :start_at, :end_at
  validates_comparison_of :end_at, greater_than: :start_at

Both validation helpers raise an error if Rails/Validation is Enabled.

Actual behavior

Only validates_presence_of triggers an error.

Steps to reproduce the problem

Add the old-style attribute validation macro for comparison to a model.

  validates_comparison_of :end_at, greater_than: :start_at

Run rubocop.

RuboCop version

$ bundle exec rubocop -V
1.57.1 (using Parser 3.2.2.4, rubocop-ast 1.29.0, running on ruby 3.2.2) [x86_64-linux-musl]
  - rubocop-capybara 2.19.0
  - rubocop-factory_bot 2.24.0
  - rubocop-rails 2.21.2
  - rubocop-rspec 2.24.1
ChaelCodes added a commit to ChaelCodes/rubocop-rails that referenced this issue Jun 13, 2024
Rails/Validations should include all old-style validation helpers,
including validates_comparison_of.
ChaelCodes added a commit to ChaelCodes/rubocop-rails that referenced this issue Jun 13, 2024
Rails/Validations should include all old-style validation helpers,
including validates_comparison_of.
ChaelCodes added a commit to ChaelCodes/rubocop-rails that referenced this issue Jun 19, 2024
Rails/Validation should include all old-style validation helpers,
including validates_comparison_of.
koic added a commit that referenced this issue Jun 21, 2024
…s-comparison

[Fix #1295] Covers validates_comparison_of in Rails/Validations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant