<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sbansal6</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sbansal6"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Sbansal6"/>
	<updated>2026-05-19T04:06:30Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2242._Fix_teammate-review_view&amp;diff=144720</id>
		<title>CSC/ECE 517 Spring 2022 - E2242. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2242._Fix_teammate-review_view&amp;diff=144720"/>
		<updated>2022-04-11T22:28:34Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* Design Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
After the deadline to submit a project is crossed and the work is reviewed, both students and instructors can view teammate reviews.  Students view them from the heatgrid at the bottom of the “Your scores” page.  Instructors view them from “View scores”, then clicking on a particular team, then clicking on the Teammate Reviews tab. In both cases, a single heatgrid is shown. It is not clear if the heatgrid shows the reviews that the student has given to his/her teammates or the reviews that the student has received from his/her teammates?  &lt;br /&gt;
&lt;br /&gt;
For instructors, the problem is compounded. Instructors can choose from a list of students in the team, but there is no way to tell whether the heatgrid shows the reviews done by or done for the selected team member. Also, there's no checkbox/option for the instructor to allow/disallow students to check the reviews received from their teammates, for their contribution to the project.&lt;br /&gt;
&lt;br /&gt;
==Explanation of Feature==&lt;br /&gt;
&lt;br /&gt;
===Existing functionality of teammate-review view===&lt;br /&gt;
Used login details from factories.rb and logged in as an instructor and student to retrieve corresponding views. &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''1. Instructor's view of teammate review''': As we can see below, under the Teammate Reviews tab, the heatgrid for student 7185 doesn't clearly state if it is a review given by the student 7185 or is it the review score received by the student 7185.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:old_instructor.png|700px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''2. Student's view of teammate review''': As we can see below, the student's view of your scores doesn't show the teammate reviews. We need to implement the feature by invoking the pre-existing code for displaying a heatgrid, so that a student will be able to view the teammate reviews. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:old_student.jpg|700px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Changes to be made to teammate-review view===&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separate heat grids for each student. Both reviews by the student and reviews of the student’s contribution should be shown separately.&lt;br /&gt;
&lt;br /&gt;
2. Include a checkbox(Show teammate reviews?) on the edit assignment page, so that instructor can enable/disable visibility of heat grid to students.&lt;br /&gt;
&lt;br /&gt;
[[File:Show_teammate_reviews.png|700px]]&lt;br /&gt;
&lt;br /&gt;
3. In addition to the individual reviews, show a composite score derived from all reviews.  The code should invoke the pre-existing code for displaying a heat grid, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
4. The code must also be cognizant that the display may be in an anonymized view, where no names are to be shown, but only “Student nnn”, “Instructor mmm”, etc.&lt;br /&gt;
&lt;br /&gt;
=== Code changes ===&lt;br /&gt;
&lt;br /&gt;
The following files will be changed to fulfill the requirements&lt;br /&gt;
&lt;br /&gt;
'''Controllers''':&lt;br /&gt;
*app/controllers/grades_controller.rb&lt;br /&gt;
*app/helpers/grades_helper.rb&lt;br /&gt;
*app/controllers/assignments_controller.rb&lt;br /&gt;
&lt;br /&gt;
'''Models''':&lt;br /&gt;
*app/models/vm_question_response_score_cell.rb&lt;br /&gt;
*app/models/vm_question_response.rb &lt;br /&gt;
*app/models/assignment_form.rb&lt;br /&gt;
*app/models/assignment.rb&lt;br /&gt;
&lt;br /&gt;
'''Views''':&lt;br /&gt;
*app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
*app/views/grades/view_team.html.erb&lt;br /&gt;
*app/views/assignments/new.html.erb&lt;br /&gt;
&lt;br /&gt;
'''Rspec''':&lt;br /&gt;
*spec/controllers/grades_controller_spec.rb&lt;br /&gt;
*spec/helpers/grades_helper_spec.rb&lt;br /&gt;
*spec/models/assignment_spec.rb&lt;br /&gt;
*spec/models/assignment_form_spec.rb&lt;br /&gt;
*spec/features/assignment_creation_page_spec.rb&lt;br /&gt;
&lt;br /&gt;
'''Refactor Code to follow good coding practices''' &amp;lt;br&amp;gt;&lt;br /&gt;
Example:&amp;lt;br&amp;gt;&lt;br /&gt;
# Rename method names more meaningfully and intuitive.&lt;br /&gt;
# Add comments to the existing functions.&lt;br /&gt;
&lt;br /&gt;
===Use Case Diagram===&lt;br /&gt;
For the view_team page of Expertiza the actors are instructor and student. Use cases are to access view_team page and to view teammate reviews of all students in a team for the instructor. Whereas, the use case for student is to access view_team page and to view teammate reviews for themselves subject to the condition that the instructor allows it.  &lt;br /&gt;
&lt;br /&gt;
[[File:Use_case_diagram_teammate_review_view.png|700px]]&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
The task is to fix the teammate_review view and requires changes to be made to an existing view associated with the user interface of Expertaza. Though we will be following the DRY principle when making the changes, there is no design pattern itself present in the teammate_review view.&lt;br /&gt;
&lt;br /&gt;
==User Stories==&lt;br /&gt;
# As a student, I can view the reviews given to me by my teammates.&lt;br /&gt;
# As an instructor, I can view the reviews a student has given to their teammates.&lt;br /&gt;
# As an instructor, I can choose to view only one student's teammate reviews or to view all students' teammate reviews together.&lt;br /&gt;
# As an instructor, I can view the name of the reviewers for a student's reviews.&lt;br /&gt;
# As a student and a TA for another subject, I cannot view an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
=== Video Demonstration ===&lt;br /&gt;
''will be added for the final submission''&lt;br /&gt;
=== Testing Goals and Test Objects ===&lt;br /&gt;
&lt;br /&gt;
''Drawing from the project objectives:''&lt;br /&gt;
# Verify that reviews by the student and reviews of the student’s contribution are shown.&lt;br /&gt;
# Verify that instructor can uncheck the “Show teammate reviews?” checkbox to disallow students to see teammate reviews.&lt;br /&gt;
# Verify that instructor can check the “Show teammate reviews?” checkbox to allow students to see teammate reviews.&lt;br /&gt;
# Verify the composite score derived from all individual reviews in a heat grid.&lt;br /&gt;
# Ensure that no names of students or instructors are shown in the anonymized view.&lt;br /&gt;
# Increase the test coverage for grades controller by adding Rspec unit tests.&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
'''''Test cases provided here, will add RSpec code blocks for the final submission'''''&lt;br /&gt;
*Student Account or Instructor acting as a student&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Choose to view &amp;quot;Your scores&amp;quot;&lt;br /&gt;
 Given: the user is logged in as a student or instructor acting as a student&lt;br /&gt;
 And: “Show teammate reviews?” is allowed by instructor&lt;br /&gt;
  When: user clicks on &amp;quot;your scores&amp;quot; link in student task page&lt;br /&gt;
   Then: display heatgrids for student's contribution provided by student's team and heatgrid of peer reviews. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Instructor Account&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Choose to view &amp;quot;View scores&amp;quot;&lt;br /&gt;
 Given: the user is logged in as an instructor&lt;br /&gt;
  When: instructor clicks on &amp;quot;view scores&amp;quot; link&lt;br /&gt;
   Then: can view the reviews a student has given to their teammates without ambiguity&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Choose to view &amp;quot;View scores&amp;quot;&lt;br /&gt;
 Given: the user is logged in as an instructor&lt;br /&gt;
  When: instructor clicks on &amp;quot;view scores&amp;quot; link&lt;br /&gt;
   Then: can choose to view only one student's teammate reviews or to view all students' teammate reviews together.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Grades Controller Rspec to increase test coverage:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Currently the test coverage for grades controller [https://coveralls.io/builds/48139154/source?filename=app%2Fcontrollers%2Fgrades_controller.rb here] is 88.24% on beta branch. We will add testcases to increase the coverage further and also to test the additional functionality that we are going to add.&lt;br /&gt;
&lt;br /&gt;
==Github and Related Link==&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/sbansal1097/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
*Naman Shrimali (''nshrima'')&lt;br /&gt;
&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Rachana Kondabala(''rkondab'')&lt;br /&gt;
*Rahul Shukla (''rshukla3'')&lt;br /&gt;
*Shubham Bansal (''sbansal6'')&lt;br /&gt;
*Sravanth Reddy Bommana (''sbomman'')&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2242._Fix_teammate-review_view&amp;diff=144717</id>
		<title>CSC/ECE 517 Spring 2022 - E2242. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2242._Fix_teammate-review_view&amp;diff=144717"/>
		<updated>2022-04-11T22:17:58Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* Design Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
After the deadline to submit a project is crossed and the work is reviewed, both students and instructors can view teammate reviews.  Students view them from the heatgrid at the bottom of the “Your scores” page.  Instructors view them from “View scores”, then clicking on a particular team, then clicking on the Teammate Reviews tab. In both cases, a single heatgrid is shown. It is not clear if the heatgrid shows the reviews that the student has given to his/her teammates or the reviews that the student has received from his/her teammates?  &lt;br /&gt;
&lt;br /&gt;
For instructors, the problem is compounded. Instructors can choose from a list of students in the team, but there is no way to tell whether the heatgrid shows the reviews done by or done for the selected team member. Also, there's no checkbox/option for the instructor to allow/disallow students to check the reviews received from their teammates, for their contribution to the project.&lt;br /&gt;
&lt;br /&gt;
==Explanation of Feature==&lt;br /&gt;
&lt;br /&gt;
===Existing functionality of teammate-review view===&lt;br /&gt;
Used login details from factories.rb and logged in as an instructor and student to retrieve corresponding views. &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''1. Instructor's view of teammate review''': As we can see below, under the Teammate Reviews tab, the heatgrid for student 7185 doesn't clearly state if it is a review given by the student 7185 or is it the review score received by the student 7185.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:old_instructor.png|700px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''2. Student's view of teammate review''': As we can see below, the student's view of your scores doesn't show the teammate reviews. We need to implement the feature by invoking the pre-existing code for displaying a heatgrid, so that a student will be able to view the teammate reviews. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:old_student.jpg|700px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Changes to be made to teammate-review view===&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separate heat grids for each student. Both reviews by the student and reviews of the student’s contribution should be shown separately.&lt;br /&gt;
&lt;br /&gt;
2. Include a checkbox(Show teammate reviews?) on the edit assignment page, so that instructor can enable/disable visibility of heat grid to students.&lt;br /&gt;
&lt;br /&gt;
[[File:Show_teammate_reviews.png|700px]]&lt;br /&gt;
&lt;br /&gt;
3. In addition to the individual reviews, show a composite score derived from all reviews.  The code should invoke the pre-existing code for displaying a heat grid, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
4. The code must also be cognizant that the display may be in an anonymized view, where no names are to be shown, but only “Student nnn”, “Instructor mmm”, etc.&lt;br /&gt;
&lt;br /&gt;
=== Code changes ===&lt;br /&gt;
&lt;br /&gt;
The following files will be changed to fulfill the requirements&lt;br /&gt;
&lt;br /&gt;
'''Controllers''':&lt;br /&gt;
*app/controllers/grades_controller.rb&lt;br /&gt;
*app/helpers/grades_helper.rb&lt;br /&gt;
*app/controllers/assignments_controller.rb&lt;br /&gt;
&lt;br /&gt;
'''Models''':&lt;br /&gt;
*app/models/vm_question_response_score_cell.rb&lt;br /&gt;
*app/models/vm_question_response.rb &lt;br /&gt;
*app/models/assignment_form.rb&lt;br /&gt;
*app/models/assignment.rb&lt;br /&gt;
&lt;br /&gt;
'''Views''':&lt;br /&gt;
*app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
*app/views/grades/view_team.html.erb&lt;br /&gt;
*app/views/assignments/new.html.erb&lt;br /&gt;
&lt;br /&gt;
'''Rspec''':&lt;br /&gt;
*spec/controllers/grades_controller_spec.rb&lt;br /&gt;
*spec/helpers/grades_helper_spec.rb&lt;br /&gt;
*spec/models/assignment_spec.rb&lt;br /&gt;
*spec/models/assignment_form_spec.rb&lt;br /&gt;
*spec/features/assignment_creation_page_spec.rb&lt;br /&gt;
&lt;br /&gt;
'''Refactor Code to follow good coding practices''' &amp;lt;br&amp;gt;&lt;br /&gt;
Example:&amp;lt;br&amp;gt;&lt;br /&gt;
# Rename method names more meaningfully and intuitive.&lt;br /&gt;
# Add comments to the existing functions.&lt;br /&gt;
&lt;br /&gt;
===Use Case Diagram===&lt;br /&gt;
For the view_team page of Expertiza the actors are instructor and student. Use cases are to access view_team page and to view teammate reviews of all students in a team for the instructor. Whereas, the use case for student is to access view_team page and to view teammate reviews for themselves subject to the condition that the instructor allows it.  &lt;br /&gt;
&lt;br /&gt;
[[File:Use_case_diagram_teammate_review_view.png|700px]]&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
The task is to fix the teammate_review view and requires changes to be made to an existing view. Though we will be following the DRY principle when making the changes, there is no design pattern itself present in the teammate_review view.&lt;br /&gt;
&lt;br /&gt;
==User Stories==&lt;br /&gt;
# As a student, I can view the reviews given to me by my teammates.&lt;br /&gt;
# As an instructor, I can view the reviews a student has given to their teammates.&lt;br /&gt;
# As an instructor, I can choose to view only one student's teammate reviews or to view all students' teammate reviews together.&lt;br /&gt;
# As an instructor, I can view the name of the reviewers for a student's reviews.&lt;br /&gt;
# As a student and a TA for another subject, I cannot view an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
=== Video Demonstration ===&lt;br /&gt;
''will be added for the final submission''&lt;br /&gt;
=== Testing Goals and Test Objects ===&lt;br /&gt;
&lt;br /&gt;
''Drawing from the project objectives:''&lt;br /&gt;
# Verify that reviews by the student and reviews of the student’s contribution are shown.&lt;br /&gt;
# Verify that instructor can uncheck the “Show teammate reviews?” checkbox to disallow students to see teammate reviews.&lt;br /&gt;
# Verify that instructor can check the “Show teammate reviews?” checkbox to allow students to see teammate reviews.&lt;br /&gt;
# Verify the composite score derived from all individual reviews in a heat grid.&lt;br /&gt;
# Ensure that no names of students or instructors are shown in the anonymized view.&lt;br /&gt;
# Increase the test coverage for grades controller by adding Rspec unit tests.&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
'''''Test cases provided here, will add RSpec code blocks for the final submission'''''&lt;br /&gt;
*Student Account or Instructor acting as a student&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Choose to view &amp;quot;Your scores&amp;quot;&lt;br /&gt;
 Given: the user is logged in as a student or instructor acting as a student&lt;br /&gt;
 And: “Show teammate reviews?” is allowed by instructor&lt;br /&gt;
  When: user clicks on &amp;quot;your scores&amp;quot; link in student task page&lt;br /&gt;
   Then: display heatgrids for student's contribution provided by student's team and heatgrid of peer reviews. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Instructor Account&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Choose to view &amp;quot;View scores&amp;quot;&lt;br /&gt;
 Given: the user is logged in as an instructor&lt;br /&gt;
  When: instructor clicks on &amp;quot;view scores&amp;quot; link&lt;br /&gt;
   Then: can view the reviews a student has given to their teammates without ambiguity&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Choose to view &amp;quot;View scores&amp;quot;&lt;br /&gt;
 Given: the user is logged in as an instructor&lt;br /&gt;
  When: instructor clicks on &amp;quot;view scores&amp;quot; link&lt;br /&gt;
   Then: can choose to view only one student's teammate reviews or to view all students' teammate reviews together.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Grades Controller Rspec to increase test coverage:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Currently the test coverage for grades controller [https://coveralls.io/builds/48139154/source?filename=app%2Fcontrollers%2Fgrades_controller.rb here] is 88.24% on beta branch. We will add testcases to increase the coverage further and also to test the additional functionality that we are going to add.&lt;br /&gt;
&lt;br /&gt;
==Github and Related Link==&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/sbansal1097/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
*Naman Shrimali (''nshrima'')&lt;br /&gt;
&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Rachana Kondabala(''rkondab'')&lt;br /&gt;
*Rahul Shukla (''rshukla3'')&lt;br /&gt;
*Shubham Bansal (''sbansal6'')&lt;br /&gt;
*Sravanth Reddy Bommana (''sbomman'')&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2242._Fix_teammate-review_view&amp;diff=144716</id>
		<title>CSC/ECE 517 Spring 2022 - E2242. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2242._Fix_teammate-review_view&amp;diff=144716"/>
		<updated>2022-04-11T22:06:17Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* Use Case Diagram */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
After the deadline to submit a project is crossed and the work is reviewed, both students and instructors can view teammate reviews.  Students view them from the heatgrid at the bottom of the “Your scores” page.  Instructors view them from “View scores”, then clicking on a particular team, then clicking on the Teammate Reviews tab. In both cases, a single heatgrid is shown. It is not clear if the heatgrid shows the reviews that the student has given to his/her teammates or the reviews that the student has received from his/her teammates?  &lt;br /&gt;
&lt;br /&gt;
For instructors, the problem is compounded. Instructors can choose from a list of students in the team, but there is no way to tell whether the heatgrid shows the reviews done by or done for the selected team member. Also, there's no checkbox/option for the instructor to allow/disallow students to check the reviews received from their teammates, for their contribution to the project.&lt;br /&gt;
&lt;br /&gt;
==Explanation of Feature==&lt;br /&gt;
&lt;br /&gt;
===Existing functionality of teammate-review view===&lt;br /&gt;
Used login details from factories.rb and logged in as an instructor and student to retrieve corresponding views. &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''1. Instructor's view of teammate review''': As we can see below, under the Teammate Reviews tab, the heatgrid for student 7185 doesn't clearly state if it is a review given by the student 7185 or is it the review score received by the student 7185.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:old_instructor.png|700px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''2. Student's view of teammate review''': As we can see below, the student's view of your scores doesn't show the teammate reviews. We need to implement the feature by invoking the pre-existing code for displaying a heatgrid, so that a student will be able to view the teammate reviews. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:old_student.jpg|700px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Changes to be made to teammate-review view===&lt;br /&gt;
&lt;br /&gt;
1. Distinguish reviews done for a student by rendering separate heat grids for each student. Both reviews by the student and reviews of the student’s contribution should be shown separately.&lt;br /&gt;
&lt;br /&gt;
2. Include a checkbox(Show teammate reviews?) on the edit assignment page, so that instructor can enable/disable visibility of heat grid to students.&lt;br /&gt;
&lt;br /&gt;
[[File:Show_teammate_reviews.png|700px]]&lt;br /&gt;
&lt;br /&gt;
3. In addition to the individual reviews, show a composite score derived from all reviews.  The code should invoke the pre-existing code for displaying a heat grid, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
4. The code must also be cognizant that the display may be in an anonymized view, where no names are to be shown, but only “Student nnn”, “Instructor mmm”, etc.&lt;br /&gt;
&lt;br /&gt;
=== Code changes ===&lt;br /&gt;
&lt;br /&gt;
The following files will be changed to fulfill the requirements&lt;br /&gt;
&lt;br /&gt;
'''Controllers''':&lt;br /&gt;
*app/controllers/grades_controller.rb&lt;br /&gt;
*app/helpers/grades_helper.rb&lt;br /&gt;
*app/controllers/assignments_controller.rb&lt;br /&gt;
&lt;br /&gt;
'''Models''':&lt;br /&gt;
*app/models/vm_question_response_score_cell.rb&lt;br /&gt;
*app/models/vm_question_response.rb &lt;br /&gt;
*app/models/assignment_form.rb&lt;br /&gt;
*app/models/assignment.rb&lt;br /&gt;
&lt;br /&gt;
'''Views''':&lt;br /&gt;
*app/views/grades/_view_heatgrid.html.erb&lt;br /&gt;
*app/views/grades/view_team.html.erb&lt;br /&gt;
*app/views/assignments/new.html.erb&lt;br /&gt;
&lt;br /&gt;
'''Rspec''':&lt;br /&gt;
*spec/controllers/grades_controller_spec.rb&lt;br /&gt;
*spec/helpers/grades_helper_spec.rb&lt;br /&gt;
*spec/models/assignment_spec.rb&lt;br /&gt;
*spec/models/assignment_form_spec.rb&lt;br /&gt;
*spec/features/assignment_creation_page_spec.rb&lt;br /&gt;
&lt;br /&gt;
'''Refactor Code to follow good coding practices''' &amp;lt;br&amp;gt;&lt;br /&gt;
Example:&amp;lt;br&amp;gt;&lt;br /&gt;
# Rename method names more meaningfully and intuitive.&lt;br /&gt;
# Add comments to the existing functions.&lt;br /&gt;
&lt;br /&gt;
===Use Case Diagram===&lt;br /&gt;
For the view_team page of Expertiza the actors are instructor and student. Use cases are to access view_team page and to view teammate reviews of all students in a team for the instructor. Whereas, the use case for student is to access view_team page and to view teammate reviews for themselves subject to the condition that the instructor allows it.  &lt;br /&gt;
&lt;br /&gt;
[[File:Use_case_diagram_teammate_review_view.png|700px]]&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
We will be using Abstract Factory design pattern for our implementation.&lt;br /&gt;
&lt;br /&gt;
==User Stories==&lt;br /&gt;
# As a student, I can view the reviews given to me by my teammates.&lt;br /&gt;
# As an instructor, I can view the reviews a student has given to their teammates.&lt;br /&gt;
# As an instructor, I can choose to view only one student's teammate reviews or to view all students' teammate reviews together.&lt;br /&gt;
# As an instructor, I can view the name of the reviewers for a student's reviews.&lt;br /&gt;
# As a student and a TA for another subject, I cannot view an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
=== Video Demonstration ===&lt;br /&gt;
''will be added for the final submission''&lt;br /&gt;
=== Testing Goals and Test Objects ===&lt;br /&gt;
&lt;br /&gt;
''Drawing from the project objectives:''&lt;br /&gt;
# Verify that reviews by the student and reviews of the student’s contribution are shown.&lt;br /&gt;
# Verify that instructor can uncheck the “Show teammate reviews?” checkbox to disallow students to see teammate reviews.&lt;br /&gt;
# Verify that instructor can check the “Show teammate reviews?” checkbox to allow students to see teammate reviews.&lt;br /&gt;
# Verify the composite score derived from all individual reviews in a heat grid.&lt;br /&gt;
# Ensure that no names of students or instructors are shown in the anonymized view.&lt;br /&gt;
# Increase the test coverage for grades controller by adding Rspec unit tests.&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
'''''Test cases provided here, will add RSpec code blocks for the final submission'''''&lt;br /&gt;
*Student Account or Instructor acting as a student&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Choose to view &amp;quot;Your scores&amp;quot;&lt;br /&gt;
 Given: the user is logged in as a student or instructor acting as a student&lt;br /&gt;
 And: “Show teammate reviews?” is allowed by instructor&lt;br /&gt;
  When: user clicks on &amp;quot;your scores&amp;quot; link in student task page&lt;br /&gt;
   Then: display heatgrids for student's contribution provided by student's team and heatgrid of peer reviews. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Instructor Account&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Choose to view &amp;quot;View scores&amp;quot;&lt;br /&gt;
 Given: the user is logged in as an instructor&lt;br /&gt;
  When: instructor clicks on &amp;quot;view scores&amp;quot; link&lt;br /&gt;
   Then: can view the reviews a student has given to their teammates without ambiguity&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Choose to view &amp;quot;View scores&amp;quot;&lt;br /&gt;
 Given: the user is logged in as an instructor&lt;br /&gt;
  When: instructor clicks on &amp;quot;view scores&amp;quot; link&lt;br /&gt;
   Then: can choose to view only one student's teammate reviews or to view all students' teammate reviews together.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Grades Controller Rspec to increase test coverage:'''&amp;lt;br&amp;gt;&lt;br /&gt;
Currently the test coverage for grades controller [https://coveralls.io/builds/48139154/source?filename=app%2Fcontrollers%2Fgrades_controller.rb here] is 88.24% on beta branch. We will add testcases to increase the coverage further and also to test the additional functionality that we are going to add.&lt;br /&gt;
&lt;br /&gt;
==Github and Related Link==&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/sbansal1097/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
*Naman Shrimali (''nshrima'')&lt;br /&gt;
&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Rachana Kondabala(''rkondab'')&lt;br /&gt;
*Rahul Shukla (''rshukla3'')&lt;br /&gt;
*Shubham Bansal (''sbansal6'')&lt;br /&gt;
*Sravanth Reddy Bommana (''sbomman'')&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2242._Fix_teammate-review_view&amp;diff=144236</id>
		<title>CSC/ECE 517 Spring 2022 - E2242. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2242._Fix_teammate-review_view&amp;diff=144236"/>
		<updated>2022-04-06T04:05:05Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
After the deadline to submit a project is crossed and the work is reviewed, both students and instructors can view teammate reviews.  Students view them from the heatgrid at the bottom of the “Your scores” page.  Instructors view them from “View scores”, then clicking on a particular team, then clicking on the Teammate Reviews tab. In both cases a single heatgrid is shown. It is not clear if the heatgrid shows the reviews that the student has written of his/her teammates, or is the heatgrid for the reviews that the student has received from his/her teammates?  &lt;br /&gt;
&lt;br /&gt;
For instructors, the problem is compounded. Instructors can choose from a list of the students on the team, but they have no way to tell whether the heatgrid shows the reviews done by or done for the team member. Also there's no option for instructor to allow/disallow students to check their teammate reviews for their contribution to the project.&lt;br /&gt;
&lt;br /&gt;
==Explanation of Feature==&lt;br /&gt;
&lt;br /&gt;
===Existing functionality of teammate-review view===&lt;br /&gt;
Used login details from factories.rb and logged in as an instructor and student to retrieve corresponding views. &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''1. Instructor's view of teammate review''': As we can see below, under Teammate Reviews tab, the heatgrid for student 7185 doesn't clearly state if it is review done by the student 7185 or is it the review score received by the student 7185.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:old_instructor.png|700px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''2. Student's view of teammate review''': As we can see below, the student's view of your scores doesn't show the teammate reviews. We need to implement the feature by invoking the pre-existing code for displaying a heatgrid, so that a student will be able to view the teammate reviews. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:old_student.jpg|700px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Desired functionality of teammate-review view===&lt;br /&gt;
&lt;br /&gt;
1. Distinguishes reviews done for a student by rendering separate heat grids for each student. Both reviews by the student and reviews of the student’s contribution should be shown separately.&lt;br /&gt;
&lt;br /&gt;
2. Includes a checkbox(Show teammate reviews?) on the edit assignment page, so that instructor can enable/disable visibility of heat grid to students.&lt;br /&gt;
&lt;br /&gt;
3. In addition to the individual reviews, shows a composite score derived from all reviews.  The code should invoke the pre-existing code for displaying a heat grid, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
4. The code must also be cognizant that the display may be in an anonymized view, where no names are to be shown, but only “Student nnn”, “Instructor mmm”, etc.&lt;br /&gt;
&lt;br /&gt;
===Use Case Diagram===&lt;br /&gt;
[[File:Use_case_diagram_teammate_review_view.png|700px]]&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
We will be using Abstract Factory design pattern for our implementation.&lt;br /&gt;
&lt;br /&gt;
==User Stories==&lt;br /&gt;
# As a student, I can view the reviews given to me by my teammates.&lt;br /&gt;
# As an instructor, I can view the reviews a student has given to their teammates.&lt;br /&gt;
# As an instructor, I can choose to view only one student's teammate reviews or to view all students' teammate reviews together.&lt;br /&gt;
# As an instructor, I can view the name of the reviewers for a student's reviews.&lt;br /&gt;
# As a student and a TA for another subject, I cannot view an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
We plan to use RSpec and Capybara for unit and functional testing. We will do the UI testing manually.&lt;br /&gt;
&lt;br /&gt;
==Github and Related Link==&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/sbansal1097/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
'''Mentor:''' Naman Shrimali&lt;br /&gt;
* Rachana Kondabala (rkondab)&lt;br /&gt;
* Rahul Shukla (rshukla3)&lt;br /&gt;
* Shubham Bansal (sbansal6)&lt;br /&gt;
* Sravanth Reddy Bommana (sbomman)&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2242._Fix_teammate-review_view&amp;diff=144228</id>
		<title>CSC/ECE 517 Spring 2022 - E2242. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2242._Fix_teammate-review_view&amp;diff=144228"/>
		<updated>2022-04-06T04:03:00Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* User Stories */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
After the deadline to submit a project is crossed and the work is reviewed, both students and instructors can view teammate reviews.  Students view them from the heatgrid at the bottom of the “Your scores” page.  Instructors view them from “View scores”, then clicking on a particular team, then clicking on the Teammate Reviews tab. In both cases a single heatgrid is shown. It is not clear if the heatgrid shows the reviews that the student has written of his/her teammates, or is the heatgrid for the reviews that the student has received from his/her teammates?  &lt;br /&gt;
&lt;br /&gt;
For instructors, the problem is compounded. Instructors can choose from a list of the students on the team, but they have no way to tell whether the heatgrid shows the reviews done by or done for the team member. Also there's no option for instructor to allow/disallow students to check their teammate reviews for their contribution to the project.&lt;br /&gt;
&lt;br /&gt;
==Explanation of Feature==&lt;br /&gt;
&lt;br /&gt;
===Existing functionality of teammate-review view===&lt;br /&gt;
Used login details from factories.rb and logged in as an instructor and student to retrieve corresponding views. &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''1. Instructor's view of teammate review''': As we can see below, under Teammate Reviews tab, the heatgrid for student 7185 doesn't clearly state if it is review done by the student 7185 or is it the review score received by the student 7185.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:old_instructor.png|700px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''2. Student's view of teammate review''': As we can see below, the student's view of your scores doesn't show the teammate reviews. We need to implement the feature by invoking the pre-existing code for displaying a heatgrid, so that a student will be able to view the teammate reviews. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:old_student.jpg|700px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Desired functionality of teammate-review view===&lt;br /&gt;
&lt;br /&gt;
1. Distinguishes reviews done for a student by rendering separate heat grids for each student. Both reviews by the student and reviews of the student’s contribution should be shown separately.&lt;br /&gt;
&lt;br /&gt;
2. Includes a checkbox(Show teammate reviews?) on the edit assignment page, so that instructor can enable/disable visibility of heat grid to students.&lt;br /&gt;
&lt;br /&gt;
3. In addition to the individual reviews, shows a composite score derived from all reviews.  The code should invoke the pre-existing code for displaying a heat grid, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
4. The code must also be cognizant that the display may be in an anonymized view, where no names are to be shown, but only “Student nnn”, “Instructor mmm”, etc.&lt;br /&gt;
&lt;br /&gt;
===Use Case Diagram===&lt;br /&gt;
[[File:Use_case_diagram_teammate_review_view.png|700px]]&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
We will be using Abstract Factory design pattern for our implementation.&lt;br /&gt;
&lt;br /&gt;
==User Stories==&lt;br /&gt;
# As a student, I can view the reviews given to me by my teammates.&lt;br /&gt;
# As an instructor, I can view the reviews a student has given to their teammates.&lt;br /&gt;
# As an instructor, I can choose to view only one student's teammate reviews or to view all students' teammate reviews together.&lt;br /&gt;
# As an instructor, I can view the name of the reviewers for a student's reviews.&lt;br /&gt;
# As a student and a TA for another subject, I cannot view an instructor's view to the view_team page.&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
We will be using RSpec and Capybara for unit and functional testing. UI testing will be done manually.&lt;br /&gt;
&lt;br /&gt;
==Github and Related Link==&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/sbansal1097/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
'''Mentor:''' Naman Shrimali&lt;br /&gt;
* Rachana Kondabala (rkondab)&lt;br /&gt;
* Rahul Shukla (rshukla3)&lt;br /&gt;
* Shubham Bansal (sbansal6)&lt;br /&gt;
* Sravanth Reddy Bommana (sbomman)&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2242._Fix_teammate-review_view&amp;diff=144207</id>
		<title>CSC/ECE 517 Spring 2022 - E2242. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2242._Fix_teammate-review_view&amp;diff=144207"/>
		<updated>2022-04-06T03:48:43Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* Design Patterns */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
After the deadline to submit a project is crossed and the work is reviewed, both students and instructors can view teammate reviews.  Students view them from the heatgrid at the bottom of the “Your scores” page.  Instructors view them from “View scores”, then clicking on a particular team, then clicking on the Teammate Reviews tab. In both cases a single heatgrid is shown. It is not clear if the heatgrid shows the reviews that the student has written of his/her teammates, or is the heatgrid for the reviews that the student has received from his/her teammates?  &lt;br /&gt;
&lt;br /&gt;
For instructors, the problem is compounded. Instructors can choose from a list of the students on the team, but they have no way to tell whether the heatgrid shows the reviews done by or done for the team member. Also there's no option for instructor to allow/disallow students to check their teammate reviews for their contribution to the project.&lt;br /&gt;
&lt;br /&gt;
==Explanation of Feature==&lt;br /&gt;
&lt;br /&gt;
===Existing functionality of teammate-review view===&lt;br /&gt;
Used login details from factories.rb and logged in as an instructor and student to retrieve corresponding views. &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''1. Instructor's view of teammate review''': As we can see below, under Teammate Reviews tab, the heatgrid for student 7185 doesn't clearly state if it is review done by the student 7185 or is it the review score received by the student 7185.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:old_instructor.png|700px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
'''2. Student's view of teammate review''': As we can see below, the student's view of your scores doesn't show the teammate reviews. We need to implement the feature by invoking the pre-existing code for displaying a heatgrid, so that a student will be able to view the teammate reviews. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:old_student.jpg|700px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Desired functionality of teammate-review view===&lt;br /&gt;
&lt;br /&gt;
1. Distinguishes reviews done for a student by rendering separate heat grids for each student. Both reviews by the student and reviews of the student’s contribution should be shown separately.&lt;br /&gt;
&lt;br /&gt;
2. Includes a checkbox(Show teammate reviews?) on the edit assignment page, so that instructor can enable/disable visibility of heat grid to students.&lt;br /&gt;
&lt;br /&gt;
3. In addition to the individual reviews, shows a composite score derived from all reviews.  The code should invoke the pre-existing code for displaying a heat grid, so other kinds of heat grid views could use it.&lt;br /&gt;
&lt;br /&gt;
4. The code must also be cognizant that the display may be in an anonymized view, where no names are to be shown, but only “Student nnn”, “Instructor mmm”, etc.&lt;br /&gt;
&lt;br /&gt;
===Use Case Diagram===&lt;br /&gt;
[[File:Use_case_diagram_teammate_review_view.png|700px]]&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
We will be using Abstract Factory design pattern for our implementation.&lt;br /&gt;
&lt;br /&gt;
==User Stories==&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
We will be using RSpec and Capybara for unit and functional testing. UI testing will be done manually.&lt;br /&gt;
&lt;br /&gt;
==Github and Related Link==&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/sbansal1097/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
'''Mentor:''' Naman Shrimali&lt;br /&gt;
* Rachana Kondabala (rkondab)&lt;br /&gt;
* Rahul Shukla (rshukla3)&lt;br /&gt;
* Shubham Bansal (sbansal6)&lt;br /&gt;
* Sravanth Reddy Bommana (sbomman)&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2242._Fix_teammate-review_view&amp;diff=144066</id>
		<title>CSC/ECE 517 Spring 2022 - E2242. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2242._Fix_teammate-review_view&amp;diff=144066"/>
		<updated>2022-04-05T03:45:30Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
After the deadline to submit a project is crossed and the work is reviewed, both students and instructors can view teammate reviews.  Students view them from the heatgrid at the bottom of the “Your scores” page.  Instructors view them from “View scores”, then clicking on a particular team, then clicking on the Teammate Reviews tab. In both cases a single heatgrid is shown. It is not clear if the heatgrid shows the reviews that the student has written of his/her teammates, or is the heatgrid for the reviews that the student has received from his/her teammates?  &lt;br /&gt;
&lt;br /&gt;
For instructors, the problem is compounded. Instructors can choose from a list of the students on the team, but they have no way to tell whether the heatgrid shows the reviews done by or done for the team member. Also there's no option for instructor to allow/disallow students to check their teammate reviews for their contribution to the project.&lt;br /&gt;
&lt;br /&gt;
==Explanation of Feature==&lt;br /&gt;
&lt;br /&gt;
===Existing functionality of teammate-review view===&lt;br /&gt;
[[File:old_instructor.png|700px]]&lt;br /&gt;
&lt;br /&gt;
===Desired functionality of teammate-review view===&lt;br /&gt;
&lt;br /&gt;
===Use Case Diagram===&lt;br /&gt;
[[File:Use_case_diagram_teammate_review_view.png|700px]]&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
==User Stories==&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
We will be using RSpec and Capybara for unit and functional testing. UI testing will be done manually.&lt;br /&gt;
&lt;br /&gt;
==Github and Related Link==&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/sbansal1097/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
'''Mentor:''' Naman Shrimali&lt;br /&gt;
* Rachana Kondabala (rkondab)&lt;br /&gt;
* Rahul Shukla (rshukla3)&lt;br /&gt;
* Shubham Bansal (sbansal6)&lt;br /&gt;
* Sravanth Reddy Bommana (sbomman)&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Use_case_diagram_teammate_review_view.png&amp;diff=144065</id>
		<title>File:Use case diagram teammate review view.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Use_case_diagram_teammate_review_view.png&amp;diff=144065"/>
		<updated>2022-04-05T03:39:33Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2242._Fix_teammate-review_view&amp;diff=144060</id>
		<title>CSC/ECE 517 Spring 2022 - E2242. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2242._Fix_teammate-review_view&amp;diff=144060"/>
		<updated>2022-04-05T02:52:15Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
After the deadline to submit a project is crossed and the work is reviewed, both students and instructors can view teammate reviews.  Students view them from the heatgrid at the bottom of the “Your scores” page.  Instructors view them from “View scores”, then clicking on a particular team, then clicking on the Teammate Reviews tab. In both cases a single heatgrid is shown. It is not clear if the heatgrid shows the reviews that the student has written of his/her teammates, or is the heatgrid for the reviews that the student has received from his/her teammates?  &lt;br /&gt;
&lt;br /&gt;
For instructors, the problem is compounded. Instructors can choose from a list of the students on the team, but they have no way to tell whether the heatgrid shows the reviews done by or done for the team member. Also there's no option for instructor to allow/disallow students to check their teammate reviews for their contribution to the project.&lt;br /&gt;
&lt;br /&gt;
==Explanation of Feature==&lt;br /&gt;
&lt;br /&gt;
===Existing functionality of teammate-review view===&lt;br /&gt;
&lt;br /&gt;
===Desired functionality of teammate-review view===&lt;br /&gt;
&lt;br /&gt;
===Use Case Diagram===&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
==User Stories==&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
We will be using RSpec and Capybara for unit and functional testing. UI testing will be done manually.&lt;br /&gt;
&lt;br /&gt;
==Github and Related Link==&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/sbansal1097/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
'''Mentor:''' Naman Shrimali&lt;br /&gt;
* Rachana Kondabala (rkondab)&lt;br /&gt;
* Rahul Shukla (rshukla3)&lt;br /&gt;
* Shubham Bansal (sbansal6)&lt;br /&gt;
* Sravanth Reddy Bommana (sbomman)&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2242._Fix_teammate-review_view&amp;diff=144059</id>
		<title>CSC/ECE 517 Spring 2022 - E2242. Fix teammate-review view</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2242._Fix_teammate-review_view&amp;diff=144059"/>
		<updated>2022-04-05T02:39:53Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Explanation of Feature==&lt;br /&gt;
&lt;br /&gt;
===Existing functionality of teammate-review view===&lt;br /&gt;
&lt;br /&gt;
===Desired functionality of teammate-review view===&lt;br /&gt;
&lt;br /&gt;
===Use Case Diagram===&lt;br /&gt;
&lt;br /&gt;
==Design Patterns==&lt;br /&gt;
&lt;br /&gt;
==User Stories==&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
We will be using RSpec and Capybara for unit and functional testing. UI testing will be done manually.&lt;br /&gt;
&lt;br /&gt;
==Github and Related Link==&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/sbansal1097/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
'''Mentor:''' Naman Shrimali&lt;br /&gt;
* Rachana Kondabala (rkondab)&lt;br /&gt;
* Rahul Shukla (rshukla3)&lt;br /&gt;
* Shubham Bansal (sbansal6)&lt;br /&gt;
* Sravanth Reddy Bommana (sbomman)&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143440</id>
		<title>CSC/ECE 517 Spring 2022 - E2206: Testing for users controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143440"/>
		<updated>2022-03-22T00:44:28Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* Related Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2206: Testing for users_controller&amp;quot; is focused on adding unit tests for users_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* users_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/users_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
users_controller had 5 methods for which unit tests were missing as seen in this [https://coveralls.io/builds/46937123/source?filename=app/controllers/users_controller.rb coverall]. The RSpec unit tests added for these methods in the spec file 'users_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the current user. The action is passed in the params. In this case we are testing the action list_pending_requested.&lt;br /&gt;
We stub a student, an instructor and an admin, and we test if only the admin has the right to perform this action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#set_anonymized_view' do&lt;br /&gt;
    it 'admin list_pending_requested' do&lt;br /&gt;
      params = { action: 'list_pending_requested' }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(student7, student7.role.name, student7.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== auto_complete_for_user_name ===&lt;br /&gt;
For auto_complete_for_user_name method there is another method auto_complete_result being called in the controller. This method does not exist, and thus when auto_complete_for_user_name method is called, it raises ActionView::Template::Error. In the first test case, it is being checked if the correct error is being thrown. While, in the second test case the method is being called with a GET request and is expected to redirect us to the home page. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#auto_complete_for_user_name' do&lt;br /&gt;
    it 'checks if auto_complete returns actionview error' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      expect{controller.auto_complete_for_user_name}.to raise_error(ActionView::Template::Error)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks if get auto_complete redirects to test host' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      get :auto_complete_for_user_name, @params, session&lt;br /&gt;
      expect(response).to redirect_to(&amp;quot;http://test.host/&amp;quot;)&lt;br /&gt;
    end  &lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== destroy ===&lt;br /&gt;
This action is called in the process of deleting a user. When this action is successfully executed or user is successfully destroyed (when User is passed a valid value 'student1') a note alert is flashed, whereas in case user is not destroyed (when User is passed an invalid value 'nil') an error is flashed. Further, it is being tested that at the end in both cases it redirects to list action.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#destroy' do&lt;br /&gt;
    it 'check if user was successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:note]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was not successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:error]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if successful destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if error during destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== role ===&lt;br /&gt;
This method is private and returns the role of the user as per their role_id. In case role_id is nil a new role with name '(none)' is created and returned. We test if this function is successfully called through the edit action even when the user's role_id is nil, or, the template is successfully rendered for edit and no error is raised.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#edit' do  &lt;br /&gt;
    it 'checks if role renders through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      get :edit&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
	 &lt;br /&gt;
    it 'checks if role fails through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      expect{controller.edit}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;br /&gt;
This method is also private and needs to be tested through list action. The parameter paginate_options which decides the execution of statement we need to test is predefined in the paginate_list, and thus the required statement cannot be accessed or tested. So, we tested the other statements in the method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#list' do&lt;br /&gt;
    it 'checks that paginate_list does not fail with controller' do&lt;br /&gt;
      expect{controller.list}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with post' do&lt;br /&gt;
      post :list&lt;br /&gt;
      expect(response.status).to eq(200)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
The users_controller has been thoroughly tested in its present state. The auto_complete_result method in auto_complete_for_user_name method needs to be defined. Further, the paginate_list method needs to be refactored so that all statements in the method are accessible and may be tested.&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/Harshil-Shah99/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [https://drive.google.com/file/d/1rpMtT_sEtHmTHOUvq4Qw4lLyrpbVWU5Q/view?usp=sharing here].&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143330</id>
		<title>CSC/ECE 517 Spring 2022 - E2206: Testing for users controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143330"/>
		<updated>2022-03-21T23:07:26Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* Related Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2206: Testing for users_controller&amp;quot; is focused on adding unit tests for users_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* users_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/users_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
users_controller had 5 methods for which unit tests were missing as seen in this [https://coveralls.io/builds/46937123/source?filename=app/controllers/users_controller.rb coverall]. The RSpec unit tests added for these methods in the spec file 'users_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the current user. The action is passed in the params. In this case we are testing the action list_pending_requested.&lt;br /&gt;
We stub a student, an instructor and an admin, and we test if only the admin has the right to perform this action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#set_anonymized_view' do&lt;br /&gt;
    it 'admin list_pending_requested' do&lt;br /&gt;
      params = { action: 'list_pending_requested' }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(student7, student7.role.name, student7.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== auto_complete_for_user_name ===&lt;br /&gt;
For auto_complete_for_user_name method there is another method auto_complete_result being called in the controller. This method does not exist, and thus when auto_complete_for_user_name method is called, it raises ActionView::Template::Error. In the first test case, it is being checked if the correct error is being thrown. While, in the second test case the method is being called with a GET request and is expected to redirect us to the home page. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#auto_complete_for_user_name' do&lt;br /&gt;
    it 'checks if auto_complete returns actionview error' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      expect{controller.auto_complete_for_user_name}.to raise_error(ActionView::Template::Error)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks if get auto_complete redirects to test host' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      get :auto_complete_for_user_name, @params, session&lt;br /&gt;
      expect(response).to redirect_to(&amp;quot;http://test.host/&amp;quot;)&lt;br /&gt;
    end  &lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== destroy ===&lt;br /&gt;
This action is called in the process of deleting a user. When this action is successfully executed or user is successfully destroyed (when User is passed a valid value 'student1') a note alert is flashed, whereas in case user is not destroyed (when User is passed an invalid value 'nil') an error is flashed. Further, it is being tested that at the end in both cases it redirects to list action.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#destroy' do&lt;br /&gt;
    it 'check if user was successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:note]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was not successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:error]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if successful destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if error during destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== role ===&lt;br /&gt;
This method is private and returns the role of the user as per their role_id. In case role_id is nil a new role with name '(none)' is created and returned. We test if this function is successfully called through the edit action even when the user's role_id is nil, or, the template is successfully rendered for edit and no error is raised.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#edit' do  &lt;br /&gt;
    it 'checks if role renders through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      get :edit&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
	 &lt;br /&gt;
    it 'checks if role fails through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      expect{controller.edit}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;br /&gt;
This method is also private and needs to be tested through list action. The parameter paginate_options which decides the execution of statement we need to test is predefined in the paginate_list, and thus the required statement cannot be accessed or tested. So, we tested the other statements in the method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#list' do&lt;br /&gt;
    it 'checks that paginate_list does not fail with controller' do&lt;br /&gt;
      expect{controller.list}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with post' do&lt;br /&gt;
      post :list&lt;br /&gt;
      expect(response.status).to eq(200)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
The users_controller has been thoroughly tested in its present state. The auto_complete_result method in auto_complete_for_user_name method needs to be defined. Further, the paginate_list method needs to be refactored so that all statements in the method are accessible and may be tested.&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/Harshil-Shah99/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [https://youtu.be/4D6lbtE1N5o here].&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143325</id>
		<title>CSC/ECE 517 Spring 2022 - E2206: Testing for users controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143325"/>
		<updated>2022-03-21T23:03:29Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2206: Testing for users_controller&amp;quot; is focused on adding unit tests for users_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* users_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/users_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
users_controller had 5 methods for which unit tests were missing as seen in this [https://coveralls.io/builds/46937123/source?filename=app/controllers/users_controller.rb coverall]. The RSpec unit tests added for these methods in the spec file 'users_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the current user. The action is passed in the params. In this case we are testing the action list_pending_requested.&lt;br /&gt;
We stub a student, an instructor and an admin, and we test if only the admin has the right to perform this action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#set_anonymized_view' do&lt;br /&gt;
    it 'admin list_pending_requested' do&lt;br /&gt;
      params = { action: 'list_pending_requested' }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(student7, student7.role.name, student7.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== auto_complete_for_user_name ===&lt;br /&gt;
For auto_complete_for_user_name method there is another method auto_complete_result being called in the controller. This method does not exist, and thus when auto_complete_for_user_name method is called, it raises ActionView::Template::Error. In the first test case, it is being checked if the correct error is being thrown. While, in the second test case the method is being called with a GET request and is expected to redirect us to the home page. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#auto_complete_for_user_name' do&lt;br /&gt;
    it 'checks if auto_complete returns actionview error' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      expect{controller.auto_complete_for_user_name}.to raise_error(ActionView::Template::Error)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks if get auto_complete redirects to test host' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      get :auto_complete_for_user_name, @params, session&lt;br /&gt;
      expect(response).to redirect_to(&amp;quot;http://test.host/&amp;quot;)&lt;br /&gt;
    end  &lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== destroy ===&lt;br /&gt;
This action is called in the process of deleting a user. When this action is successfully executed or user is successfully destroyed (when User is passed a valid value 'student1') a note alert is flashed, whereas in case user is not destroyed (when User is passed an invalid value 'nil') an error is flashed. Further, it is being tested that at the end in both cases it redirects to list action.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#destroy' do&lt;br /&gt;
    it 'check if user was successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:note]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was not successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:error]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if successful destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if error during destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== role ===&lt;br /&gt;
This method is private and returns the role of the user as per their role_id. In case role_id is nil a new role with name '(none)' is created and returned. We test if this function is successfully called through the edit action even when the user's role_id is nil, or, the template is successfully rendered for edit and no error is raised.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#edit' do  &lt;br /&gt;
    it 'checks if role renders through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      get :edit&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
	 &lt;br /&gt;
    it 'checks if role fails through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      expect{controller.edit}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;br /&gt;
This method is also private and needs to be tested through list action. The parameter paginate_options which decides the execution of statement we need to test is predefined in the paginate_list, and thus the required statement cannot be accessed or tested. So, we tested the other statements in the method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#list' do&lt;br /&gt;
    it 'checks that paginate_list does not fail with controller' do&lt;br /&gt;
      expect{controller.list}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with post' do&lt;br /&gt;
      post :list&lt;br /&gt;
      expect(response.status).to eq(200)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
The users_controller has been thoroughly tested in its present state. The auto_complete_result method in auto_complete_for_user_name method needs to be defined. Further, the paginate_list method needs to be refactored so that all statements in the method are accessible and may be tested.&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143309</id>
		<title>CSC/ECE 517 Spring 2022 - E2206: Testing for users controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143309"/>
		<updated>2022-03-21T22:47:52Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2206: Testing for users_controller&amp;quot; is focused on adding unit tests for users_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* users_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/users_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
users_controller had 5 methods for which unit tests were missing as seen in this [https://coveralls.io/builds/46937123/source?filename=app/controllers/users_controller.rb coverall]. The RSpec unit tests added for these methods in the spec file 'users_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the current user. The action is passed in the params. In this case we are testing the action list_pending_requested.&lt;br /&gt;
We stub a student, an instructor and an admin, and we test if only the admin has the right to perform this action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#set_anonymized_view' do&lt;br /&gt;
    it 'admin list_pending_requested' do&lt;br /&gt;
      params = { action: 'list_pending_requested' }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(student7, student7.role.name, student7.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== auto_complete_for_user_name ===&lt;br /&gt;
For auto_complete_for_user_name method there is another method auto_complete_result being called in the controller. This method does not exist, and thus when auto_complete_for_user_name method is called, it raises ActionView::Template::Error. In the first test case, it is being checked if the correct error is being thrown. While, in the second test case the method is being called with a GET request and is expected to redirect us to the home page. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#auto_complete_for_user_name' do&lt;br /&gt;
    it 'checks if auto_complete returns actionview error' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      expect{controller.auto_complete_for_user_name}.to raise_error(ActionView::Template::Error)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks if get auto_complete redirects to test host' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      get :auto_complete_for_user_name, @params, session&lt;br /&gt;
      expect(response).to redirect_to(&amp;quot;http://test.host/&amp;quot;)&lt;br /&gt;
    end  &lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== destroy ===&lt;br /&gt;
This action is called in the process of deleting a user. When this action is successfully executed or user is successfully destroyed (when User is passed a valid value 'student1') a note alert is flashed, whereas in case user is not destroyed (when User is passed an invalid value 'nil') an error is flashed. Further, it is being tested that at the end in both cases it redirects to list action.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#destroy' do&lt;br /&gt;
    it 'check if user was successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:note]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was not successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:error]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if successful destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if error during destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== role ===&lt;br /&gt;
This method is private and returns the role of the user as per their role_id. In case role_id is nil a new role with name '(none)' is created and returned. We test if this function is successfully called through the edit action even when the user's role_id is nil, or, the template is successfully rendered for edit and no error is raised.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#edit' do  &lt;br /&gt;
    it 'checks if role renders through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      get :edit&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
	 &lt;br /&gt;
    it 'checks if role fails through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      expect{controller.edit}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;br /&gt;
This method is also private and needs to be tested through list action. The parameter paginate_options which decides the execution of statement we need to test is predefined in the paginate_list, and thus the required statement cannot be accessed or tested. So, we tested the other statements in the method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#list' do&lt;br /&gt;
    it 'checks that paginate_list does not fail with controller' do&lt;br /&gt;
      expect{controller.list}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with post' do&lt;br /&gt;
      post :list&lt;br /&gt;
      expect(response.status).to eq(200)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143303</id>
		<title>CSC/ECE 517 Spring 2022 - E2206: Testing for users controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143303"/>
		<updated>2022-03-21T22:42:35Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* paginate_list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2206: Testing for users_controller&amp;quot; is focused on adding unit tests for users_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* users_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/users_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
users_controller had 5 methods for which unit tests were missing as seen in this [https://coveralls.io/builds/46937123/source?filename=app/controllers/users_controller.rb coverall]. The RSpec unit tests added for these methods in the spec file 'users_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the current user. The action is passed in the params. In this case we are testing the action list_pending_requested.&lt;br /&gt;
We stub a student, an instructor and an admin, and we test if only the admin has the right to perform this action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#set_anonymized_view' do&lt;br /&gt;
    it 'admin list_pending_requested' do&lt;br /&gt;
      params = { action: 'list_pending_requested' }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(student7, student7.role.name, student7.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== auto_complete_for_user_name ===&lt;br /&gt;
For auto_complete_for_user_name method there is another method auto_complete_result being called in the controller. This method does not exist, and thus when auto_complete_for_user_name method is called, it raises ActionView::Template::Error. In the first test case, it is being checked if the correct error is being thrown. While, in the second test case the method is being called with a GET request and is expected to redirect us to the home page. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#auto_complete_for_user_name' do&lt;br /&gt;
    it 'checks if auto_complete returns actionview error' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      expect{controller.auto_complete_for_user_name}.to raise_error(ActionView::Template::Error)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks if get auto_complete redirects to test host' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      get :auto_complete_for_user_name, @params, session&lt;br /&gt;
      expect(response).to redirect_to(&amp;quot;http://test.host/&amp;quot;)&lt;br /&gt;
    end  &lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== destroy ===&lt;br /&gt;
This action is called in the process of deleting a user. When this action is successfully executed or user is successfully destroyed (when User is passed a valid value 'student1') a note alert is flashed, whereas in case user is not destroyed (when User is passed an invalid value 'nil') an error is flashed. Further, it is being tested that at the end in both cases it redirects to list action.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#destroy' do&lt;br /&gt;
    it 'check if user was successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:note]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was not successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:error]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if successful destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if error during destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== role ===&lt;br /&gt;
This method is private and returns the role of the user as per their role_id. In case role_id is nil a new role with name '(none)' is created and returned. We test if this function is successfully called through the edit action even when the user's role_id is nil, or, the template is successfully rendered for edit and no error is raised.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#edit' do  &lt;br /&gt;
    it 'checks if role renders through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      get :edit&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
	 &lt;br /&gt;
    it 'checks if role fails through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      expect{controller.edit}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;br /&gt;
This method is also private and needs to be tested through list action. The parameter paginate_options which decides the execution of statement we need to test is predefined in the paginate_list, and thus the required statement cannot be accessed or tested. So, we tested the other statements in the method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#list' do&lt;br /&gt;
    it 'checks that paginate_list does not fail with controller' do&lt;br /&gt;
      expect{controller.list}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with post' do&lt;br /&gt;
      post :list&lt;br /&gt;
      expect(response.status).to eq(200)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143302</id>
		<title>CSC/ECE 517 Spring 2022 - E2206: Testing for users controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143302"/>
		<updated>2022-03-21T22:42:23Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* paginate_list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2206: Testing for users_controller&amp;quot; is focused on adding unit tests for users_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* users_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/users_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
users_controller had 5 methods for which unit tests were missing as seen in this [https://coveralls.io/builds/46937123/source?filename=app/controllers/users_controller.rb coverall]. The RSpec unit tests added for these methods in the spec file 'users_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the current user. The action is passed in the params. In this case we are testing the action list_pending_requested.&lt;br /&gt;
We stub a student, an instructor and an admin, and we test if only the admin has the right to perform this action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#set_anonymized_view' do&lt;br /&gt;
    it 'admin list_pending_requested' do&lt;br /&gt;
      params = { action: 'list_pending_requested' }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(student7, student7.role.name, student7.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== auto_complete_for_user_name ===&lt;br /&gt;
For auto_complete_for_user_name method there is another method auto_complete_result being called in the controller. This method does not exist, and thus when auto_complete_for_user_name method is called, it raises ActionView::Template::Error. In the first test case, it is being checked if the correct error is being thrown. While, in the second test case the method is being called with a GET request and is expected to redirect us to the home page. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#auto_complete_for_user_name' do&lt;br /&gt;
    it 'checks if auto_complete returns actionview error' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      expect{controller.auto_complete_for_user_name}.to raise_error(ActionView::Template::Error)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks if get auto_complete redirects to test host' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      get :auto_complete_for_user_name, @params, session&lt;br /&gt;
      expect(response).to redirect_to(&amp;quot;http://test.host/&amp;quot;)&lt;br /&gt;
    end  &lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== destroy ===&lt;br /&gt;
This action is called in the process of deleting a user. When this action is successfully executed or user is successfully destroyed (when User is passed a valid value 'student1') a note alert is flashed, whereas in case user is not destroyed (when User is passed an invalid value 'nil') an error is flashed. Further, it is being tested that at the end in both cases it redirects to list action.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#destroy' do&lt;br /&gt;
    it 'check if user was successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:note]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was not successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:error]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if successful destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if error during destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== role ===&lt;br /&gt;
This method is private and returns the role of the user as per their role_id. In case role_id is nil a new role with name '(none)' is created and returned. We test if this function is successfully called through the edit action even when the user's role_id is nil, or, the template is successfully rendered for edit and no error is raised.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#edit' do  &lt;br /&gt;
    it 'checks if role renders through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      get :edit&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
	 &lt;br /&gt;
    it 'checks if role fails through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      expect{controller.edit}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;br /&gt;
This method is also private and needs to be tested through list action. The parameter paginate_options which decides the execution of statement we need to test is predefined in the paginate_list, and thus the required statement cannot be accessed or tested.So, we tested the other statements in the method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#list' do&lt;br /&gt;
    it 'checks that paginate_list does not fail with controller' do&lt;br /&gt;
      expect{controller.list}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with post' do&lt;br /&gt;
      post :list&lt;br /&gt;
      expect(response.status).to eq(200)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143248</id>
		<title>CSC/ECE 517 Spring 2022 - E2206: Testing for users controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143248"/>
		<updated>2022-03-21T21:54:33Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2206: Testing for users_controller&amp;quot; is focused on adding unit tests for users_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* users_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/users_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
users_controller had 5 methods for which unit tests were missing as seen in this [https://coveralls.io/builds/46937123/source?filename=app/controllers/users_controller.rb coverall]. The RSpec unit tests added for these methods in the spec file 'users_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the current user. The action is passed in the params. In this case we are testing the action list_pending_requested.&lt;br /&gt;
We stub a student, an instructor and an admin, and we test if only the admin has the right to perform this action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#set_anonymized_view' do&lt;br /&gt;
    it 'admin list_pending_requested' do&lt;br /&gt;
      params = { action: 'list_pending_requested' }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(student7, student7.role.name, student7.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== auto_complete_for_user_name ===&lt;br /&gt;
For auto_complete_for_user_name method there is another method auto_complete_result being called in the controller. This method does not exist, and thus when auto_complete_for_user_name method is called, it raises ActionView::Template::Error. In the first test case, it is being checked if the correct error is being thrown. While, in the second test case the method is being called with a GET request and is expected to redirect us to the home page. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#auto_complete_for_user_name' do&lt;br /&gt;
    it 'checks if auto_complete returns actionview error' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      expect{controller.auto_complete_for_user_name}.to raise_error(ActionView::Template::Error)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks if get auto_complete redirects to test host' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      get :auto_complete_for_user_name, @params, session&lt;br /&gt;
      expect(response).to redirect_to(&amp;quot;http://test.host/&amp;quot;)&lt;br /&gt;
    end  &lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== destroy ===&lt;br /&gt;
This action is called in the process of deleting a user. When this action is successfully executed or user is successfully destroyed (when User is passed a valid value 'student1') a note alert is flashed, whereas in case user is not destroyed (when User is passed an invalid value 'nil') an error is flashed. Further, it is being tested that at the end in both cases it redirects to list action.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#destroy' do&lt;br /&gt;
    it 'check if user was successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:note]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was not successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:error]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if successful destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if error during destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== role ===&lt;br /&gt;
This method is private and returns the role of the user as per their role_id. In case role_id is nil a new role with name '(none)' is created and returned. We test if this function is successfully called through the edit action even when the user's role_id is nil, or, the template is successfully rendered for edit and no error is raised.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#edit' do  &lt;br /&gt;
    it 'checks if role renders through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      get :edit&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
	 &lt;br /&gt;
    it 'checks if role fails through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      expect{controller.edit}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#list' do&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with controller' do&lt;br /&gt;
      expect{controller.list}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with post' do&lt;br /&gt;
      post :list&lt;br /&gt;
      expect(response.status).to eq(200)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143246</id>
		<title>CSC/ECE 517 Spring 2022 - E2206: Testing for users controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143246"/>
		<updated>2022-03-21T21:50:15Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* role */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2206: Testing for users_controller&amp;quot; is focused on adding unit tests for users_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* users_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/users_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
users_controller had 5 methods for which unit tests were missing. The RSpec unit tests added for these methods in the spec file 'users_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the current user. The action is passed in the params. In this case we are testing the action list_pending_requested.&lt;br /&gt;
We stub a student, an instructor and an admin, and we test if only the admin has the right to perform this action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#set_anonymized_view' do&lt;br /&gt;
    it 'admin list_pending_requested' do&lt;br /&gt;
      params = { action: 'list_pending_requested' }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(student7, student7.role.name, student7.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== auto_complete_for_user_name ===&lt;br /&gt;
For auto_complete_for_user_name method there is another method auto_complete_result being called in the controller. This method does not exist, and thus when auto_complete_for_user_name method is called, it raises ActionView::Template::Error. In the first test case, it is being checked if the correct error is being thrown. While, in the second test case the method is being called with a GET request and is expected to redirect us to the home page. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#auto_complete_for_user_name' do&lt;br /&gt;
    it 'checks if auto_complete returns actionview error' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      expect{controller.auto_complete_for_user_name}.to raise_error(ActionView::Template::Error)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks if get auto_complete redirects to test host' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      get :auto_complete_for_user_name, @params, session&lt;br /&gt;
      expect(response).to redirect_to(&amp;quot;http://test.host/&amp;quot;)&lt;br /&gt;
    end  &lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== destroy ===&lt;br /&gt;
This action is called in the process of deleting a user. When this action is successfully executed or user is successfully destroyed (when User is passed a valid value 'student1') a note alert is flashed, whereas in case user is not destroyed (when User is passed an invalid value 'nil') an error is flashed. Further, it is being tested that at the end in both cases it redirects to list action.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#destroy' do&lt;br /&gt;
    it 'check if user was successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:note]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was not successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:error]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if successful destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if error during destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== role ===&lt;br /&gt;
This method is private and returns the role of the user as per their role_id. In case role_id is nil a new role with name '(none)' is created and returned. We test if this function is successfully called through the edit action even when the user's role_id is nil, or, the template is successfully rendered for edit and no error is raised.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#edit' do  &lt;br /&gt;
    it 'checks if role renders through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      get :edit&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
	 &lt;br /&gt;
    it 'checks if role fails through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      expect{controller.edit}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#list' do&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with controller' do&lt;br /&gt;
      expect{controller.list}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with post' do&lt;br /&gt;
      post :list&lt;br /&gt;
      expect(response.status).to eq(200)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143245</id>
		<title>CSC/ECE 517 Spring 2022 - E2206: Testing for users controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143245"/>
		<updated>2022-03-21T21:49:51Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* role */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2206: Testing for users_controller&amp;quot; is focused on adding unit tests for users_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* users_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/users_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
users_controller had 5 methods for which unit tests were missing. The RSpec unit tests added for these methods in the spec file 'users_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the current user. The action is passed in the params. In this case we are testing the action list_pending_requested.&lt;br /&gt;
We stub a student, an instructor and an admin, and we test if only the admin has the right to perform this action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#set_anonymized_view' do&lt;br /&gt;
    it 'admin list_pending_requested' do&lt;br /&gt;
      params = { action: 'list_pending_requested' }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(student7, student7.role.name, student7.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== auto_complete_for_user_name ===&lt;br /&gt;
For auto_complete_for_user_name method there is another method auto_complete_result being called in the controller. This method does not exist, and thus when auto_complete_for_user_name method is called, it raises ActionView::Template::Error. In the first test case, it is being checked if the correct error is being thrown. While, in the second test case the method is being called with a GET request and is expected to redirect us to the home page. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#auto_complete_for_user_name' do&lt;br /&gt;
    it 'checks if auto_complete returns actionview error' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      expect{controller.auto_complete_for_user_name}.to raise_error(ActionView::Template::Error)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks if get auto_complete redirects to test host' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      get :auto_complete_for_user_name, @params, session&lt;br /&gt;
      expect(response).to redirect_to(&amp;quot;http://test.host/&amp;quot;)&lt;br /&gt;
    end  &lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== destroy ===&lt;br /&gt;
This action is called in the process of deleting a user. When this action is successfully executed or user is successfully destroyed (when User is passed a valid value 'student1') a note alert is flashed, whereas in case user is not destroyed (when User is passed an invalid value 'nil') an error is flashed. Further, it is being tested that at the end in both cases it redirects to list action.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#destroy' do&lt;br /&gt;
    it 'check if user was successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:note]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was not successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:error]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if successful destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if error during destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== role ===&lt;br /&gt;
This method is private and returns the role of the user as per their role_id. In case role_id is nil a new role with name '(none)' is created and returned. We test if this function is successfully called through the edit action even when the user's role_id is nil, or, the template is successfully rendered for edit and no error is raised.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#edit' do  &lt;br /&gt;
&lt;br /&gt;
    it 'checks if role renders through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      get :edit&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
	 &lt;br /&gt;
    it 'checks if role fails through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      expect{controller.edit}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#list' do&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with controller' do&lt;br /&gt;
      expect{controller.list}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with post' do&lt;br /&gt;
      post :list&lt;br /&gt;
      expect(response.status).to eq(200)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143231</id>
		<title>CSC/ECE 517 Spring 2022 - E2206: Testing for users controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143231"/>
		<updated>2022-03-21T21:37:29Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* destroy */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2206: Testing for users_controller&amp;quot; is focused on adding unit tests for users_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* users_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/users_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
users_controller had 5 methods for which unit tests were missing. The RSpec unit tests added for these methods in the spec file 'users_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the current user. The action is passed in the params. In this case we are testing the action list_pending_requested.&lt;br /&gt;
We stub a student, an instructor and an admin, and we test if only the admin has the right to perform this action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#set_anonymized_view' do&lt;br /&gt;
    it 'admin list_pending_requested' do&lt;br /&gt;
      params = { action: 'list_pending_requested' }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(student7, student7.role.name, student7.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== auto_complete_for_user_name ===&lt;br /&gt;
For auto_complete_for_user_name method there is another method auto_complete_result being called in the controller. This method does not exist, and thus when auto_complete_for_user_name method is called, it raises ActionView::Template::Error. In the first test case, it is being checked if the correct error is being thrown. While, in the second test case the method is being called with a GET request and is expected to redirect us to the home page. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#auto_complete_for_user_name' do&lt;br /&gt;
    it 'checks if auto_complete returns actionview error' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      expect{controller.auto_complete_for_user_name}.to raise_error(ActionView::Template::Error)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks if get auto_complete redirects to test host' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      get :auto_complete_for_user_name, @params, session&lt;br /&gt;
      expect(response).to redirect_to(&amp;quot;http://test.host/&amp;quot;)&lt;br /&gt;
    end  &lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== destroy ===&lt;br /&gt;
This action is called in the process of deleting a user. When this action is successfully executed or user is successfully destroyed (when User is passed a valid value 'student1') a note alert is flashed, whereas in case user is not destroyed (when User is passed an invalid value 'nil') an error is flashed. Further, it is being tested that at the end in both cases it redirects to list action.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#destroy' do&lt;br /&gt;
    it 'check if user was successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:note]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was not successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:error]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if successful destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if error during destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== role ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#edit' do  &lt;br /&gt;
&lt;br /&gt;
    it 'checks if role renders through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      get :edit&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
	 &lt;br /&gt;
    it 'checks if role fails through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      expect{controller.edit}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#list' do&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with controller' do&lt;br /&gt;
      expect{controller.list}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with post' do&lt;br /&gt;
      post :list&lt;br /&gt;
      expect(response.status).to eq(200)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143225</id>
		<title>CSC/ECE 517 Spring 2022 - E2206: Testing for users controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143225"/>
		<updated>2022-03-21T21:24:29Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2206: Testing for users_controller&amp;quot; is focused on adding unit tests for users_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* users_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/users_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
users_controller had 5 methods for which unit tests were missing. The RSpec unit tests added for these methods in the spec file 'users_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the current user. The action is passed in the params. In this case we are testing the action list_pending_requested.&lt;br /&gt;
We stub a student, an instructor and an admin, and we test if only the admin has the right to perform this action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#set_anonymized_view' do&lt;br /&gt;
    it 'admin list_pending_requested' do&lt;br /&gt;
      params = { action: 'list_pending_requested' }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(student7, student7.role.name, student7.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== auto_complete_for_user_name ===&lt;br /&gt;
For auto_complete_for_user_name method there is another method auto_complete_result being called in the controller. This method does not exist, and thus when auto_complete_for_user_name method is called, it raises ActionView::Template::Error. In the first test case, it is being checked if the correct error is being thrown. While, in the second test case the method is being called with a GET request and is expected to redirect us to the home page. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#auto_complete_for_user_name' do&lt;br /&gt;
    it 'checks if auto_complete returns actionview error' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      expect{controller.auto_complete_for_user_name}.to raise_error(ActionView::Template::Error)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks if get auto_complete redirects to test host' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      get :auto_complete_for_user_name, @params, session&lt;br /&gt;
      expect(response).to redirect_to(&amp;quot;http://test.host/&amp;quot;)&lt;br /&gt;
    end  &lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== destroy ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#destroy' do&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:note]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was not successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:error]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if successful destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if error during destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== role ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#edit' do  &lt;br /&gt;
&lt;br /&gt;
    it 'checks if role renders through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      get :edit&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
	 &lt;br /&gt;
    it 'checks if role fails through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      expect{controller.edit}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#list' do&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with controller' do&lt;br /&gt;
      expect{controller.list}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with post' do&lt;br /&gt;
      post :list&lt;br /&gt;
      expect(response.status).to eq(200)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143224</id>
		<title>CSC/ECE 517 Spring 2022 - E2206: Testing for users controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143224"/>
		<updated>2022-03-21T21:19:47Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* auto_complete_for_user_name */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2206: Testing for users_controller&amp;quot; is focused on adding unit tests for users_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* users_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/users_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
users_controller had 5 methods for which unit tests were missing. The unit tests added for these methods in the spec file 'users_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the current user. The action is passed in the params. In this case we are testing the action list_pending_requested.&lt;br /&gt;
We stub a student, an instructor and an admin, and we test if only the admin has the right to perform this action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#set_anonymized_view' do&lt;br /&gt;
    it 'admin list_pending_requested' do&lt;br /&gt;
      params = { action: 'list_pending_requested' }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(student7, student7.role.name, student7.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== auto_complete_for_user_name ===&lt;br /&gt;
For auto_complete_for_user_name method there is another method auto_complete_result being called in the controller. This method does not exist, and thus when auto_complete_for_user_name method is called, it raises ActionView::Template::Error. In the first test case, it is being checked if the correct error is being thrown. While, in the second test case the method is being called with a GET request and is expected to redirect us to the home page. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#auto_complete_for_user_name' do&lt;br /&gt;
    it 'checks if auto_complete returns actionview error' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      expect{controller.auto_complete_for_user_name}.to raise_error(ActionView::Template::Error)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks if get auto_complete redirects to test host' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      get :auto_complete_for_user_name, @params, session&lt;br /&gt;
      expect(response).to redirect_to(&amp;quot;http://test.host/&amp;quot;)&lt;br /&gt;
    end  &lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== destroy ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#destroy' do&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:note]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was not successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:error]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if successful destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if error during destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== role ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#edit' do  &lt;br /&gt;
&lt;br /&gt;
    it 'checks if role renders through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      get :edit&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
	 &lt;br /&gt;
    it 'checks if role fails through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      expect{controller.edit}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#list' do&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with controller' do&lt;br /&gt;
      expect{controller.list}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with post' do&lt;br /&gt;
      post :list&lt;br /&gt;
      expect(response.status).to eq(200)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143200</id>
		<title>CSC/ECE 517 Spring 2022 - E2206: Testing for users controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143200"/>
		<updated>2022-03-21T20:37:41Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* action_allowed? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2206: Testing for users_controller&amp;quot; is focused on adding unit tests for users_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* users_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/users_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
users_controller had 5 methods for which unit tests were missing. The unit tests added for these methods in the spec file 'users_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the current user. The action is passed in the params. In this case we are testing the action list_pending_requested.&lt;br /&gt;
We stub a student, an instructor and an admin, and we test if only the admin has the right to perform this action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#set_anonymized_view' do&lt;br /&gt;
    it 'admin list_pending_requested' do&lt;br /&gt;
      params = { action: 'list_pending_requested' }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(student7, student7.role.name, student7.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== auto_complete_for_user_name ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#auto_complete_for_user_name' do&lt;br /&gt;
&lt;br /&gt;
    it 'checks if auto_complete returns actionview error' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      expect{controller.auto_complete_for_user_name}.to raise_error(ActionView::Template::Error)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks if get auto_complete redirects to test host' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      get :auto_complete_for_user_name, @params, session&lt;br /&gt;
      expect(response).to redirect_to(&amp;quot;http://test.host/&amp;quot;)&lt;br /&gt;
    end  &lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== destroy ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#destroy' do&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:note]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was not successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:error]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if successful destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if error during destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== role ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#edit' do  &lt;br /&gt;
&lt;br /&gt;
    it 'checks if role renders through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      get :edit&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
	 &lt;br /&gt;
    it 'checks if role fails through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      expect{controller.edit}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#list' do&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with controller' do&lt;br /&gt;
      expect{controller.list}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with post' do&lt;br /&gt;
      post :list&lt;br /&gt;
      expect(response.status).to eq(200)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143193</id>
		<title>CSC/ECE 517 Spring 2022 - E2206: Testing for users controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143193"/>
		<updated>2022-03-21T20:31:32Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* paginate_list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2206: Testing for users_controller&amp;quot; is focused on adding unit tests for users_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* users_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/users_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
users_controller had 5 methods for which unit tests were missing. The unit tests added for these methods in the spec file 'users_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
Checks if a particular action is allowed when an action is called for the current user. Action is passed in the params. We stub a student, an instructor and an admin, and we check if only the admin has the right to perform that action. In this case we are testing the action list_pending_requested.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#set_anonymized_view' do&lt;br /&gt;
&lt;br /&gt;
    it 'admin list_pending_requested' do&lt;br /&gt;
      params = { action: 'list_pending_requested' }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(student7, student7.role.name, student7.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== auto_complete_for_user_name ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#auto_complete_for_user_name' do&lt;br /&gt;
&lt;br /&gt;
    it 'checks if auto_complete returns actionview error' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      expect{controller.auto_complete_for_user_name}.to raise_error(ActionView::Template::Error)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks if get auto_complete redirects to test host' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      get :auto_complete_for_user_name, @params, session&lt;br /&gt;
      expect(response).to redirect_to(&amp;quot;http://test.host/&amp;quot;)&lt;br /&gt;
    end  &lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== destroy ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#destroy' do&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:note]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was not successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:error]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if successful destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if error during destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== role ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#edit' do  &lt;br /&gt;
&lt;br /&gt;
    it 'checks if role renders through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      get :edit&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
	 &lt;br /&gt;
    it 'checks if role fails through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      expect{controller.edit}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#list' do&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with controller' do&lt;br /&gt;
      expect{controller.list}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with post' do&lt;br /&gt;
      post :list&lt;br /&gt;
      expect(response.status).to eq(200)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143174</id>
		<title>CSC/ECE 517 Spring 2022 - E2206: Testing for users controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143174"/>
		<updated>2022-03-21T20:03:45Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* action_allowed? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2206: Testing for users_controller&amp;quot; is focused on adding unit tests for users_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* users_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/users_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
users_controller had 5 methods for which unit tests were missing. The unit tests added for these methods in the spec file 'users_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
Checks if a particular action is allowed when an action is called for the current user. Action is passed in the params. We stub a student, an instructor and an admin, and we check if only the admin has the right to perform that action. In this case we are testing the action list_pending_requested.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#set_anonymized_view' do&lt;br /&gt;
&lt;br /&gt;
    it 'admin list_pending_requested' do&lt;br /&gt;
      params = { action: 'list_pending_requested' }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(student7, student7.role.name, student7.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== auto_complete_for_user_name ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#auto_complete_for_user_name' do&lt;br /&gt;
&lt;br /&gt;
    it 'checks if auto_complete returns actionview error' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      expect{controller.auto_complete_for_user_name}.to raise_error(ActionView::Template::Error)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks if get auto_complete redirects to test host' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      get :auto_complete_for_user_name, @params, session&lt;br /&gt;
      expect(response).to redirect_to(&amp;quot;http://test.host/&amp;quot;)&lt;br /&gt;
    end  &lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== destroy ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#destroy' do&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:note]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was not successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:error]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if successful destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if error during destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== role ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#edit' do  &lt;br /&gt;
&lt;br /&gt;
    it 'checks if role renders through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      get :edit&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
	 &lt;br /&gt;
    it 'checks if role fails through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      expect{controller.edit}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143138</id>
		<title>CSC/ECE 517 Spring 2022 - E2206: Testing for users controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143138"/>
		<updated>2022-03-21T07:24:09Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2206: Testing for users_controller&amp;quot; is focused on adding unit tests for users_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* users_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/users_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
users_controller had 5 methods for which unit tests were missing. The unit tests added for these methods in the spec file 'users_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#set_anonymized_view' do&lt;br /&gt;
&lt;br /&gt;
    it 'admin list_pending_requested' do&lt;br /&gt;
      params = { action: 'list_pending_requested' }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(student7, student7.role.name, student7.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be false&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      expect(controller.action_allowed?).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== auto_complete_for_user_name ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#auto_complete_for_user_name' do&lt;br /&gt;
&lt;br /&gt;
    it 'checks if auto_complete returns actionview error' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      expect{controller.auto_complete_for_user_name}.to raise_error(ActionView::Template::Error)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks if get auto_complete redirects to test host' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      session = { user: student1 }&lt;br /&gt;
      @params = {user: student1}&lt;br /&gt;
      allow(controller).to receive(:params).and_return(@params)&lt;br /&gt;
      get :auto_complete_for_user_name, @params, session&lt;br /&gt;
      expect(response).to redirect_to(&amp;quot;http://test.host/&amp;quot;)&lt;br /&gt;
    end  &lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== destroy ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#destroy' do&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:note]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was not successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:error]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if successful destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if error during destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== role ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#edit' do  &lt;br /&gt;
&lt;br /&gt;
    it 'checks if role renders through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      get :edit&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
	 &lt;br /&gt;
    it 'checks if role fails through edit' do&lt;br /&gt;
      new_student = User.new&lt;br /&gt;
      new_student = student1&lt;br /&gt;
      new_student.role_id = nil  &lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(new_student)&lt;br /&gt;
      expect{controller.edit}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143133</id>
		<title>CSC/ECE 517 Spring 2022 - E2206: Testing for users controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2206:_Testing_for_users_controller&amp;diff=143133"/>
		<updated>2022-03-21T05:31:54Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: Created page with &amp;quot;== About Expertiza ==  [http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providi...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2206: Testing for users_controller&amp;quot; is focused on adding unit tests for users_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* users_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/users_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
users_controller had 5 methods for which unit tests were missing. To better evaluate correct functioning of the user_controller we added unit tests for these methods in the spec file 'users_controller_spec.rb':&lt;br /&gt;
# action_allowed?  &lt;br /&gt;
# auto_complete_for_user_name&lt;br /&gt;
# destroy&lt;br /&gt;
# role&lt;br /&gt;
# paginate_list&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022&amp;diff=143129</id>
		<title>CSC/ECE 517 Spring 2022</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022&amp;diff=143129"/>
		<updated>2022-03-21T04:32:41Z</updated>

		<summary type="html">&lt;p&gt;Sbansal6: /* OSS Projects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OSS Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2203: Adding tests for courses_controller, eula_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2204: Adding tests for markup_styles_controller, lock_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2218: Refactor response_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2217: Refactor questionnaires_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2216: Refactor late_policies_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2215: Refactor student_quizzes_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2214: Refactor teams_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2219: Improve assessment360_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2211: Testing for summary_helper]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2214: Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2221: Refactor submitted content controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2206: Testing for users_controller]]&lt;br /&gt;
&lt;br /&gt;
== Final Projects ==&lt;/div&gt;</summary>
		<author><name>Sbansal6</name></author>
	</entry>
</feed>