-
Notifications
You must be signed in to change notification settings - Fork 75
Add validation for non-billable projects #1689
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
Conversation
app/models/timesheet_entry.rb
Outdated
|
||
def validate_billable_project | ||
if !project&.billable && bill_status == "unbilled" | ||
errors.add(:base, I18n.t(:errors)[:validate_billable_project]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use I18n.t("errors.validate_billable_project")
timesheet_entry = build(:timesheet_entry, bill_status: "unbilled") | ||
expect(timesheet_entry.valid?).to be_falsey | ||
expect(timesheet_entry.errors.messages[:base]).to include(error_message) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, add test cases for valid timesheet entries.
@nisusam Please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase
Notion
https://www.notion.so/saeloun/Bug-in-time-tracking-API-276920f24771433bb71695600d8aec2a