test: add error test cases for AnnotationCategory - #8177
Open
AngelsandDevsLOL wants to merge 3 commits into
Open
AngelsandDevsLOL wants to merge 3 commits into
AngelsandDevsLOL wants to merge 3 commits into
Conversation
…lid row to the database
Collaborator
Coverage Report for CI Build 35304980534Coverage increased (+0.006%) to 90.789%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
Adds two test cases for
AnnotationCategoryto cover an error when uploading a CSV in the method,add_by_row. It fails when an instructor tries to add anAnnotationCategoryto a course they don't teach. This occurs when theAnnotationTextvalidates the:courses_should_match, which returns false because thecreator_idof the text is in a different course than the course forannotation_category_id.This should let the
annotation_category.rbfolder achieve 100% coverage.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
Because the AnnotationCategory's
add_by_rowmethod calls the AnnotationText's validations, I wasn't sure if I should also be adding test cases for AnnotationText, as well as AnnotationCategory? Or if the test cases should go into AnnotationText instead.In RubyMine, the compiler is mentioning converting the current
rowarray into '%w' syntax. I didn't accept the change, but I was wondering if it was meant for readability and when you would use it.I'm confused about exactly what
:assignmentis. I keep seeing that it's a symbol, but it feels like it represents different things where sometimes it represents the Assignment model/object, other times it's used to define a new variable as inlet(:assignment) { create(:assignment) }, or used within other classes (belongs_to :assignment, ...). I've also seen the colon used before methods, such asvalidates :annotation_category_name, .., which is all really confusing. I'm wondering if there's a better way to understand what the 'symbol' is intuitively, or if it's something I'll eventually understand and learn along the way.I'm not sure what the difference between
describeandcontextis, since it seems to be used interchangeably.