Description
When having two enums with the same string values in two different prefixes
will not be distinguished by with_prefix and the tests pass.
Reproduction Steps
class ContactSuggestion < ApplicationRecord
STATUSES = { pending: 'pending', denied: 'denied', agreed: 'agreed' }.freeze
enum :candidate_user_status, STATUSES, prefix: :user
enum :candidate_contact_status, STATUSES, prefix: :contact
end
describe 'validations' do
subject(:described_instance) { described_class.new }
it do
expect(described_instance).to define_enum_for(:candidate_user_status)
.with_values(agreed: 'agreed', pending: 'pending', denied: 'denied')
.with_prefix(:user)
end
it do
expect(described_instance).to define_enum_for(:candidate_contact_status)
.with_values(agreed: 'agreed', pending: 'pending', denied: 'denied')
.with_prefix(:user) # Wrong prefix here
end
end
Expected behavior
As a user I would expect and hint by a failing spec that points out that candidate_contact_status is not prefixed by :user
Actual behavior
The test passes with not harm or information.
System configuration
shoulda_matchers version: 6.4.0
rails version: 8.0.1
ruby version: 3.3.4
Description
When having two enums with the same string values in two different prefixes
will not be distinguished by
with_prefixand the tests pass.Reproduction Steps
Expected behavior
As a user I would expect and hint by a failing spec that points out that
candidate_contact_statusis not prefixed by:userActual behavior
The test passes with not harm or information.
System configuration
shoulda_matchers version:
6.4.0rails version:
8.0.1ruby version:
3.3.4