Added tests to fully cover graders_controller grader_criteria_mapping function#7949
Conversation
Coverage Report for CI Build 25972468581Coverage increased (+0.01%) to 91.789%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
| ### 🚨 Breaking changes | ||
|
|
||
| ### ✨ New features and improvements | ||
| - Added tests for `graders_controller` to fully cover `grader_criteria_mapping` function (#7949) |
There was a problem hiding this comment.
Move this to the "Internal Changes" section, as this section is intended for user-facing changes.
| end | ||
|
|
||
| it 'doing a GET on :grader_criteria_mapping' do | ||
| @ta1 = create(:ta, user: create(:end_user, user_name: 'g9browni')) |
There was a problem hiding this comment.
Rather than hard-code specific names here, you can write ta1 = create(:ta) and then below use ta1.user.user_name. This will help make the test expected values more explicitly connected to the underlying data.
The same is true for specifying criterion names.
Additionally, these don't need to be instance variables (indicated with the @ symbol). Instance variables are used within classes, and in Rails commonly to share data from a controller method in a corresponding view. For tests we can safely just use local variables (without the @).
… graders-controller-testcvrg
| criterion2.tas << ta1 | ||
| criterion3.tas << ta3 | ||
|
|
||
| [ta1.user.user_name, ta2.user.user_name].sort |
There was a problem hiding this comment.
This line of code is unnecessary
There was a problem hiding this comment.
Sorry, forgot to remove 😓
|
Not sure why the MarkUs Tests are failing/being skipped |
… graders-controller-testcvrg
bc45434 to
5fee454
Compare
david-yz-liu
left a comment
There was a problem hiding this comment.
Nice work, @mrafie1
Proposed Changes
(Describe your changes here. Also describe the motivation for your changes: what problem do they solve, or how do they improve the application or codebase? If this pull request fixes an open issue, use a keyword to link this pull request to the issue.)
grader_criteria_mappingfunction ingraders_controller_spec.rbGET: grader_criteria_mapping, and asserts that the response is200 OK, it has the correct media type, the correct filename, and the correct contents inside the CSV.doc/markus-contributors.txtScreenshots of your changes (if applicable)
Associated documentation repository pull request (if applicable)
Type of Change
(Write an
Xor a brief description next to the type or types that best describe your changes.)Checklist
(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the
[ ]into a[x]in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)Before opening your pull request:
After opening your pull request:
Questions and Comments
(Include any questions or comments you have regarding your changes.)