Creates EmploymentDetail model#461
Conversation
Current Code Coverage Percent of this PR:88.13 %Files having coverage below 100%
|
rohitjoshixyz
left a comment
There was a problem hiding this comment.
@mohinid Added a few suggestions
| describe "validate comparisons" do | ||
| it "resignation date should be later than joining date" do | ||
| expect(employment_detail.resigned_at).to be > employment_detail.joined_at | ||
| end | ||
| end |
There was a problem hiding this comment.
What happens when either of them is nil? Add a spec for each
There was a problem hiding this comment.
Joined_at cannot be nill. I have validation added for the same. Will add test for nil resigned_at date.
spec/factories/employment_details.rb
Outdated
| joined_at { Faker::Date.between(from: "2020-01-01", to: "2021-01-01") } | ||
| resigned_at { Date.today } |
There was a problem hiding this comment.
This factory will always create a resigned employee by default.
Let's keep resigned_at nil by default
Co-authored-by: Rohit Joshi <[email protected]>
app/models/user.rb
Outdated
| has_many :identities, dependent: :delete_all | ||
| has_one_attached :avatar | ||
| rolify strict: true | ||
| has_one :employment_detail, dependent: :destroy |
There was a problem hiding this comment.
can you move this on line:62
There was a problem hiding this comment.
@mohinid I have got a couple of doubts related to this flow because, As per the Miru workflow the User can be part of multiple companies and the employee details vary with the position handled in each company. This EmploymentDetails model hasn't given an idea about the company which the employee is associated with. So we should add a scope for the company model.
Hi @akhilgkrishnan , let's discuss today. |
|
@akhilgkrishnan Good catch: we could associate the |
|
Removed User reference and added reference of company_user with employment_detail. @akhilgkrishnan @rohitjoshixyz |
akhilgkrishnan
left a comment
There was a problem hiding this comment.
LGTM. Thanks @mohinid for making the requested changes
* Creates EmploymentDetail model * Update spec/models/employment_detail_spec.rb Co-authored-by: Rohit Joshi <[email protected]> * update validation and test for nil resigned_at date * move employment_detail relation to line 62 in user.rb file * update reference of company_user with employment_detail Co-authored-by: Rohit Joshi <[email protected]> Co-authored-by: Akhil G Krishnan <[email protected]>
Notion card
https://www.notion.so/saeloun/Add-tables-for-personal-employment-Allocated-devices-compensation-71ef49d0c38e4242bd2998120141372d
Summary
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Added validations & RSpecs for User and EmploymentDetail models.
Checklist: