-
Notifications
You must be signed in to change notification settings - Fork 2
Course Credit Calculator #2118
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
base: main
Are you sure you want to change the base?
Course Credit Calculator #2118
Conversation
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.
Few little bits that would make this a little bit safer, but looking really good now
spec/factories/activities.rb
Outdated
@@ -11,6 +11,7 @@ | |||
always_on { false } | |||
retired { false } | |||
self_verification_info { nil } | |||
duration_in_hours { 2.5 } |
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.
I wonder if we should have this default to nil, as that currently the default behaviour we have on seeds, then maybe have a trait :with_duration?
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.
Just having a think about this. I need to test cs_accelerator cases with different durations (less than a day, more than one day).
Would it be cleaner to define the duration in hours when creating the activity for the individual test, rather than a trait? Otherwise I'd have to create multiple traits.
Eg. activity = create(:activity, programmes: [cs_accelerator_programme], duration_in_hours: 10)
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.
...and have the default to nil as suggested.
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.
Actually, ignore the above comments. I was repeating a lot of code when defining the duration on individual tests.
@@ -231,4 +231,65 @@ | |||
expect(activity.active_course?).to eq(false) | |||
end | |||
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.
We currently do not test that the credits are not changed if there is no duration in hours. As we use that as the primary criteria in the callback in the programme activity, would be good to test that behaviour
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.
I've added a test for this on line 246
|
Added additional testing
Added test for credit calculator to not change credits if there is no duration provided.
8e98ab5
to
6055b30
Compare
|
Status
Review progress:
What's changed?