-
Notifications
You must be signed in to change notification settings - Fork 248
Add tests for #new and #create in CriteriaController when marks are r… #7521
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
Add tests for #new and #create in CriteriaController when marks are r… #7521
Conversation
Pull Request Test Coverage Report for Build 15124982480Details
💛 - Coveralls |
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.
@freyazjiner a good start. Here are a few general comments:
- You deleted the pull request template that pre-populated the description field when making the pull request, which you should not do. You can find the pull request template under the
.github
folder; please use it to update your pull request description, and make sure to read through it and use the checklist to guide other things you need to do when making a pull request. - The tests should be added to the existing tests for
#new
and#create
, rather than being created in a separate block. You can update just the context that involves "An authenticated and authorized instructor doing a GET". You'll need to figure out a good way to combine the setup required for these cases with the existing test cases.
adds Freya Zhang to the list
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.
@freyazjiner Good work! I just left a few minor comments.
Changelog.md
Outdated
@@ -12,6 +12,7 @@ | |||
|
|||
- Remove `activerecord-session_store` gem (#7517) | |||
- Upgrade to Rails 8 (#7504) | |||
- Tests added for #new and #create actions for CriteriaController (#7521) |
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.
For consistency with other entries, phrase this as "Add tests for..." (i.e., starting with a verb in the imperative tense).
Also use backticks to surround all code names (#new
, #create
, CriteriaController
).
params: { course_id: course.id, assignment_id: assignment.id }, | ||
format: :js | ||
end | ||
context 'assignment marks are not released' do |
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.
For context
blocks, the description should generally start with the word "when"
expect(flash[:error]).to have_message(I18n.t('criteria.errors.released_marks')) | ||
end | ||
|
||
it 'responds with appropriate status' do |
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.
Be more specific: responds with :bad_request status. Same comment below.
.github/PULL_REQUEST_TEMPLATE.md
Outdated
@@ -1,7 +1,7 @@ | |||
## 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](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword).)* | |||
|
|||
... | |||
Adds tests for the “marks released” edge-case to both `#new` (GET) and `#create` (POST). Each spec builds an assignment with released results, makes the corresponding request (`get_as` or `post_as`), and verifies that the controller flashes the correct error and returns `400 Bad Request`. |
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 think you accidentally committed changes to this file (you shouldn't change the template file itself, just make sure to fill it out on GitHub).
Changelog.md
Outdated
@@ -6,12 +6,14 @@ | |||
|
|||
### ✨ New features and improvements | |||
|
|||
|
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.
Revert this change
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.
sorry about that, done
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.
This line is still here (you may have reverted this change by accident). To be clear, I'm referring to the blank line that has been added; there should be just one blank line after the "New features and improvements" heading.
Changelog.md
Outdated
@@ -6,12 +6,14 @@ | |||
|
|||
### ✨ New features and improvements | |||
|
|||
|
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.
This line is still here (you may have reverted this change by accident). To be clear, I'm referring to the blank line that has been added; there should be just one blank line after the "New features and improvements" heading.
doc/markus-contributors.txt
Outdated
@@ -91,7 +92,7 @@ Horatiu Halmaghi | |||
Huiyu Sun | |||
Ian Smith | |||
Ibrahim Shahin | |||
Ido Ben Haim | |||
Igit revert HEADdo Ben Haim |
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.
This line contains an error. Please make sure to check your work carefully when making commits, using git diff
(and the GitHub pull request interface).
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.)
Adds tests for the “marks released” edge-case to both
#new
and#create
. The approach is first create an assignment with released results, makes the corresponding request (get_as
orpost_as
), and verifies that the controller returns a flash message with an error and an appropriate response code.Screenshots of your changes (if applicable)
Associated documentation repository pull request (if applicable)
Type of Change
(Write an
X
or 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.)
I split each controller action into two scenarios:
Github tests all pass for now.