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

feat: Add validating qualifier to enum matcher #1630

Merged
merged 1 commit into from
May 17, 2024

Conversation

matsales28
Copy link
Collaborator

On this commit we add a new qualifier to the define_enum_for matcher called validating. This qualifier is used to test if the enum is being validated or not.

class Issue < ActiveRecord::Base
  enum status: [:open, :closed], validate: true
end

RSpec.describe Issue, type: :model do
  it do
    should define_enum_for(:status).
      validating
  end
end

@matsales28 matsales28 self-assigned this May 10, 2024
@matsales28 matsales28 requested a review from vsppedro as a code owner May 10, 2024 20:01
@matsales28 matsales28 force-pushed the feat-add-validating-qualifier-to-enum branch from c8823ad to 224f3b5 Compare May 10, 2024 21:39
On this commit we add a new qualifier to the `define_enum_for` matcher
called `validating`. This qualifier is used to test if the enum is being
validated or not.

```ruby
class Issue < ActiveRecord::Base
  enum status: [:open, :closed], validate: true
end

RSpec.describe Issue, type: :model do
  it do
    should define_enum_for(:status).
      validating
  end
end
```
@matsales28 matsales28 force-pushed the feat-add-validating-qualifier-to-enum branch from 224f3b5 to 9ed56e4 Compare May 10, 2024 21:42
@matsales28 matsales28 merged commit 3c88e1c into main May 17, 2024
16 checks passed
@matsales28 matsales28 deleted the feat-add-validating-qualifier-to-enum branch May 17, 2024 19:38
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.

None yet

2 participants