Skip to content

Added tests to fully cover graders_controller grader_criteria_mapping function#7949

Merged
david-yz-liu merged 7 commits into
MarkUsProject:masterfrom
mrafie1:graders-controller-testcvrg
May 17, 2026
Merged

Added tests to fully cover graders_controller grader_criteria_mapping function#7949
david-yz-liu merged 7 commits into
MarkUsProject:masterfrom
mrafie1:graders-controller-testcvrg

Conversation

@mrafie1
Copy link
Copy Markdown
Contributor

@mrafie1 mrafie1 commented May 13, 2026

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.)

  • Added unauthorized-access test under student context for the grader_criteria_mapping function in graders_controller_spec.rb
  • Added an instructor context test that creates and assigns 3 criteria and 3 TA's, sends GET: grader_criteria_mapping, and asserts that the response is 200 OK, it has the correct media type, the correct filename, and the correct contents inside the CSV.
  • Added my name to doc/markus-contributors.txt
  • Updated Changelog
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.)

Type Applies?
🚨 Breaking change (fix or feature that would cause existing functionality to change)
New feature (non-breaking change that adds functionality)
🐛 Bug fix (non-breaking change that fixes an issue)
🎨 User interface change (change to user interface; provide screenshots)
♻️ Refactoring (internal change to codebase, without changing functionality)
🚦 Test update (change that only adds or modifies tests) X
📦 Dependency update (change that updates a dependency)
🔧 Internal (change that only affects developers or continuous integration)

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:

  • I have performed a self-review of my changes.
    • Check that all changed files included in this pull request are intentional changes.
    • Check that all changes are relevant to the purpose of this pull request, as described above.
  • I have added tests for my changes, if applicable.
    • This is required for all bug fixes and new features.
  • I have updated the project documentation, if applicable.
    • This is required for new features.
  • If this is my first contribution, I have added myself to the list of contributors.

After opening your pull request:

  • I have updated the project Changelog (this is required for all changes).
  • I have verified that the pre-commit.ci checks have passed.
  • I have verified that the CI tests have passed.
  • I have reviewed the test coverage changes reported by Coveralls.
  • I have requested a review from a project maintainer.

Questions and Comments

(Include any questions or comments you have regarding your changes.)

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented May 13, 2026

Coverage Report for CI Build 25972468581

Coverage increased (+0.01%) to 91.789%

Details

  • Coverage increased (+0.01%) from the base build.
  • Patch coverage: 20 of 20 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 48999
Covered Lines: 45721
Line Coverage: 93.31%
Relevant Branches: 1870
Covered Branches: 971
Branch Coverage: 51.93%
Branches in Coverage %: Yes
Coverage Strength: 129.72 hits per line

💛 - Coveralls

@mrafie1 mrafie1 requested a review from david-yz-liu May 13, 2026 20:49
Comment thread Changelog.md Outdated
### 🚨 Breaking changes

### ✨ New features and improvements
- Added tests for `graders_controller` to fully cover `grader_criteria_mapping` function (#7949)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 @).

criterion2.tas << ta1
criterion3.tas << ta3

[ta1.user.user_name, ta2.user.user_name].sort
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line of code is unnecessary

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, forgot to remove 😓

@mrafie1
Copy link
Copy Markdown
Contributor Author

mrafie1 commented May 16, 2026

Not sure why the MarkUs Tests are failing/being skipped
Let me take a look at it.

@mrafie1 mrafie1 force-pushed the graders-controller-testcvrg branch from bc45434 to 5fee454 Compare May 16, 2026 17:01
Copy link
Copy Markdown
Collaborator

@david-yz-liu david-yz-liu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, @mrafie1

@david-yz-liu david-yz-liu merged commit 1068d94 into MarkUsProject:master May 17, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants