Skip to content

Conversation

@tagliala
Copy link
Contributor

@tagliala tagliala commented Jan 4, 2026

Use real attributes and match attribute name when getting client side hash.

Since that attribute is only used to fetch a custom message, specs weren't failing before

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves test specifications by ensuring consistency between validator attribute declarations and their corresponding client_side_hash method calls. Previously, tests were using mismatched attributes (e.g., initializing validators with :name but calling methods with :age), which didn't cause failures because the attribute parameter was only used for fetching custom messages.

  • Replaced non-existent :name attributes with the actual :first_name attribute from the Person model
  • Aligned validator attribute parameters with the attribute passed to client_side_hash calls
  • Updated expected messages in confirmation validator tests to reflect the correct attribute name

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/active_model/cases/test_presence_validator.rb Changed :name to :first_name to match actual Person model attributes and ensure consistency between validator initialization and method calls
test/active_model/cases/test_length_validator.rb Corrected second parameter from :first_name to :age to match the validator's attribute configuration
test/active_model/cases/test_inclusion_validator.rb Changed :name to :first_name throughout to use actual Person model attributes
test/active_model/cases/test_format_validator.rb Changed :name to :first_name throughout to use actual Person model attributes
test/active_model/cases/test_exclusion_validator.rb Changed :name to :first_name throughout to use actual Person model attributes
test/active_model/cases/test_confirmation_validator.rb Changed :name to :first_name and updated expected messages from "Age" to "First name" to reflect the correct attribute being validated
test/active_model/cases/test_acceptance_validator.rb Changed :name to :first_name to use actual Person model attributes
test/active_model/cases/test_absence_validator.rb Changed :name to :first_name to use actual Person model attributes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tagliala tagliala force-pushed the chore/improve-specs branch from 07d8b3a to 4e6030f Compare January 4, 2026 12:05
@coveralls
Copy link

coveralls commented Jan 4, 2026

Coverage Status

coverage: 99.807%. remained the same
when pulling 4e6030f on chore/improve-specs
into cd590ad on main.

Use real attributes and match attribute name when getting client side
hash.

Since that attribute is only used to fetch a custom message, specs
weren't failing before

Additionally:
- Do not test Rails edge against 3.2, because it now requires >= 3.3
- Do not test Ruby edge against Rails < 8.0
@tagliala tagliala force-pushed the chore/improve-specs branch from 4e6030f to 3476ac5 Compare January 4, 2026 12:10
@tagliala tagliala merged commit f35f615 into main Jan 4, 2026
31 checks passed
@tagliala tagliala deleted the chore/improve-specs branch January 4, 2026 12:11
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 this pull request may close these issues.

3 participants