<?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=Lshyu</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=Lshyu"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Lshyu"/>
	<updated>2026-08-14T01:55:05Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=142368</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=142368"/>
		<updated>2021-11-30T05:03:50Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer-reviewing in Expertiza and determine the competent reviewers amongst all the reviewers, creating a new form of review for assignments was considered. As a result, &amp;quot;calibration assignments&amp;quot; were introduced to the Expertiza system. The calibration assignments were to be assigned before peer review occurred so that students would know if they reviewed the same way that the instructor had reviewed the assignment. Calibration assignments show whether or not the student had given the same or similar score as the instructor for rubric items.&lt;br /&gt;
&lt;br /&gt;
To set up a calibration assignment that both the instructor and the course students can review, the instructor needs to create a new assignment, add the extra participant manually, impersonate the participant, and finally, submit the review, which is not a great experience. What's more is that currently, if an instructor wishes to do this every semester or every year with the same course to copy over the calibration assignments, they have to repeat this process yet again.&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
Expertiza can fix the problem of repeatedly setting up the calibration assignments by automatically copying the previous calibration assignments with all attached reviews.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
In the previous implementation, the implementors designed the calibration review as part of the assignment and students were able to participate in calibration review training before reviewing other students' work.&lt;br /&gt;
&lt;br /&gt;
The instructor can enable the calibration review in two ways:&lt;br /&gt;
&lt;br /&gt;
====1. Check &amp;quot;Calibration for training?&amp;quot; in the general tab of an assignment then copy the participants from the course.====&lt;br /&gt;
&lt;br /&gt;
[[File:2021-11-03 011751.png]]&lt;br /&gt;
&lt;br /&gt;
====2. Copy existing assignment and its participants with calibration review enabled.====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailed System Overview can be found at the following: &amp;lt;br&amp;gt; &lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
However, their implementation introduced several assumptions about the system that we will address to allow merging into production.&lt;br /&gt;
&lt;br /&gt;
===Issues with the Previous work===&lt;br /&gt;
#The project assumes that calibration submissions starts at directory 0, which is only correct if the users who submit the calibration submissions are the first to be added as participants to the assignment.&lt;br /&gt;
##Suggested Fix: set submitter_count to the largest directory number that Expertiza used for calibration.&lt;br /&gt;
###Allows us to keep track of the most recent calibration submission.&lt;br /&gt;
###Gives us something we can reference during copying to get the correct directory.&lt;br /&gt;
#The due date of calibration review are missing. [[File:2021-11-03 235457.png]]&lt;br /&gt;
#The copied assignments do not have participants copied. [[File:2021-11-04 013403.png]]&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
#TODO: add UML diagram, preliminary class design&lt;br /&gt;
[[File:2021-11-04 230435.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Files we originally planned to modify===&lt;br /&gt;
#app/controllers/student_review_controller.rb&amp;lt;br/&amp;gt;The mappings of reviews or calibration reviews should be redesigned.&lt;br /&gt;
#views/student_review/list.html.erb&amp;lt;br/&amp;gt;The view of the list should be modified so that the calibration review can be displayed correctly.&lt;br /&gt;
#views/assignments/edit/_due_dates.html.erb&amp;lt;br/&amp;gt;&lt;br /&gt;
#app/models/deadline_right.rb&lt;br /&gt;
#app/controllers/assignments_controller.rb&amp;lt;br/&amp;gt;The assignments_controller might need a fix so that the assignments with calibration review can be deleted properly.&lt;br /&gt;
#app/views/student_review/_responses.html.erb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Files we modified===&lt;br /&gt;
#app/models/assignment_form.rb&lt;br /&gt;
##Removed vary_by_topic_desired from the update function.&lt;br /&gt;
##Removed topic references from update_assignment_questionnaires.&lt;br /&gt;
##Updated Questionnaire to AssignmentQuestionnaire.&lt;br /&gt;
##Added self.copy_calibration function.&lt;br /&gt;
##Updated the copy counter.&lt;br /&gt;
#app/models/assignment_team.rb&lt;br /&gt;
##Removed code for E1973.&lt;br /&gt;
##Updated review response map return.&lt;br /&gt;
##Created directory_path function.&lt;br /&gt;
#app/models/deadline_right.rb&lt;br /&gt;
##Added calibration to the model.&lt;br /&gt;
#app/models/participant.rb&lt;br /&gt;
##Added self.createparticipant function.&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
##Removed E1973 code.&lt;br /&gt;
##Removed topic from questionnaire function.&lt;br /&gt;
##Shortened self.import function.&lt;br /&gt;
##Added self.newreviewresp function.&lt;br /&gt;
#app/models/submission_record.rb&lt;br /&gt;
##Added self.copycalibratedsubmissions function.&lt;br /&gt;
#app/models/team.rb&lt;br /&gt;
##Added self.createnewteam function.&lt;br /&gt;
#app/views/assignments/edit/_due_dates.html.erb&lt;br /&gt;
##Added checkmark for calibration.&lt;br /&gt;
#spec/features/assignment_creation_general_tab_spec.rb&lt;br /&gt;
##See tests section.&lt;br /&gt;
#spec/models/assignment_form_spec.rb&lt;br /&gt;
##See tests section.&lt;br /&gt;
#db/migrate/20211129124620_add_calibration_to_deadline_type.rb&lt;br /&gt;
##We added a new migration for AddCalibrationToDeadlineType.&lt;br /&gt;
#Screenshots:&lt;br /&gt;
[[File:2021-11-29 235044.png]]&lt;br /&gt;
[[File:2021-11-29 235328.png]]&lt;br /&gt;
[[File:2021-11-29 235441.png]]&lt;br /&gt;
[[File:2021-11-29 235827.png]]&lt;br /&gt;
[[File:2021-11-29 235912.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
&lt;br /&gt;
#Unit test files added:&lt;br /&gt;
##spec/models/assignment_form_spec.rb&lt;br /&gt;
###Added tests for function 'copy'. Test to make sure that the assignment id is updated on copy and no longer references the original assignment. We also make sure that the name of the new file is correct.&lt;br /&gt;
##spec/features/assignment_creation_general_tab_spec.rb&lt;br /&gt;
###Added unit test to make sure that the calibration shows in the due dates tab.&lt;br /&gt;
&lt;br /&gt;
Testing scenarios:&lt;br /&gt;
&lt;br /&gt;
#The instructor copies the existing assignment&amp;lt;br /&amp;gt;The copied assignment stored in the correct directory&amp;lt;br /&amp;gt;Expect the number of calibration submitters of the copied assignment=the number of participants of the original assignment&lt;br /&gt;
#The instructor enables the calibration review of an assignment&amp;lt;br /&amp;gt;The calibration tab appears next to the due dates tab&lt;br /&gt;
#The student attempts his/her calibration review&amp;lt;br /&amp;gt;The student submits the calibration review&amp;lt;br /&amp;gt;The webpage shows what the student has submitted as well as a long that says &amp;quot;Show Calibration Results&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Errors Found==&lt;br /&gt;
&lt;br /&gt;
We found, and fixed, a bug in app/controllers/response_controller.rb where the code was using get_reviewer instead of reviewer. We needed to fix this bug in order for our code to work.&lt;br /&gt;
&lt;br /&gt;
==Future Improvements==&lt;br /&gt;
&lt;br /&gt;
We believe that submitter_count can be removed from the database since it is never used in the project and in order to update the student directory number we do set_student_directory_num on any of team object within an assignment.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[https://github.com/Kasimir123/expertiza/tree/beta Github repository]&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/_53Zyyz59q0 Demonstration]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
#John Marsden (ProfDoof)&lt;br /&gt;
#Lee Shyu (ls-hyu)&lt;br /&gt;
#Angela Ho (angelaho0504)&lt;br /&gt;
#Kasimir Schulz (Kasimir123)&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=142363</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=142363"/>
		<updated>2021-11-30T05:00:05Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Files we modified */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer-reviewing in Expertiza and determine the competent reviewers amongst all the reviewers, creating a new form of review for assignments was considered. As a result, &amp;quot;calibration assignments&amp;quot; were introduced to the Expertiza system. The calibration assignments were to be assigned before peer review occurred so that students would know if they reviewed the same way that the instructor had reviewed the assignment. Calibration assignments show whether or not the student had given the same or similar score as the instructor for rubric items.&lt;br /&gt;
&lt;br /&gt;
To set up a calibration assignment that both the instructor and the course students can review, the instructor needs to create a new assignment, add the extra participant manually, impersonate the participant, and finally, submit the review, which is not a great experience. What's more is that currently, if an instructor wishes to do this every semester or every year with the same course to copy over the calibration assignments, they have to repeat this process yet again.&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
Expertiza can fix the problem of repeatedly setting up the calibration assignments by automatically copying the previous calibration assignments with all attached reviews.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
In the previous implementation, the implementors designed the calibration review as part of the assignment and students were able to participate in calibration review training before reviewing other students' work.&lt;br /&gt;
&lt;br /&gt;
The instructor can enable the calibration review in two ways:&lt;br /&gt;
&lt;br /&gt;
====1. Check &amp;quot;Calibration for training?&amp;quot; in the general tab of an assignment then copy the participants from the course.====&lt;br /&gt;
&lt;br /&gt;
[[File:2021-11-03 011751.png]]&lt;br /&gt;
&lt;br /&gt;
====2. Copy existing assignment and its participants with calibration review enabled.====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailed System Overview can be found at the following: &amp;lt;br&amp;gt; &lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
However, their implementation introduced several assumptions about the system that we will address to allow merging into production.&lt;br /&gt;
&lt;br /&gt;
===Issues with the Previous work===&lt;br /&gt;
#The project assumes that calibration submissions starts at directory 0, which is only correct if the users who submit the calibration submissions are the first to be added as participants to the assignment.&lt;br /&gt;
##Suggested Fix: set submitter_count to the largest directory number that Expertiza used for calibration.&lt;br /&gt;
###Allows us to keep track of the most recent calibration submission.&lt;br /&gt;
###Gives us something we can reference during copying to get the correct directory.&lt;br /&gt;
#The due date of calibration review are missing. [[File:2021-11-03 235457.png]]&lt;br /&gt;
#The copied assignments do not have participants copied. [[File:2021-11-04 013403.png]]&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
#TODO: add UML diagram, preliminary class design&lt;br /&gt;
[[File:2021-11-04 230435.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Files we originally planned to modify===&lt;br /&gt;
#app/controllers/student_review_controller.rb&amp;lt;br/&amp;gt;The mappings of reviews or calibration reviews should be redesigned.&lt;br /&gt;
#views/student_review/list.html.erb&amp;lt;br/&amp;gt;The view of the list should be modified so that the calibration review can be displayed correctly.&lt;br /&gt;
#views/assignments/edit/_due_dates.html.erb&amp;lt;br/&amp;gt;&lt;br /&gt;
#app/models/deadline_right.rb&lt;br /&gt;
#app/controllers/assignments_controller.rb&amp;lt;br/&amp;gt;The assignments_controller might need a fix so that the assignments with calibration review can be deleted properly.&lt;br /&gt;
#app/views/student_review/_responses.html.erb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Files we modified===&lt;br /&gt;
#app/models/assignment_form.rb&lt;br /&gt;
##Removed vary_by_topic_desired from the update function.&lt;br /&gt;
##Removed topic references from update_assignment_questionnaires.&lt;br /&gt;
##Updated Questionnaire to AssignmentQuestionnaire.&lt;br /&gt;
##Added self.copy_calibration function.&lt;br /&gt;
##Updated the copy counter.&lt;br /&gt;
#app/models/assignment_team.rb&lt;br /&gt;
##Removed code for E1973.&lt;br /&gt;
##Updated review response map return.&lt;br /&gt;
##Created directory_path function.&lt;br /&gt;
#app/models/deadline_right.rb&lt;br /&gt;
##Added calibration to the model.&lt;br /&gt;
#app/models/participant.rb&lt;br /&gt;
##Added self.createparticipant function.&lt;br /&gt;
#app/models/review_response_map.rb&lt;br /&gt;
##Removed E1973 code.&lt;br /&gt;
##Removed topic from questionnaire function.&lt;br /&gt;
##Shortened self.import function.&lt;br /&gt;
##Added self.newreviewresp function.&lt;br /&gt;
#app/models/submission_record.rb&lt;br /&gt;
##Added self.copycalibratedsubmissions function.&lt;br /&gt;
#app/models/team.rb&lt;br /&gt;
##Added self.createnewteam function.&lt;br /&gt;
#app/views/assignments/edit/_due_dates.html.erb&lt;br /&gt;
##Added checkmark for calibration.&lt;br /&gt;
#spec/features/assignment_creation_general_tab_spec.rb&lt;br /&gt;
##See tests section.&lt;br /&gt;
#spec/models/assignment_form_spec.rb&lt;br /&gt;
##See tests section.&lt;br /&gt;
#db/migrate/20211129124620_add_calibration_to_deadline_type.rb&lt;br /&gt;
##We added a new migration for AddCalibrationToDeadlineType.&lt;br /&gt;
#Screenshots:&lt;br /&gt;
[[File:2021-11-29 235044.png]]&lt;br /&gt;
[[File:2021-11-29 235328.png]]&lt;br /&gt;
[[File:2021-11-29 235441.png]]&lt;br /&gt;
[[File:2021-11-29 235827.png]]&lt;br /&gt;
[[File:2021-11-29 235912.png]]&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
&lt;br /&gt;
#Unit test files added:&lt;br /&gt;
##spec/models/assignment_form_spec.rb&lt;br /&gt;
###Added tests for function 'copy'. Test to make sure that the assignment id is updated on copy and no longer references the original assignment. We also make sure that the name of the new file is correct.&lt;br /&gt;
##spec/features/assignment_creation_general_tab_spec.rb&lt;br /&gt;
###Added unit test to make sure that the calibration shows in the due dates tab.&lt;br /&gt;
&lt;br /&gt;
Testing scenarios:&lt;br /&gt;
&lt;br /&gt;
#The instructor copies the existing assignment&amp;lt;br /&amp;gt;The copied assignment stored in the correct directory&amp;lt;br /&amp;gt;Expect the number of calibration submitters of the copied assignment=the number of participants of the original assignment&lt;br /&gt;
#The instructor enables the calibration review of an assignment&amp;lt;br /&amp;gt;The calibration tab appears next to the due dates tab&lt;br /&gt;
#The student attempts his/her calibration review&amp;lt;br /&amp;gt;The student submits the calibration review&amp;lt;br /&amp;gt;The webpage shows what the student has submitted as well as a long that says &amp;quot;Show Calibration Results&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Errors Found==&lt;br /&gt;
&lt;br /&gt;
We found, and fixed, a bug in app/controllers/response_controller.rb where the code was using get_reviewer instead of reviewer. We needed to fix this bug in order for our code to work.&lt;br /&gt;
&lt;br /&gt;
==Future Improvements==&lt;br /&gt;
&lt;br /&gt;
We believe that submitter_count can be removed from the database since it is never used in the project and in order to update the student directory number we do set_student_directory_num on any of team object within an assignment.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[https://github.com/Kasimir123/expertiza/tree/beta Github repository]&lt;br /&gt;
 &lt;br /&gt;
==Team==&lt;br /&gt;
#John Marsden (ProfDoof)&lt;br /&gt;
#Lee Shyu (ls-hyu)&lt;br /&gt;
#Angela Ho (angelaho0504)&lt;br /&gt;
#Kasimir Schulz (Kasimir123)&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-29_235912.png&amp;diff=142362</id>
		<title>File:2021-11-29 235912.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-29_235912.png&amp;diff=142362"/>
		<updated>2021-11-30T04:59:35Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-29_235827.png&amp;diff=142359</id>
		<title>File:2021-11-29 235827.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-29_235827.png&amp;diff=142359"/>
		<updated>2021-11-30T04:58:41Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-29_235441.png&amp;diff=142352</id>
		<title>File:2021-11-29 235441.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-29_235441.png&amp;diff=142352"/>
		<updated>2021-11-30T04:54:56Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-29_235328.png&amp;diff=142351</id>
		<title>File:2021-11-29 235328.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-29_235328.png&amp;diff=142351"/>
		<updated>2021-11-30T04:53:44Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-29_235044.png&amp;diff=142345</id>
		<title>File:2021-11-29 235044.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-29_235044.png&amp;diff=142345"/>
		<updated>2021-11-30T04:51:02Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=141428</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=141428"/>
		<updated>2021-11-09T03:28:32Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer-reviewing in Expertiza and determine the competent reviewers amongst all the reviewers, creating a new form of review for assignments was considered. As a result, &amp;quot;calibration assignments&amp;quot; were introduced to the Expertiza system. The calibration assignments were to be assigned before peer review occurred so that students would know if they reviewed the same way that the instructor had reviewed the assignment. Calibration assignments show whether or not the student had given the same or similar score as the instructor for rubric items.&lt;br /&gt;
&lt;br /&gt;
To set up a calibration assignment that both the instructor and the course students can review, the instructor needs to create a new assignment, add the extra participant manually, impersonate the participant, and finally, submit the review, which is not a great experience. What's more is that currently, if an instructor wishes to do this every semester or every year with the same course to copy over the calibration assignments, they have to repeat this process yet again.&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
Expertiza can fix the problem of repeatedly setting up the calibration assignments by automatically copying the previous calibration assignments with all attached reviews.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
In the previous implementation, the implementors designed the calibration review as part of the assignment and students were able to participate in calibration review training before reviewing other students' work.&lt;br /&gt;
&lt;br /&gt;
The instructor can enable the calibration review in two ways:&lt;br /&gt;
&lt;br /&gt;
====1. Check &amp;quot;Calibration for training?&amp;quot; in the general tab of an assignment then copy the participants from the course.====&lt;br /&gt;
&lt;br /&gt;
[[File:2021-11-03 011751.png]]&lt;br /&gt;
&lt;br /&gt;
====2. Copy existing assignment and its participants with calibration review enabled.====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailed System Overview can be found at the following: &amp;lt;br&amp;gt; &lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
However, their implementation introduced several assumptions about the system that we will address to allow merging into production.&lt;br /&gt;
&lt;br /&gt;
===Issues with the Previous work===&lt;br /&gt;
#The project assumes that calibration submissions starts at directory 0, which is only correct if the users who submit the calibration submissions are the first to be added as participants to the assignment.&lt;br /&gt;
##Suggested Fix: set submitter_count to the largest directory number that Expertiza used for calibration.&lt;br /&gt;
###Allows us to keep track of the most recent calibration submission.&lt;br /&gt;
###Gives us something we can reference during copying to get the correct directory.&lt;br /&gt;
#The due date of calibration review are missing. [[File:2021-11-03 235457.png]]&lt;br /&gt;
#The copied assignments do not have participants copied. [[File:2021-11-04 013403.png]]&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
#TODO: add UML diagram, preliminary class design&lt;br /&gt;
[[File:2021-11-04 230435.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
===Files we plan to modify===&lt;br /&gt;
#app/controllers/student_review_controller.rb&amp;lt;br/&amp;gt;The mappings of reviews or calibration reviews should be redesigned.&lt;br /&gt;
#views/student_review/list.html.erb&amp;lt;br/&amp;gt;The view of the list should be modified so that the calibration review can be displayed correctly.&lt;br /&gt;
#views/assignments/edit/_due_dates.html.erb&amp;lt;br/&amp;gt;&lt;br /&gt;
#app/models/deadline_right.rb&lt;br /&gt;
#app/controllers/assignments_controller.rb&amp;lt;br/&amp;gt;The assignments_controller might need a fix so that the assignments with calibration review can be deleted properly.&lt;br /&gt;
#app/views/student_review/_responses.html.erb&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
#TODO: test if the assignment and its participants were copied correctly, test if the participants can be added to the calibration review, test if the due date of calibration review was saved successfully&lt;br /&gt;
&lt;br /&gt;
Testing scenarios:&lt;br /&gt;
&lt;br /&gt;
#The instructor copies the existing assignment&amp;lt;br /&amp;gt;The copied assignment stored in the correct directory&amp;lt;br /&amp;gt;Expect the number of calibration submitters of the copied assignment=the number of participants of the original assignment&lt;br /&gt;
#The instructor enables the calibration review of an assignment&amp;lt;br /&amp;gt;The calibration tab appears next to the due dates tab&lt;br /&gt;
#The student attempts his/her calibration review&amp;lt;br /&amp;gt;The student submits the calibration review&amp;lt;br /&amp;gt;The webpage shows what the student has submitted as well as a long that says &amp;quot;Show Calibration Results&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[https://github.com/Kasimir123/expertiza/tree/beta Github repository]&lt;br /&gt;
 &lt;br /&gt;
==Team==&lt;br /&gt;
#John Marsden (ProfDoof)&lt;br /&gt;
#Lee Shyu (ls-hyu)&lt;br /&gt;
#Angela Ho (angelaho0504)&lt;br /&gt;
#Kasimir Schulz (Kasimir123)&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140973</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140973"/>
		<updated>2021-11-05T03:06:00Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer-reviewing in Expertiza and determine the competent reviewers amongst all the reviewers, creating a new form of review for assignments was considered. As a result, &amp;quot;calibration assignments&amp;quot; were introduced to the Expertiza system. The calibration assignments were to be assigned before peer review occurred so that students would know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
&lt;br /&gt;
To set up a calibration assignment that both the instructor and the course students can review, the instructor needs to create a new assignment, add the extra participant manually, impersonate the participant, and finally, submit the review, which is not a great experience. What's more is that currently, if an instructor wishes to do this every semester or every year with the same course to copy over the calibration assignments, they have to repeat this process yet again. &lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
Expertiza can fix the problem of repeatedly setting up the calibration assignments by automatically copying the previous calibration assignments with all attached reviews.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
In the previous implementation, the implementors designed the calibration review as part of the assignment and students were able to participate in calibration review training before reviewing other students' work.&lt;br /&gt;
&lt;br /&gt;
The instructor can enable the calibration review in two ways:&lt;br /&gt;
&lt;br /&gt;
====1. Check &amp;quot;Calibration for training?&amp;quot; in an assignment then copy the participants from the course.====&lt;br /&gt;
&lt;br /&gt;
[[File:2021-11-03 011751.png]]&lt;br /&gt;
====2. Copy existing assignment and its participants with calibration review enabled.====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailed System Overview can be found at the following: &amp;lt;br&amp;gt; &lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
However, their implementation introduced several assumptions about the system that we will address to allow merging into production.&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
#The project assumes that the calibration starts at directory 0, which occasionally causes Expertiza to copy the wrong submission. &lt;br /&gt;
##Suggested Fix: set submitter_count to the largest directory number that Expertiza used for calibration.&lt;br /&gt;
###Allows us to keep track of the most recent calibration submission.&lt;br /&gt;
###Gives us something we can reference during copying to get the correct directory.&lt;br /&gt;
#The due date of calibration review are missing. [[File:2021-11-03 235457.png]]&lt;br /&gt;
#The copied assignments do not have participants copied. [[File:2021-11-04 013403.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
#TODO: add UML diagram, preliminary class design&lt;br /&gt;
[[File:2021-11-04 230435.png]]&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
#TODO: test if the assignment and its participants were copied correctly, test if the participants can be added to the calibration review, test if the due date of calibration review was saved successfully&lt;br /&gt;
&lt;br /&gt;
Testing scenarios:&lt;br /&gt;
&lt;br /&gt;
#The instructor copies the existing assignment&amp;lt;br /&amp;gt;The copied assignment stored in the correct directory&amp;lt;br /&amp;gt;Expect the number of participants of the copied assignment=the number of participants of the original assignment&lt;br /&gt;
#The instructor enables the calibration review of an assignment&amp;lt;br /&amp;gt;The due date of calibration review appears before the first round of the review&amp;lt;br /&amp;gt;The calibration tab appears next to the due dates tab&lt;br /&gt;
#The student attempt his/her calibration review&amp;lt;br /&amp;gt;The student submits the calibration review&amp;lt;br /&amp;gt;The webpage redirects to the instructor's calibration review&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[https://github.com/Kasimir123/expertiza/tree/beta Github repository]&lt;br /&gt;
 &lt;br /&gt;
==Team==&lt;br /&gt;
#John Marsden (ProfDoof)&lt;br /&gt;
#Lee Shyu (ls-hyu)&lt;br /&gt;
#Angela Ho (angelaho0504)&lt;br /&gt;
#Kasimir Schulz (Kasimir123)&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-04_230435.png&amp;diff=140972</id>
		<title>File:2021-11-04 230435.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-04_230435.png&amp;diff=140972"/>
		<updated>2021-11-05T03:05:18Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140966</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140966"/>
		<updated>2021-11-04T21:45:01Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Testing Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer-reviewing in Expertiza and determine the competent reviewers amongst all the reviewers, creating a new form of review for assignments was considered. As a result, &amp;quot;calibration assignments&amp;quot; were introduced to the Expertiza system. The calibration assignments were to be assigned before peer review occurred so that students would know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
&lt;br /&gt;
To set up a calibration assignment that both the instructor and the course students can review, the instructor needs to create a new assignment, add the extra participant manually, impersonate the participant, and finally, submit the review, which is not a great experience. What's more is that currently, if an instructor wishes to do this every semester or every year with the same course to copy over the calibration assignments, they have to repeat this process yet again. &lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
Expertiza can fix the problem of repeatedly setting up the calibration assignments by automatically copying the previous calibration assignments with all attached reviews.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
In the previous implementation, the implementors designed the calibration review as part of the assignment and students were able to participate in calibration review training before reviewing other students' work.&lt;br /&gt;
&lt;br /&gt;
The instructor can enable the calibration review in two ways:&lt;br /&gt;
&lt;br /&gt;
====1. Check &amp;quot;Calibration for training?&amp;quot; in an assignment then copy the participants from the course.====&lt;br /&gt;
&lt;br /&gt;
[[File:2021-11-03 011751.png]]&lt;br /&gt;
====2. Copy existing assignment and its participants with calibration review enabled.====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailed System Overview can be found at the following: &amp;lt;br&amp;gt; &lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
However, their implementation introduced several assumptions about the system that we will address to allow merging into production.&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
#The project assumes that the calibration starts at directory 0, which occasionally causes Expertiza to copy the wrong submission. &lt;br /&gt;
##Suggested Fix: set submitter_count to the largest directory number that Expertiza used for calibration.&lt;br /&gt;
###Allows us to keep track of the most recent calibration submission.&lt;br /&gt;
###Gives us something we can reference during copying to get the correct directory.&lt;br /&gt;
#The due date of calibration review are missing. [[File:2021-11-03 235457.png]]&lt;br /&gt;
#The copied assignments do not have participants copied. [[File:2021-11-04 013403.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
#TODO: add UML diagram, preliminary class design&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
#TODO: test if the assignment and its participants were copied correctly, test if the participants can be added to the calibration review, test if the due date of calibration review was saved successfully&lt;br /&gt;
&lt;br /&gt;
Testing scenarios:&lt;br /&gt;
&lt;br /&gt;
#The instructor copies the existing assignment&amp;lt;br /&amp;gt;The copied assignment stored in the correct directory&amp;lt;br /&amp;gt;Expect the number of participants of the copied assignment=the number of participants of the original assignment&lt;br /&gt;
#The instructor enables the calibration review of an assignment&amp;lt;br /&amp;gt;The due date of calibration review appears before the first round of the review&amp;lt;br /&amp;gt;The calibration tab appears next to the due dates tab&lt;br /&gt;
#The student attempt his/her calibration review&amp;lt;br /&amp;gt;The student submits the calibration review&amp;lt;br /&amp;gt;The webpage redirects to the instructor's calibration review&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[https://github.com/Kasimir123/expertiza/tree/beta Github repository]&lt;br /&gt;
 &lt;br /&gt;
==Team==&lt;br /&gt;
#John Marsden (ProfDoof)&lt;br /&gt;
#Lee Shyu (ls-hyu)&lt;br /&gt;
#Angela Ho (angelaho0504)&lt;br /&gt;
#Kasimir Schulz (Kasimir123)&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140959</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140959"/>
		<updated>2021-11-04T21:30:38Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Testing Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer-reviewing in Expertiza and determine the competent reviewers amongst all the reviewers, creating a new form of review for assignments was considered. As a result, &amp;quot;calibration assignments&amp;quot; were introduced to the Expertiza system. The calibration assignments were to be assigned before peer review occurred so that students would know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
&lt;br /&gt;
To set up a calibration assignment that both the instructor and the course students can review, the instructor needs to create a new assignment, add the extra participant manually, impersonate the participant, and finally, submit the review, which is not a great experience. What's more is that currently, if an instructor wishes to do this every semester or every year with the same course to copy over the calibration assignments, they have to repeat this process yet again. &lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
Expertiza can fix the problem of repeatedly setting up the calibration assignments by automatically copying the previous calibration assignments with all attached reviews.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
In the previous implementation, the implementors designed the calibration review as part of the assignment and students were able to participate in calibration review training before reviewing other students' work.&lt;br /&gt;
&lt;br /&gt;
The instructor can enable the calibration review in two ways:&lt;br /&gt;
&lt;br /&gt;
====1. Check &amp;quot;Calibration for training?&amp;quot; in an assignment then copy the participants from the course.====&lt;br /&gt;
&lt;br /&gt;
[[File:2021-11-03 011751.png]]&lt;br /&gt;
====2. Copy existing assignment and its participants with calibration review enabled.====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailed System Overview can be found at the following: &amp;lt;br&amp;gt; &lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
However, their implementation introduced several assumptions about the system that we will address to allow merging into production.&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
#The project assumes that the calibration starts at directory 0, which occasionally causes Expertiza to copy the wrong submission. &lt;br /&gt;
##Suggested Fix: set submitter_count to the largest directory number that Expertiza used for calibration.&lt;br /&gt;
###Allows us to keep track of the most recent calibration submission.&lt;br /&gt;
###Gives us something we can reference during copying to get the correct directory.&lt;br /&gt;
#The due date of calibration review are missing. [[File:2021-11-03 235457.png]]&lt;br /&gt;
#The copied assignments do not have participants copied. [[File:2021-11-04 013403.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
#TODO: add UML diagram, preliminary class design&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
#TODO: test if the assignment and its participants were copied correctly, test if the participants can be added to the calibration review, test if the due date of calibration review was saved successfully&lt;br /&gt;
&lt;br /&gt;
Testing scenarios:&lt;br /&gt;
&lt;br /&gt;
#The instructor copies the existing assignment&amp;lt;br /&amp;gt;  expect the number of participants of the copied assignment=the number of participants of the original assignment&lt;br /&gt;
#The instructor checks the calibration review of an assignment&amp;lt;br /&amp;gt;&lt;br /&gt;
#The students attempt their calibration review&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[https://github.com/Kasimir123/expertiza/tree/beta Github repository]&lt;br /&gt;
 &lt;br /&gt;
==Team==&lt;br /&gt;
#John Marsden (ProfDoof)&lt;br /&gt;
#Lee Shyu (ls-hyu)&lt;br /&gt;
#Angela Ho (angelaho0504)&lt;br /&gt;
#Kasimir Schulz (Kasimir123)&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140958</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140958"/>
		<updated>2021-11-04T21:13:39Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Testing Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer-reviewing in Expertiza and determine the competent reviewers amongst all the reviewers, creating a new form of review for assignments was considered. As a result, &amp;quot;calibration assignments&amp;quot; were introduced to the Expertiza system. The calibration assignments were to be assigned before peer review occurred so that students would know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
&lt;br /&gt;
To set up a calibration assignment that both the instructor and the course students can review, the instructor needs to create a new assignment, add the extra participant manually, impersonate the participant, and finally, submit the review, which is not a great experience. What's more is that currently, if an instructor wishes to do this every semester or every year with the same course to copy over the calibration assignments, they have to repeat this process yet again. &lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
Expertiza can fix the problem of repeatedly setting up the calibration assignments by automatically copying the previous calibration assignments with all attached reviews.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
In the previous implementation, the implementors designed the calibration review as part of the assignment and students were able to participate in calibration review training before reviewing other students' work.&lt;br /&gt;
&lt;br /&gt;
The instructor can enable the calibration review in two ways:&lt;br /&gt;
&lt;br /&gt;
====1. Check &amp;quot;Calibration for training?&amp;quot; in an assignment then copy the participants from the course.====&lt;br /&gt;
&lt;br /&gt;
[[File:2021-11-03 011751.png]]&lt;br /&gt;
====2. Copy existing assignment and its participants with calibration review enabled.====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailed System Overview can be found at the following: &amp;lt;br&amp;gt; &lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
However, their implementation introduced several assumptions about the system that we will address to allow merging into production.&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
#The project assumes that the calibration starts at directory 0, which occasionally causes Expertiza to copy the wrong submission. &lt;br /&gt;
##Suggested Fix: set submitter_count to the largest directory number that Expertiza used for calibration.&lt;br /&gt;
###Allows us to keep track of the most recent calibration submission.&lt;br /&gt;
###Gives us something we can reference during copying to get the correct directory.&lt;br /&gt;
#The due date of calibration review are missing. [[File:2021-11-03 235457.png]]&lt;br /&gt;
#The copied assignments do not have participants copied. [[File:2021-11-04 013403.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
#TODO: add UML diagram, preliminary class design&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
#TODO: test if the assignment and its participants were copied correctly, test if the participants can be added to the calibration review, test if the due date of calibration review was saved successfully&lt;br /&gt;
&lt;br /&gt;
Testing scenarios:&lt;br /&gt;
&lt;br /&gt;
#The instructor copies the existing assignment&lt;br /&gt;
expect the # of participants of the copied assignment=the # of participants of the original assignment&lt;br /&gt;
#The instructor checks the calibration review of an assignment&lt;br /&gt;
#The students attempt their calibration review&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[https://github.com/Kasimir123/expertiza/tree/beta Github repository]&lt;br /&gt;
 &lt;br /&gt;
==Team==&lt;br /&gt;
#John Marsden (ProfDoof)&lt;br /&gt;
#Lee Shyu (ls-hyu)&lt;br /&gt;
#Angela Ho (angelaho0504)&lt;br /&gt;
#Kasimir Schulz (Kasimir123)&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140957</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140957"/>
		<updated>2021-11-04T19:38:33Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Testing Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer-reviewing in Expertiza and determine the competent reviewers amongst all the reviewers, creating a new form of review for assignments was considered. As a result, &amp;quot;calibration assignments&amp;quot; were introduced to the Expertiza system. The calibration assignments were to be assigned before peer review occurred so that students would know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
&lt;br /&gt;
To set up a calibration assignment that both the instructor and the course students can review, the instructor needs to create a new assignment, add the extra participant manually, impersonate the participant, and finally, submit the review, which is not a great experience. What's more is that currently, if an instructor wishes to do this every semester or every year with the same course to copy over the calibration assignments, they have to repeat this process yet again. &lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
Expertiza can fix the problem of repeatedly setting up the calibration assignments by automatically copying the previous calibration assignments with all attached reviews.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
In the previous implementation, the implementors designed the calibration review as part of the assignment and students were able to participate in calibration review training before reviewing other students' work.&lt;br /&gt;
&lt;br /&gt;
The instructor can enable the calibration review in two ways:&lt;br /&gt;
&lt;br /&gt;
====1. Check &amp;quot;Calibration for training?&amp;quot; in an assignment then copy the participants from the course.====&lt;br /&gt;
&lt;br /&gt;
[[File:2021-11-03 011751.png]]&lt;br /&gt;
====2. Copy existing assignment and its participants with calibration review enabled.====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailed System Overview can be found at the following: &amp;lt;br&amp;gt; &lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
However, their implementation introduced several assumptions about the system that we will address to allow merging into production.&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
#The project assumes that the calibration starts at directory 0, which occasionally causes Expertiza to copy the wrong submission. &lt;br /&gt;
##Suggested Fix: set submitter_count to the largest directory number that Expertiza used for calibration.&lt;br /&gt;
###Allows us to keep track of the most recent calibration submission.&lt;br /&gt;
###Gives us something we can reference during copying to get the correct directory.&lt;br /&gt;
#The due date of calibration review are missing. [[File:2021-11-03 235457.png]]&lt;br /&gt;
#The copied assignments do not have participants copied. [[File:2021-11-04 013403.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
#TODO: add UML diagram, preliminary class design&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
#TODO: test if the assignment and its participants were copied correctly, test if the participants can be added to the calibration review, test if the due date of calibration review was saved successfully&lt;br /&gt;
&lt;br /&gt;
Testing scenarios:&lt;br /&gt;
&lt;br /&gt;
#When the instructor copies the existing assignment&lt;br /&gt;
expect the # of participants of the copied assignment=the # of participants of the original assignment&lt;br /&gt;
#When the instructor checks the calibration review of an assignment&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[https://github.com/Kasimir123/expertiza/tree/beta Github repository]&lt;br /&gt;
 &lt;br /&gt;
==Team==&lt;br /&gt;
#John Marsden (ProfDoof)&lt;br /&gt;
#Lee Shyu (ls-hyu)&lt;br /&gt;
#Angela Ho (angelaho0504)&lt;br /&gt;
#Kasimir Schulz (Kasimir123)&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140896</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140896"/>
		<updated>2021-11-04T05:47:30Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer-reviewing in Expertiza and determine the competent reviewers amongst all the reviewers, creating a new form of review for assignments was considered. As a result, &amp;quot;calibration assignments&amp;quot; were introduced to the Expertiza system. The calibration assignments were to be assigned before peer review occurred so that students would know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
&lt;br /&gt;
To set up a calibration assignment that both the instructor and the course students can review, the instructor needs to create a new assignment, add the extra participant manually, impersonate the participant, and finally, submit the review, which is not a great experience. What's more is that currently, if an instructor wishes to do this every semester or every year with the same course to copy over the calibration assignments, they have to repeat this process yet again. &lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
Expertiza can fix the problem of repeatedly setting up the calibration assignments by automatically copying the previous calibration assignments with all attached reviews.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
In the previous implementation, the implementors designed the calibration review as part of the assignment and students were able to participate in calibration review training before reviewing other students' work.&lt;br /&gt;
&lt;br /&gt;
The instructor can enable the calibration review in two ways:&lt;br /&gt;
&lt;br /&gt;
====1. Check &amp;quot;Calibration for training?&amp;quot; in an assignment then copy the participants from the course.====&lt;br /&gt;
&lt;br /&gt;
[[File:2021-11-03 011751.png]]&lt;br /&gt;
====2. Copy existing assignment and its participants with calibration review enabled.====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailed System Overview can be found at the following: &amp;lt;br&amp;gt; &lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
However, their implementation introduced several assumptions about the system that we will address to allow merging into production.&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
#The project assumes that the calibration starts at directory 0, which occasionally causes Expertiza to copy the wrong submission. &lt;br /&gt;
##Suggested Fix: set submitter_count to the largest directory number that Expertiza used for calibration.&lt;br /&gt;
###Allows us to keep track of the most recent calibration submission.&lt;br /&gt;
###Gives us something we can reference during copying to get the correct directory.&lt;br /&gt;
#The due date of calibration review are missing. [[File:2021-11-03 235457.png]]&lt;br /&gt;
#The copied assignments do not have participants copied. [[File:2021-11-04 013403.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
#TODO: add UML diagram, preliminary class design&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
#TODO: test if the assignment and its participants were copied correctly, test if the participants can be added to the calibration review, test if the due date of calibration review saved successfully&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[https://github.com/Kasimir123/expertiza/tree/beta Github repository]&lt;br /&gt;
 &lt;br /&gt;
==Team==&lt;br /&gt;
#John Marsden (ProfDoof)&lt;br /&gt;
#Lee Shyu (ls-hyu)&lt;br /&gt;
#Angela Ho (angelaho0504)&lt;br /&gt;
#Kasimir Schulz (Kasimir123)&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140895</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140895"/>
		<updated>2021-11-04T05:43:46Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer-reviewing in Expertiza and determine the competent reviewers amongst all the reviewers, creating a new form of review for assignments was considered. As a result, &amp;quot;calibration assignments&amp;quot; were introduced to the Expertiza system. The calibration assignments were to be assigned before peer review occurred so that students would know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
&lt;br /&gt;
To set up a calibration assignment that both the instructor and the course students can review, the instructor needs to create a new assignment, add the extra participant manually, impersonate the participant, and finally, submit the review, which is not a great experience. What's more is that currently, if an instructor wishes to do this every semester or every year with the same course to copy over the calibration assignments, they have to repeat this process yet again. &lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
Expertiza can fix the problem of repeatedly setting up the calibration assignments by automatically copying the previous calibration assignments with all attached reviews.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
In the previous implementation, the implementors designed the calibration review as part of the assignment and students were able to participate in calibration review training before reviewing other students' work.&lt;br /&gt;
&lt;br /&gt;
The instructor can enable the calibration review in two ways:&lt;br /&gt;
&lt;br /&gt;
====1. Check &amp;quot;Calibration for training?&amp;quot; in an assignment then copy the participants from the course.====&lt;br /&gt;
&lt;br /&gt;
[[File:2021-11-03 011751.png]]&lt;br /&gt;
====2. Copy existing assignment and its participants with calibration review enabled.====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailed System Overview can be found at the following: &amp;lt;br&amp;gt; &lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
However, their implementation introduced several assumptions about the system that we will address to allow merging into production.&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
#The project assumes that the calibration starts at directory 0, which occasionally causes Expertiza to copy the wrong submission. &lt;br /&gt;
##Suggested Fix: set submitter_count to the largest directory number that Expertiza used for calibration.&lt;br /&gt;
###Allows us to keep track of the most recent calibration submission.&lt;br /&gt;
###Gives us something we can reference during copying to get the correct directory.&lt;br /&gt;
#The due date of calibration review are missing. [[File:2021-11-03 235457.png]]&lt;br /&gt;
#The copied assignments do not have participants copied. [[File:2021-11-04 013403.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
#TODO: add UML diagram, preliminary class design&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
==Testing Plan==&lt;br /&gt;
#TODO: test if the assignment and its participants were copied correctly, test if the participants can be added to the calibration review, test if the due date of calibration review saved successfully&lt;br /&gt;
 &lt;br /&gt;
==Team==&lt;br /&gt;
#John Marsden (ProfDoof)&lt;br /&gt;
#Lee Shyu (ls-hyu)&lt;br /&gt;
#Angela Ho (angelaho0504)&lt;br /&gt;
#Kasimir Schulz (Kasimir123)&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-04_013403.png&amp;diff=140894</id>
		<title>File:2021-11-04 013403.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-04_013403.png&amp;diff=140894"/>
		<updated>2021-11-04T05:42:35Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-03_235457.png&amp;diff=140893</id>
		<title>File:2021-11-03 235457.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-03_235457.png&amp;diff=140893"/>
		<updated>2021-11-04T05:34:31Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: Lshyu uploaded a new version of File:2021-11-03 235457.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140892</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140892"/>
		<updated>2021-11-04T05:18:57Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Previous Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer-reviewing in Expertiza and determine the competent reviewers amongst all the reviewers, creating a new form of review for assignments was considered. As a result, &amp;quot;calibration assignments&amp;quot; were introduced to the Expertiza system. The calibration assignments were to be assigned before peer review occurred so that students would know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
&lt;br /&gt;
To set up a calibration assignment that both the instructor and the course students can review, the instructor needs to create a new assignment, add the extra participant manually, impersonate the participant, and finally, submit the review, which is not a great experience. What's more is that currently, if an instructor wishes to do this every semester or every year with the same course to copy over the calibration assignments, they have to repeat this process yet again. &lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
Expertiza can fix the problem of repeatedly setting up the calibration assignments by automatically copying the previous calibration assignments with all attached reviews.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
In the previous implementation, the implementors designed the calibration review as part of the assignment and students were able to participate in calibration review training before reviewing other students' work.&lt;br /&gt;
&lt;br /&gt;
The instructor can enable the calibration review in two ways:&lt;br /&gt;
&lt;br /&gt;
====1. Check &amp;quot;Calibration for training?&amp;quot; in an assignment then copy the participants from the course.====&lt;br /&gt;
&lt;br /&gt;
[[File:2021-11-03 011751.png]]&lt;br /&gt;
====2. Copy existing assignment and its participants with calibration review enabled.====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailed System Overview can be found at the following: &amp;lt;br&amp;gt; &lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
However, their implementation introduced several assumptions about the system that we will address to allow merging into production.&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
#The project assumes that the calibration starts at directory 0, which occasionally causes Expertiza to copy the wrong submission. &lt;br /&gt;
##Suggested Fix: set submitter_count to the largest directory number that Expertiza used for calibration.&lt;br /&gt;
###Allows us to keep track of the most recent calibration submission.&lt;br /&gt;
###Gives us something we can reference during copying to get the correct directory.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
==Team==&lt;br /&gt;
#John Marsden (ProfDoof)&lt;br /&gt;
#Lee Shyu (ls-hyu)&lt;br /&gt;
#Angela Ho (angelaho0504)&lt;br /&gt;
#Kasimir Schulz (Kasimir123)&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140891</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140891"/>
		<updated>2021-11-04T05:16:52Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Previous Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer-reviewing in Expertiza and determine the competent reviewers amongst all the reviewers, creating a new form of review for assignments was considered. As a result, &amp;quot;calibration assignments&amp;quot; were introduced to the Expertiza system. The calibration assignments were to be assigned before peer review occurred so that students would know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
&lt;br /&gt;
To set up a calibration assignment that both the instructor and the course students can review, the instructor needs to create a new assignment, add the extra participant manually, impersonate the participant, and finally, submit the review, which is not a great experience. What's more is that currently, if an instructor wishes to do this every semester or every year with the same course to copy over the calibration assignments, they have to repeat this process yet again. &lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
Expertiza can fix the problem of repeatedly setting up the calibration assignments by automatically copying the previous calibration assignments with all attached reviews.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
In the previous implementation, the implementors designed the calibration review as part of the assignment and students were able to participate in calibration review training before reviewing other students' work.&lt;br /&gt;
&lt;br /&gt;
The instructor can enable the calibration review in two ways:&lt;br /&gt;
&lt;br /&gt;
====1. Checking &amp;quot;Calibration for training?&amp;quot; in an assignment then copy the participants from the course.====&lt;br /&gt;
&lt;br /&gt;
[[File:2021-11-03 011751.png]]&lt;br /&gt;
====2. Copy existing assignment and its participants with calibration review enabled.====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailed System Overview can be found at the following: &amp;lt;br&amp;gt; &lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
However, their implementation introduced several assumptions about the system that we will address to allow merging into production.&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
#The project assumes that the calibration starts at directory 0, which occasionally causes Expertiza to copy the wrong submission. &lt;br /&gt;
##Suggested Fix: set submitter_count to the largest directory number that Expertiza used for calibration.&lt;br /&gt;
###Allows us to keep track of the most recent calibration submission.&lt;br /&gt;
###Gives us something we can reference during copying to get the correct directory.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
==Team==&lt;br /&gt;
#John Marsden (ProfDoof)&lt;br /&gt;
#Lee Shyu (ls-hyu)&lt;br /&gt;
#Angela Ho (angelaho0504)&lt;br /&gt;
#Kasimir Schulz (Kasimir123)&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-03_235457.png&amp;diff=140885</id>
		<title>File:2021-11-03 235457.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-03_235457.png&amp;diff=140885"/>
		<updated>2021-11-04T03:55:25Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140880</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140880"/>
		<updated>2021-11-04T03:31:11Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer-reviewing in Expertiza and determine the competent reviewers amongst all the reviewers, creating a new form of review for assignments was considered. As a result, &amp;quot;calibration assignments&amp;quot; were introduced to the Expertiza system. The calibration assignments were to be assigned before peer review occurred so that students would know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
&lt;br /&gt;
To set up a calibration assignment that both the instructor and the course students can review, the instructor needs to create a new assignment, add the extra participant manually, impersonate the participant, and finally, submit the review, which is not a great experience. What's more is that currently, if an instructor wishes to do this every semester or every year with the same course to copy over the calibration assignments, they have to repeat this process yet again. &lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
Expertiza can fix the problem of repeatedly setting up the calibration assignments by automatically copying the previous calibration assignments with all attached reviews.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
In the previous implementation, the implementors designed the calibration review as part of the assignment and students were able to participate in calibration review training before reviewing other students' work.&lt;br /&gt;
&lt;br /&gt;
The instructor can enable the calibration review in an assignment by checking &amp;quot;Calibration for training?&amp;quot; before assignment creation.&lt;br /&gt;
&lt;br /&gt;
[[File:2021-11-03 011751.png]]&lt;br /&gt;
&lt;br /&gt;
Detailed System Overview can be found at the following: &amp;lt;br&amp;gt; &lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
However, their implementation introduced several assumptions about the system that we will address to allow merging into production.&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
#The project assumes that the calibration starts at directory 0, which occasionally causes Expertiza to copy the wrong submission. &lt;br /&gt;
##Suggested Fix: set submitter_count to the largest directory number that Expertiza used for calibration.&lt;br /&gt;
###Allows us to keep track of the most recent calibration submission.&lt;br /&gt;
###Gives us something we can reference during copying to get the correct directory.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
==Team==&lt;br /&gt;
#John Marsden (ProfDoof)&lt;br /&gt;
#Lee Shyu (ls-hyu)&lt;br /&gt;
#Angela Ho (angelaho0504)&lt;br /&gt;
#Kasimir Schulz (Kasimir123)&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140614</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140614"/>
		<updated>2021-11-03T15:31:20Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Introduction===&lt;br /&gt;
#TODO: Rephrase the sentences&lt;br /&gt;
Expertiza is an open-source learning management system developed using Ruby on Rails framework. Expertiza supports multiple features such as course management, assignment submission, peer review, grade calculation, etc.&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open-source education and classroom web-tool founded by the [http://www.nsf.gov/ National Science Foundation]. Built with Ruby on Rails, it is designed to manage complete courses and students’ work within those courses. Each course can have a collection of instructors and students, though the interaction between instructors and students is minimal. The real emphasis of Expertiza is placed on peer-to-peer interactions, fostering a student-driven learning environment. Courses are comprised of assignments which users complete individually or with a team. Assignments usually encourage or require a team to enforce practicing peer-to-peer interaction.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer reviewing and to find out the competent reviewers among all the reviewers, designing a new form of review for assignments seems to be a fix. As a result, &amp;quot;calibration assignment&amp;quot; was introduced to the Expertiza system. The calibration assignment should be assigned before the peer review so that the students can know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
To set up the calibration assignment that allows both the instructor and the students of the course to review, the instructor needs to create a new assignment and add the extra participant manually, impersonate the participant then submit the review, which is not a great experience.&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
To fix the issue of setting up the calibration assignment repeatedly every semester, the system should be able to make a copy of the previous calibration assignment and let the instructor submit a review as the extra participant by selecting calibration training when the instructor creates the assignment.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
In the previous implementation, the calibration review was designed as part of the assignment and students should be able to participate in calibration review training before reviewing other students' work.&lt;br /&gt;
&lt;br /&gt;
The instructor can enable the calibration review in each assignment by checking the box before &amp;quot;Calibration for training?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:2021-11-03 011751.png]]&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
#If any student submits a review before completing the calibration review training, the first review submitted will be stored at directory 0, where the calibration review was supposed to be stored.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140596</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140596"/>
		<updated>2021-11-03T05:22:21Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Introduction===&lt;br /&gt;
#TODO: Rephrase the sentences&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open-source education and classroom web-tool founded by the [http://www.nsf.gov/ National Science Foundation]. Built with Ruby on Rails, it is designed to manage complete courses and students’ work within those courses. Each course can have a collection of instructors and students, though the interaction between instructors and students is minimal. The real emphasis of Expertiza is placed on peer-to-peer interactions, fostering a student-driven learning environment. Courses are comprised of assignments which users complete individually or with a team. Assignments usually encourage or require a team to enforce practicing peer-to-peer interaction.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer reviewing and to find out the competent reviewers among all the reviewers, designing a new form of review for assignments seems to be a fix. As a result, &amp;quot;calibration assignment&amp;quot; was introduced to the Expertiza system. The calibration assignment should be assigned before the peer review so that the students can know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
To set up the calibration assignment that allows both the instructor and the students of the course to review, the instructor needs to create a new assignment and add the extra participant manually, impersonate the participant then submit the review, which is not a great experience.&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
To fix the issue of setting up the calibration assignment repeatedly every semester, the system should be able to make a copy of the previous calibration assignment and let the instructor submit a review as the extra participant by selecting calibration training when the instructor creates the assignment.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
In the previous implementation, the calibration review was designed as part of the assignment and students should be able to participate in calibration review training before reviewing other students' work.&lt;br /&gt;
&lt;br /&gt;
The instructor can enable the calibration review in each assignment by checking the box before &amp;quot;Calibration for training?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:2021-11-03 011751.png]]&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
#If any student submits a review before completing the calibration review training, the first review submitted will be stored at directory 0, where the calibration review was supposed to be stored.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140595</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140595"/>
		<updated>2021-11-03T05:19:51Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Previous Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Introduction===&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open-source education and classroom web-tool founded by the [http://www.nsf.gov/ National Science Foundation]. Built with Ruby on Rails, it is designed to manage complete courses and students’ work within those courses. Each course can have a collection of instructors and students, though the interaction between instructors and students is minimal. The real emphasis of Expertiza is placed on peer-to-peer interactions, fostering a student-driven learning environment. Courses are comprised of assignments which users complete individually or with a team. Assignments usually encourage or require a team to enforce practicing peer-to-peer interaction.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer reviewing and to find out the competent reviewers among all the reviewers, designing a new form of review for assignments seems to be a fix. As a result, &amp;quot;calibration assignment&amp;quot; was introduced to the Expertiza system. The calibration assignment should be assigned before the peer review so that the students can know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
To set up the calibration assignment that allows both the instructor and the students of the course to review, the instructor needs to create a new assignment and add the extra participant manually, impersonate the participant then submit the review, which is not a great experience.&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
To fix the issue of setting up the calibration assignment repeatedly every semester, the system should be able to make a copy of the previous calibration assignment and let the instructor submit a review as the extra participant by selecting calibration training when the instructor creates the assignment.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
In the previous implementation, the calibration review was designed as part of the assignment and students should be able to participate in calibration review training before reviewing other students' work.&lt;br /&gt;
&lt;br /&gt;
The instructor can enable the calibration review in each assignment by checking the box before &amp;quot;Calibration for training?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:2021-11-03 011751.png]]&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
#If any student submits a review before completing the calibration review training, the first review submitted will be stored at directory 0, where the calibration review was supposed to be stored.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-03_011751.png&amp;diff=140594</id>
		<title>File:2021-11-03 011751.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:2021-11-03_011751.png&amp;diff=140594"/>
		<updated>2021-11-03T05:18:31Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140593</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140593"/>
		<updated>2021-11-03T05:18:03Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Previous Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Introduction===&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open-source education and classroom web-tool founded by the [http://www.nsf.gov/ National Science Foundation]. Built with Ruby on Rails, it is designed to manage complete courses and students’ work within those courses. Each course can have a collection of instructors and students, though the interaction between instructors and students is minimal. The real emphasis of Expertiza is placed on peer-to-peer interactions, fostering a student-driven learning environment. Courses are comprised of assignments which users complete individually or with a team. Assignments usually encourage or require a team to enforce practicing peer-to-peer interaction.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer reviewing and to find out the competent reviewers among all the reviewers, designing a new form of review for assignments seems to be a fix. As a result, &amp;quot;calibration assignment&amp;quot; was introduced to the Expertiza system. The calibration assignment should be assigned before the peer review so that the students can know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
To set up the calibration assignment that allows both the instructor and the students of the course to review, the instructor needs to create a new assignment and add the extra participant manually, impersonate the participant then submit the review, which is not a great experience.&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
To fix the issue of setting up the calibration assignment repeatedly every semester, the system should be able to make a copy of the previous calibration assignment and let the instructor submit a review as the extra participant by selecting calibration training when the instructor creates the assignment.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
In the previous implementation, the calibration review was designed as part of the assignment and students should be able to participate in calibration review training before reviewing other students' work.&lt;br /&gt;
&lt;br /&gt;
The instructor can enable the calibration review in each assignment by checking the box before &amp;quot;Calibration for training?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
#If any student submits a review before completing the calibration review training, the first review submitted will be stored at directory 0, where the calibration review was supposed to be stored.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140592</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140592"/>
		<updated>2021-11-03T05:13:02Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Previous Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Introduction===&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open-source education and classroom web-tool founded by the [http://www.nsf.gov/ National Science Foundation]. Built with Ruby on Rails, it is designed to manage complete courses and students’ work within those courses. Each course can have a collection of instructors and students, though the interaction between instructors and students is minimal. The real emphasis of Expertiza is placed on peer-to-peer interactions, fostering a student-driven learning environment. Courses are comprised of assignments which users complete individually or with a team. Assignments usually encourage or require a team to enforce practicing peer-to-peer interaction.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer reviewing and to find out the competent reviewers among all the reviewers, designing a new form of review for assignments seems to be a fix. As a result, &amp;quot;calibration assignment&amp;quot; was introduced to the Expertiza system. The calibration assignment should be assigned before the peer review so that the students can know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
To set up the calibration assignment that allows both the instructor and the students of the course to review, the instructor needs to create a new assignment and add the extra participant manually, impersonate the participant then submit the review, which is not a great experience.&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
To fix the issue of setting up the calibration assignment repeatedly every semester, the system should be able to make a copy of the previous calibration assignment and let the instructor submit a review as the extra participant by selecting calibration training when the instructor creates the assignment.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
In the previous implementation, the calibration review was designed as part of the assignment and students should be able to participate in calibration review training before reviewing other students' work.&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
#If any student submits a review before completing the calibration review training, the first review submitted will be stored at directory 0, where the calibration review was supposed to be stored.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140591</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140591"/>
		<updated>2021-11-03T05:08:52Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Issues of Previous work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Introduction===&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open-source education and classroom web-tool founded by the [http://www.nsf.gov/ National Science Foundation]. Built with Ruby on Rails, it is designed to manage complete courses and students’ work within those courses. Each course can have a collection of instructors and students, though the interaction between instructors and students is minimal. The real emphasis of Expertiza is placed on peer-to-peer interactions, fostering a student-driven learning environment. Courses are comprised of assignments which users complete individually or with a team. Assignments usually encourage or require a team to enforce practicing peer-to-peer interaction.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer reviewing and to find out the competent reviewers among all the reviewers, designing a new form of review for assignments seems to be a fix. As a result, &amp;quot;calibration assignment&amp;quot; was introduced to the Expertiza system. The calibration assignment should be assigned before the peer review so that the students can know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
To set up the calibration assignment that allows both the instructor and the students of the course to review, the instructor needs to create a new assignment and add the extra participant manually, impersonate the participant then submit the review, which is not a great experience.&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
To fix the issue of setting up the calibration assignment repeatedly every semester, the system should be able to make a copy of the previous calibration assignment and let the instructor submit a review as the extra participant by selecting calibration training when the instructor creates the assignment.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
#If any student submits a review before completing the calibration review training, the first review submitted will be stored at directory 0, where the calibration review was supposed to be stored.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140590</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140590"/>
		<updated>2021-11-03T05:00:51Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Previous Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Introduction===&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open-source education and classroom web-tool founded by the [http://www.nsf.gov/ National Science Foundation]. Built with Ruby on Rails, it is designed to manage complete courses and students’ work within those courses. Each course can have a collection of instructors and students, though the interaction between instructors and students is minimal. The real emphasis of Expertiza is placed on peer-to-peer interactions, fostering a student-driven learning environment. Courses are comprised of assignments which users complete individually or with a team. Assignments usually encourage or require a team to enforce practicing peer-to-peer interaction.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer reviewing and to find out the competent reviewers among all the reviewers, designing a new form of review for assignments seems to be a fix. As a result, &amp;quot;calibration assignment&amp;quot; was introduced to the Expertiza system. The calibration assignment should be assigned before the peer review so that the students can know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
To set up the calibration assignment that allows both the instructor and the students of the course to review, the instructor needs to create a new assignment and add the extra participant manually, impersonate the participant then submit the review, which is not a great experience.&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
To fix the issue of setting up the calibration assignment repeatedly every semester, the system should be able to make a copy of the previous calibration assignment and let the instructor submit a review as the extra participant by selecting calibration training when the instructor creates the assignment.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E17A4_Allow_calibration_to_be_part_of_an_assignment CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140589</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140589"/>
		<updated>2021-11-03T04:59:03Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Objectives */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Introduction===&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open-source education and classroom web-tool founded by the [http://www.nsf.gov/ National Science Foundation]. Built with Ruby on Rails, it is designed to manage complete courses and students’ work within those courses. Each course can have a collection of instructors and students, though the interaction between instructors and students is minimal. The real emphasis of Expertiza is placed on peer-to-peer interactions, fostering a student-driven learning environment. Courses are comprised of assignments which users complete individually or with a team. Assignments usually encourage or require a team to enforce practicing peer-to-peer interaction.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer reviewing and to find out the competent reviewers among all the reviewers, designing a new form of review for assignments seems to be a fix. As a result, &amp;quot;calibration assignment&amp;quot; was introduced to the Expertiza system. The calibration assignment should be assigned before the peer review so that the students can know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
To set up the calibration assignment that allows both the instructor and the students of the course to review, the instructor needs to create a new assignment and add the extra participant manually, impersonate the participant then submit the review, which is not a great experience.&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
To fix the issue of setting up the calibration assignment repeatedly every semester, the system should be able to make a copy of the previous calibration assignment and let the instructor submit a review as the extra participant by selecting calibration training when the instructor creates the assignment.&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140584</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140584"/>
		<updated>2021-11-03T04:39:06Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Introduction===&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open-source education and classroom web-tool founded by the [http://www.nsf.gov/ National Science Foundation]. Built with Ruby on Rails, it is designed to manage complete courses and students’ work within those courses. Each course can have a collection of instructors and students, though the interaction between instructors and students is minimal. The real emphasis of Expertiza is placed on peer-to-peer interactions, fostering a student-driven learning environment. Courses are comprised of assignments which users complete individually or with a team. Assignments usually encourage or require a team to enforce practicing peer-to-peer interaction.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer reviewing and to find out the competent reviewers among all the reviewers, designing a new form of review for assignments seems to be a fix. As a result, &amp;quot;calibration assignment&amp;quot; was introduced to the Expertiza system. The calibration assignment should be assigned before the peer review so that the students can know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
To set up the calibration assignment that allows both the instructor and the students of the course to review, the instructor needs to create a new assignment and add the extra participant manually, impersonate the participant then submit the review, which is not a great experience.&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
To fix the issue of setting up the calibration assignment repeatedly every semester, the system should be able to make a copy of the previous calibration assignment&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140583</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140583"/>
		<updated>2021-11-03T04:37:41Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Objectives */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Introduction===&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open-source education and classroom web-tool founded by the [http://www.nsf.gov/ National Science Foundation]. Built with Ruby on Rails, it is designed to manage complete courses and students’ work within those courses. Each course can have a collection of instructors and students, though the interaction between instructors and students is minimal. The real emphasis of Expertiza is placed on peer-to-peer interactions, fostering a student-driven learning environment. Courses are comprised of assignments which users complete individually or with a team. Assignments usually encourage or require a team to enforce practicing peer-to-peer interaction.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer reviewing and to find out the competent reviewers among all the reviewers, designing a new form of review for assignments seems to be a fix. As a result, &amp;quot;calibration assignment&amp;quot; was introduced to the Expertiza system. The calibration assignment should be assigned before the peer review so that the students can know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
To set up the calibration assignment that allows both the instructor and the students of the course to review, the instructor needs to create a new assignment and add all the participants manually, which is not a great experience.&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
To fix the issue of setting up the calibration assignment repeatedly every semester, the system should be able to make a copy of the previous calibration assignment&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140562</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140562"/>
		<updated>2021-11-03T03:05:54Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Introduction===&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open-source education and classroom web-tool founded by the [http://www.nsf.gov/ National Science Foundation]. Built with Ruby on Rails, it is designed to manage complete courses and students’ work within those courses. Each course can have a collection of instructors and students, though the interaction between instructors and students is minimal. The real emphasis of Expertiza is placed on peer-to-peer interactions, fostering a student-driven learning environment. Courses are comprised of assignments which users complete individually or with a team. Assignments usually encourage or require a team to enforce practicing peer-to-peer interaction.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer reviewing and to find out the competent reviewers among all the reviewers, designing a new form of review for assignments seems to be a fix. As a result, &amp;quot;calibration assignment&amp;quot; was introduced to the Expertiza system. The calibration assignment should be assigned before the peer review so that the students can know if they reviewed using the same rubrics as the instructor.&lt;br /&gt;
To set up the calibration assignment that allows both the instructor and the students of the course to review, the instructor needs to create a new assignment and add all the participants manually, which is not a great experience.&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
To fix the issue of having too many steps of setting up the calibration assignment every semester,&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140561</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140561"/>
		<updated>2021-11-03T02:59:46Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Objectives */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Introduction===&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open-source education and classroom web-tool founded by the [http://www.nsf.gov/ National Science Foundation]. Built with Ruby on Rails, it is designed to manage complete courses and students’ work within those courses. Each course can have a collection of instructors and students, though the interaction between instructors and students is minimal. The real emphasis of Expertiza is placed on peer-to-peer interactions, fostering a student-driven learning environment. Courses are comprised of assignments which users complete individually or with a team. Assignments usually encourage or require a team to enforce practicing peer-to-peer interaction.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer reviewing and to find out the competent reviewers among all the reviewrs, designing a new form of assignment seems to be a fix. As a result, &amp;quot;calibration assignment&amp;quot; was introduced to the Expertiza system. &lt;br /&gt;
To set up the calibration assignment that allows both the instructor and the students of the course to review, the instructor needs to create a new assignment and add all the participants manually, which is not a great experience.&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
To fix the issue of having too many steps of setting up the calibration assignment every semester,&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140560</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140560"/>
		<updated>2021-11-03T02:56:20Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Project Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Introduction===&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open-source education and classroom web-tool founded by the [http://www.nsf.gov/ National Science Foundation]. Built with Ruby on Rails, it is designed to manage complete courses and students’ work within those courses. Each course can have a collection of instructors and students, though the interaction between instructors and students is minimal. The real emphasis of Expertiza is placed on peer-to-peer interactions, fostering a student-driven learning environment. Courses are comprised of assignments which users complete individually or with a team. Assignments usually encourage or require a team to enforce practicing peer-to-peer interaction.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
To improve the experience of peer reviewing and to find out the competent reviewers among all the reviewrs, designing a new form of assignment seems to be a fix. As a result, &amp;quot;calibration assignment&amp;quot; was introduced to the Expertiza system. &lt;br /&gt;
To set up the calibration assignment that allows both the instructor and the students of the course to review, the instructor needs to create a new assignment and add all the participants manually, which is not a great experience.&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140542</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140542"/>
		<updated>2021-11-03T01:54:10Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Project Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Introduction===&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza] is an open-source education and classroom web-tool founded by the [http://www.nsf.gov/ National Science Foundation]. Built with Ruby on Rails, it is designed to manage complete courses and students’ work within those courses. Each course can have a collection of instructors and students, though the interaction between instructors and students is minimal. The real emphasis of Expertiza is placed on peer-to-peer interactions, fostering a student-driven learning environment. Courses are comprised of assignments which users complete individually or with a team. Assignments usually encourage or require a team to enforce practicing peer-to-peer interaction.&lt;br /&gt;
&lt;br /&gt;
===Background===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140541</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140541"/>
		<updated>2021-11-03T01:53:42Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Project Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===Introduction===&lt;br /&gt;
Expertiza is an open-source education and classroom web-tool founded by the National Science Foundation. Built with Ruby on Rails, it is designed to manage complete courses and students’ work within those courses. Each course can have a collection of instructors and students, though the interaction between instructors and students is minimal. The real emphasis of Expertiza is placed on peer-to-peer interactions, fostering a student-driven learning environment. Courses are comprised of assignments which users complete individually or with a team. Assignments usually encourage or require a team to enforce practicing peer-to-peer interaction.&lt;br /&gt;
===Background===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Previous Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Issues of Previous work===&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140449</id>
		<title>CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=140449"/>
		<updated>2021-11-02T20:55:37Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: Created page with &amp;quot;==Project Overview== ===   ''Background''   ===   ===   ''Objectives''   ===   ===   ''Previous Implementation''   ===   ===   ''Issues of Previous work''   ===   ==Design==...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Project Overview==&lt;br /&gt;
===   ''Background''   ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===   ''Objectives''   ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===   ''Previous Implementation''   ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===   ''Issues of Previous work''   ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021&amp;diff=140447</id>
		<title>CSC/ECE 517 Fall 2021</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021&amp;diff=140447"/>
		<updated>2021-11-02T20:41:48Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Final Projects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OSS Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2117. Refactor questionaires_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2128. Refactor student_quizzes_controller.rb &amp;amp; late_policies_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2129. Refactor auth_controller.rb &amp;amp; password_retrieval_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2132. Add tests cases for review mapping helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2134. Write unit tests for admin_controller.rb and institution_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2138. Auto-generate submission directory names based on assignment]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2142. Improve e-mail notifications]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2133. Write tests for popup_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2120. Refactor reputation_web_service_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2139. Remove multiple topics at a time]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2131. Improve assessment360_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2121. Refactor suggestion_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2122. Refactor impersonate_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2123. Refactor sign_up_sheet_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2126. Refactor account_request_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2124. Refactor review_mapping_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2125. Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2127. Refactor teams_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2130. Refactor submitted_content_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2140. Create new late policy successfully and fix Bank link]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2141. OSS project Finklestein: Instructors &amp;amp; Institutions]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2144. Refactor delayed mailer and scheduled task]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2147. Role-based reviewing]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2145. OSS Project Beige]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2146. Introduce a Student View for instructors]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - Refactor Evaluation of SQL Queries]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2135. Email notification to reviewers and instructors]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2168. Testing - Reputations]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2166. Testing - Scoring &amp;amp; Grades]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2021 - E2149. Finish Github metrics integration - Reputations]]&lt;br /&gt;
&lt;br /&gt;
== Final Projects ==&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2150._Integrate_suggestion_detection_algorithm#Description_about_project CSC/ECE 517 Fall 2021 - E2150. Integrate suggestion detection algorithm]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2152._Revision_planning_tool#Description_about_project CSC/ECE 517 Fall 2021 - E2152. Revision_planning_tool]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2170._Testing_-_Response_Maps#Description_about_project CSC/ECE 517 Fall 2021 - E2170. Testing - Response Maps]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2153._Improving_search_facility_in_Expertiza#Description_about_project CSC/ECE 517 Fall 2021 - E2153. Improving search facility in Expertiza]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2162._Further_refactoring_and_improvement_of_review_mapping_helper CSC/ECE 517 Fall 2021 - E2162. Further refactoring and improvement of review mapping helper]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2165._Fix_teammate-review_view CSC/ECE 517 Fall 2021 - E2165. Fix teammate review view ]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2158._Grading_audit_trail CSC/ECE 517 Fall 2021 - E2158. Grading audit trail ]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2155._Calibration_submissions_should_be_copied_along_with_calibration_assignments CSC/ECE 517 Fall 2021 - E2155. Calibration submissions should be copied along with calibration assignments]&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139199</id>
		<title>CSC/ECE 517 Fall 2021 - E2134. Write unit tests for admin controller.rb and institution controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139199"/>
		<updated>2021-10-19T19:05:01Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Our Team */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== E2134. Write unit tests for admin controller.rb and institution controller.rb ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2134. - Write unit tests for admin controller.rb and institution controller.rb&lt;br /&gt;
&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza allows authorized users to create/edit/delete information of institutions and for the admin to create/edit/delete information of instructors. The repository lacks systematic unit tests for both the admin controller and institution controller. We designed unit tests for these controllers based on several scenarios.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Admin_controller ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: admin1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 3, role_id: 4, parent_id: 1, name: 'Aministrator1'&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Lists all the instructors&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to list all the instructors in the database.&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to remove an instructor from the database.&lt;br /&gt;
*Tested tasks that are not allowed:&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
#:For users like admin, they are not supposed to be able to delete his/her own user account or any other administrators.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: admin2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 4, role_id: 4, parent_id: 1, name: 'Aministrator2'&lt;br /&gt;
&lt;br /&gt;
The data of admin 2 is used for super admin to test functions such as list administrators, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: super_admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: superadmin, id: 1, role_id: 5&lt;br /&gt;
&lt;br /&gt;
Super admin should be able to perform all the tasks other types of users can do.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: instructor1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1'&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 5: instructor2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2'&lt;br /&gt;
&lt;br /&gt;
The data of instructor 2 is used to test functions such as list instructors, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 6: student1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: student, id: 21, role_id: 1&lt;br /&gt;
&lt;br /&gt;
Student should not be able to perform any tasks within the admin controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#spec/controllers/admin_controller_spec.rb&lt;br /&gt;
describe AdminController do&lt;br /&gt;
  # create fake users&lt;br /&gt;
  let(:admin1) { build(:admin, id: 3, role_id: 4, parent_id: 1, name: 'Administrator1') }&lt;br /&gt;
  let(:admin2) { build(:admin, id: 4, role_id: 4, parent_id: 1, name: 'Administrator2') }&lt;br /&gt;
  let(:super_admin) { build(:superadmin, id: 1, role_id: 5) }&lt;br /&gt;
  let(:instructor1) { build(:instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1') }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2') }&lt;br /&gt;
  let(:student1) { build(:student, id: 21, role_id: 1) }&lt;br /&gt;
&lt;br /&gt;
  # create fake lists&lt;br /&gt;
  let(:admin_list) { [admin1, admin2] }&lt;br /&gt;
  let(:instructor_list) { [instructor1, instructor2] }&lt;br /&gt;
  let(:instructor_list_pid3) { [instructor1] }&lt;br /&gt;
  let(:instructor_list_pid4) { [instructor2] }&lt;br /&gt;
&lt;br /&gt;
  # define default behaviors for each method call&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(User).to receive(:find).with('3').and_return(admin1)&lt;br /&gt;
    allow(User).to receive(:find).with('1').and_return(super_admin)&lt;br /&gt;
    allow(User).to receive(:find).with('10').and_return(instructor1)&lt;br /&gt;
    allow(User).to receive(:where).with([&amp;quot;role_id = ?&amp;quot;, super_admin.role_id]).and_return([ super_admin ])&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: admin1.role).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:order).with(:name).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, super_admin.id).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:paginate).with(page: '1', per_page: 50).and_return(admin_list)&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: instructor1.role).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:order).with(:name).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, admin1.id).and_return(instructor_list_pid3)&lt;br /&gt;
    allow(instructor_list_pid3).to receive(:paginate).with(page: '1', per_page: 50).and_return(instructor_list_pid3)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    context 'when params action is list all instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'list_instructors'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is remove an instructor' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'remove_instructor'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is other than list and remove instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {:action =&amp;gt; 'remove_administrator'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   context '#list_super_administrators' do&lt;br /&gt;
     it 'lists all the Super-Administrators' do&lt;br /&gt;
       stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
       get :list_super_administrators&lt;br /&gt;
       expect(assigns(:users)).to eq([ super_admin ])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
  context '#show_super_administrator' do&lt;br /&gt;
    it 'find selected Super-Administrator and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '1'}&lt;br /&gt;
      get :show_super_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(super_admin)&lt;br /&gt;
      expect(assigns(:role)).to eq(super_admin.role)&lt;br /&gt;
      expect(response).to render_template(:show_super_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_administrators' do&lt;br /&gt;
    it 'lists all the admins' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_administrators, params&lt;br /&gt;
      expect(assigns(:users)).to eq(admin_list)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_administrator' do&lt;br /&gt;
    it 'find selected admin and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '3'}&lt;br /&gt;
      get :show_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(admin1)&lt;br /&gt;
      expect(assigns(:role)).to eq(admin1.role)&lt;br /&gt;
      expect(response).to render_template(:show_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_instructors' do&lt;br /&gt;
    it 'lists all the instructors' do&lt;br /&gt;
      stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_instructors, params&lt;br /&gt;
      expect(assigns(:users)).to eq(instructor_list_pid3)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_instructor' do&lt;br /&gt;
    it 'find selected instructor and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '10'}&lt;br /&gt;
      get :show_instructor, params&lt;br /&gt;
      expect(assigns(:user)).to eq(instructor1)&lt;br /&gt;
      expect(assigns(:role)).to eq(instructor1.role)&lt;br /&gt;
      expect(response).to render_template(:show_instructor)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Institution_controller ===&lt;br /&gt;
:institution, id: 1, name: 'test institution'&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: Admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:admin&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#:For users like admin, they are supposed to be able to edit all the institutions in the database.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: Instructor&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:instructor, id: 6&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#Creates a new institution object and renders institution new page&lt;br /&gt;
#Save a new institution to the database and being redirected to the institution list page with a successful message&lt;br /&gt;
#Update the information of an institution&lt;br /&gt;
#Delete an institution&lt;br /&gt;
*Tested tasks that will receive false:&lt;br /&gt;
#Fail to save a new institution to the database&lt;br /&gt;
#Fail to update the information of an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: TA&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:teaching_assistant, id: 8&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: student&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:student&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
describe InstitutionController do&lt;br /&gt;
  let(:admin) { build(:admin) }&lt;br /&gt;
  let(:instructor) { build(:instructor, id: 6) }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 66) }&lt;br /&gt;
  let(:ta) { build(:teaching_assistant, id: 8) }&lt;br /&gt;
  let(:student) { build(:student) }&lt;br /&gt;
&lt;br /&gt;
  # create fake data&lt;br /&gt;
  let(:institution) do&lt;br /&gt;
    build(:institution, id: 1, name: 'test institution')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # set default testing user&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(Institution).to receive(:find).with('1').and_return(institution)&lt;br /&gt;
    stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  end&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is edit or update' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {id: '1', action: 'edit'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role name of current user is admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the instructor' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the TAs or the students' do&lt;br /&gt;
        it 'deny certain action' do&lt;br /&gt;
          stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      context 'when current user is the students' do&lt;br /&gt;
        it 'deny certain action' do&lt;br /&gt;
          stub_current_user(student, student.role.name, student.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#new' do&lt;br /&gt;
    it 'creates a new Institution object and renders institution#new page' do&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      get :new&lt;br /&gt;
      expect(response).to render_template(:new)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    context 'when institution is saved successfully' do&lt;br /&gt;
      it 'redirects to institution#list page and returns a successful message' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        allow(institution).to receive(:name).and_return(&amp;quot;test institution&amp;quot;)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(flash.now[:success]).to eq('The institution was successfully created.')&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when institution is not saved successfully' do&lt;br /&gt;
      it 'renders institution#new page and returns an error message' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        # make save function always return false&lt;br /&gt;
        allow(institution).to receive(:save).and_return(false)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(flash.now[:error]).to eq('The creation of the institution failed.')&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#edit' do&lt;br /&gt;
    it 'renders institution#edit' do&lt;br /&gt;
      @params = {&lt;br /&gt;
          id: 1&lt;br /&gt;
      }&lt;br /&gt;
      get :edit, @params&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#update' do&lt;br /&gt;
    context 'when institution is updated successfully' do&lt;br /&gt;
      it 'renders institution#list and returns a successful message' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1,&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        put :update, @params&lt;br /&gt;
        expect(flash[:success]).to eq('The institution was successfully updated.')&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'when institution is not updated successfully' do&lt;br /&gt;
      it 'renders institution#edit' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1,&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        allow(institution).to receive(:update_attribute).with(any_args).and_return(false)&lt;br /&gt;
        put :update, @params&lt;br /&gt;
        expect(response).to render_template(:edit)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#index' do&lt;br /&gt;
    context 'when institution query all institution' do&lt;br /&gt;
      it 'renders institution#list' do&lt;br /&gt;
        get :index&lt;br /&gt;
        expect(response).to render_template(:list)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#show' do&lt;br /&gt;
    context 'when try to show a institution' do&lt;br /&gt;
      it 'renders institution#show when find the target institution' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        get :show, @params&lt;br /&gt;
        expect(response).to render_template(:show)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#delete' do&lt;br /&gt;
    context 'when try to delete a institution' do&lt;br /&gt;
      it 'renders institution#list when delete successfully' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        # mock a situation that delete action successfully&lt;br /&gt;
        allow(institution).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
        post :delete, @params&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo ==&lt;br /&gt;
&lt;br /&gt;
Demo of admin_controller_spec [https://www.youtube.com/watch?v=OZaaVLBul6Y&amp;amp;list=PLaoBe-cpzKA6Eq9xSogYiatOcOeSoRLQN&amp;amp;index=1 click here]&lt;br /&gt;
&lt;br /&gt;
Demo of institution_controller_spec [https://www.youtube.com/watch?v=A1vuITGSRBI&amp;amp;list=PLaoBe-cpzKA6Eq9xSogYiatOcOeSoRLQN&amp;amp;index=2 click here]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
*Yu-Hsuan Lo (ylo) (githubID: [https://github.com/yhslo yhslo])&lt;br /&gt;
&lt;br /&gt;
*Chao-Ting Hung (chung4) (githubID: [https://github.com/gggho0806 gggho0806])&lt;br /&gt;
&lt;br /&gt;
*Lee Shyu (lshyu) (githubID: [https://github.com/ls-hyu ls-hyu])&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo [https://github.com/yhslo/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza click here]&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139197</id>
		<title>CSC/ECE 517 Fall 2021 - E2134. Write unit tests for admin controller.rb and institution controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139197"/>
		<updated>2021-10-19T19:02:04Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Our Team */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== E2134. Write unit tests for admin controller.rb and institution controller.rb ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2134. - Write unit tests for admin controller.rb and institution controller.rb&lt;br /&gt;
&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza allows authorized users to create/edit/delete information of institutions and for the admin to create/edit/delete information of instructors. The repository lacks systematic unit tests for both the admin controller and institution controller. We designed unit tests for these controllers based on several scenarios.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Admin_controller ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: admin1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 3, role_id: 4, parent_id: 1, name: 'Aministrator1'&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Lists all the instructors&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to list all the instructors in the database.&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to remove an instructor from the database.&lt;br /&gt;
*Tested tasks that are not allowed:&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
#:For users like admin, they are not supposed to be able to delete his/her own user account or any other administrators.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: admin2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 4, role_id: 4, parent_id: 1, name: 'Aministrator2'&lt;br /&gt;
&lt;br /&gt;
The data of admin 2 is used for super admin to test functions such as list administrators, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: super_admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: superadmin, id: 1, role_id: 5&lt;br /&gt;
&lt;br /&gt;
Super admin should be able to perform all the tasks other types of users can do.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: instructor1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1'&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 5: instructor2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2'&lt;br /&gt;
&lt;br /&gt;
The data of instructor 2 is used to test functions such as list instructors, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 6: student1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: student, id: 21, role_id: 1&lt;br /&gt;
&lt;br /&gt;
Student should not be able to perform any tasks within the admin controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#spec/controllers/admin_controller_spec.rb&lt;br /&gt;
describe AdminController do&lt;br /&gt;
  # create fake users&lt;br /&gt;
  let(:admin1) { build(:admin, id: 3, role_id: 4, parent_id: 1, name: 'Administrator1') }&lt;br /&gt;
  let(:admin2) { build(:admin, id: 4, role_id: 4, parent_id: 1, name: 'Administrator2') }&lt;br /&gt;
  let(:super_admin) { build(:superadmin, id: 1, role_id: 5) }&lt;br /&gt;
  let(:instructor1) { build(:instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1') }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2') }&lt;br /&gt;
  let(:student1) { build(:student, id: 21, role_id: 1) }&lt;br /&gt;
&lt;br /&gt;
  # create fake lists&lt;br /&gt;
  let(:admin_list) { [admin1, admin2] }&lt;br /&gt;
  let(:instructor_list) { [instructor1, instructor2] }&lt;br /&gt;
  let(:instructor_list_pid3) { [instructor1] }&lt;br /&gt;
  let(:instructor_list_pid4) { [instructor2] }&lt;br /&gt;
&lt;br /&gt;
  # define default behaviors for each method call&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(User).to receive(:find).with('3').and_return(admin1)&lt;br /&gt;
    allow(User).to receive(:find).with('1').and_return(super_admin)&lt;br /&gt;
    allow(User).to receive(:find).with('10').and_return(instructor1)&lt;br /&gt;
    allow(User).to receive(:where).with([&amp;quot;role_id = ?&amp;quot;, super_admin.role_id]).and_return([ super_admin ])&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: admin1.role).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:order).with(:name).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, super_admin.id).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:paginate).with(page: '1', per_page: 50).and_return(admin_list)&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: instructor1.role).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:order).with(:name).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, admin1.id).and_return(instructor_list_pid3)&lt;br /&gt;
    allow(instructor_list_pid3).to receive(:paginate).with(page: '1', per_page: 50).and_return(instructor_list_pid3)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    context 'when params action is list all instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'list_instructors'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is remove an instructor' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'remove_instructor'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is other than list and remove instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {:action =&amp;gt; 'remove_administrator'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   context '#list_super_administrators' do&lt;br /&gt;
     it 'lists all the Super-Administrators' do&lt;br /&gt;
       stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
       get :list_super_administrators&lt;br /&gt;
       expect(assigns(:users)).to eq([ super_admin ])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
  context '#show_super_administrator' do&lt;br /&gt;
    it 'find selected Super-Administrator and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '1'}&lt;br /&gt;
      get :show_super_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(super_admin)&lt;br /&gt;
      expect(assigns(:role)).to eq(super_admin.role)&lt;br /&gt;
      expect(response).to render_template(:show_super_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_administrators' do&lt;br /&gt;
    it 'lists all the admins' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_administrators, params&lt;br /&gt;
      expect(assigns(:users)).to eq(admin_list)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_administrator' do&lt;br /&gt;
    it 'find selected admin and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '3'}&lt;br /&gt;
      get :show_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(admin1)&lt;br /&gt;
      expect(assigns(:role)).to eq(admin1.role)&lt;br /&gt;
      expect(response).to render_template(:show_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_instructors' do&lt;br /&gt;
    it 'lists all the instructors' do&lt;br /&gt;
      stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_instructors, params&lt;br /&gt;
      expect(assigns(:users)).to eq(instructor_list_pid3)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_instructor' do&lt;br /&gt;
    it 'find selected instructor and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '10'}&lt;br /&gt;
      get :show_instructor, params&lt;br /&gt;
      expect(assigns(:user)).to eq(instructor1)&lt;br /&gt;
      expect(assigns(:role)).to eq(instructor1.role)&lt;br /&gt;
      expect(response).to render_template(:show_instructor)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Institution_controller ===&lt;br /&gt;
:institution, id: 1, name: 'test institution'&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: Admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:admin&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#:For users like admin, they are supposed to be able to edit all the institutions in the database.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: Instructor&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:instructor, id: 6&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#Creates a new institution object and renders institution new page&lt;br /&gt;
#Save a new institution to the database and being redirected to the institution list page with a successful message&lt;br /&gt;
#Update the information of an institution&lt;br /&gt;
#Delete an institution&lt;br /&gt;
*Tested tasks that will receive false:&lt;br /&gt;
#Fail to save a new institution to the database&lt;br /&gt;
#Fail to update the information of an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: TA&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:teaching_assistant, id: 8&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: student&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:student&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
describe InstitutionController do&lt;br /&gt;
  let(:admin) { build(:admin) }&lt;br /&gt;
  let(:instructor) { build(:instructor, id: 6) }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 66) }&lt;br /&gt;
  let(:ta) { build(:teaching_assistant, id: 8) }&lt;br /&gt;
  let(:student) { build(:student) }&lt;br /&gt;
&lt;br /&gt;
  # create fake data&lt;br /&gt;
  let(:institution) do&lt;br /&gt;
    build(:institution, id: 1, name: 'test institution')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # set default testing user&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(Institution).to receive(:find).with('1').and_return(institution)&lt;br /&gt;
    stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  end&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is edit or update' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {id: '1', action: 'edit'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role name of current user is admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the instructor' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the TAs or the students' do&lt;br /&gt;
        it 'deny certain action' do&lt;br /&gt;
          stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      context 'when current user is the students' do&lt;br /&gt;
        it 'deny certain action' do&lt;br /&gt;
          stub_current_user(student, student.role.name, student.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#new' do&lt;br /&gt;
    it 'creates a new Institution object and renders institution#new page' do&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      get :new&lt;br /&gt;
      expect(response).to render_template(:new)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    context 'when institution is saved successfully' do&lt;br /&gt;
      it 'redirects to institution#list page and returns a successful message' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        allow(institution).to receive(:name).and_return(&amp;quot;test institution&amp;quot;)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(flash.now[:success]).to eq('The institution was successfully created.')&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when institution is not saved successfully' do&lt;br /&gt;
      it 'renders institution#new page and returns an error message' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        # make save function always return false&lt;br /&gt;
        allow(institution).to receive(:save).and_return(false)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(flash.now[:error]).to eq('The creation of the institution failed.')&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#edit' do&lt;br /&gt;
    it 'renders institution#edit' do&lt;br /&gt;
      @params = {&lt;br /&gt;
          id: 1&lt;br /&gt;
      }&lt;br /&gt;
      get :edit, @params&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#update' do&lt;br /&gt;
    context 'when institution is updated successfully' do&lt;br /&gt;
      it 'renders institution#list and returns a successful message' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1,&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        put :update, @params&lt;br /&gt;
        expect(flash[:success]).to eq('The institution was successfully updated.')&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'when institution is not updated successfully' do&lt;br /&gt;
      it 'renders institution#edit' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1,&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        allow(institution).to receive(:update_attribute).with(any_args).and_return(false)&lt;br /&gt;
        put :update, @params&lt;br /&gt;
        expect(response).to render_template(:edit)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#index' do&lt;br /&gt;
    context 'when institution query all institution' do&lt;br /&gt;
      it 'renders institution#list' do&lt;br /&gt;
        get :index&lt;br /&gt;
        expect(response).to render_template(:list)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#show' do&lt;br /&gt;
    context 'when try to show a institution' do&lt;br /&gt;
      it 'renders institution#show when find the target institution' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        get :show, @params&lt;br /&gt;
        expect(response).to render_template(:show)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#delete' do&lt;br /&gt;
    context 'when try to delete a institution' do&lt;br /&gt;
      it 'renders institution#list when delete successfully' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        # mock a situation that delete action successfully&lt;br /&gt;
        allow(institution).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
        post :delete, @params&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo ==&lt;br /&gt;
&lt;br /&gt;
Demo of admin_controller_spec [https://www.youtube.com/watch?v=OZaaVLBul6Y&amp;amp;list=PLaoBe-cpzKA6Eq9xSogYiatOcOeSoRLQN&amp;amp;index=1 click here]&lt;br /&gt;
&lt;br /&gt;
Demo of institution_controller_spec [https://www.youtube.com/watch?v=A1vuITGSRBI&amp;amp;list=PLaoBe-cpzKA6Eq9xSogYiatOcOeSoRLQN&amp;amp;index=2 click here]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
*Yu-Hsuan Lo (ylo) (githubID: yhslo)&lt;br /&gt;
&lt;br /&gt;
*Chao-Ting Hung (chung4) (githubID: gggho0806)&lt;br /&gt;
&lt;br /&gt;
*Lee Shyu (lshyu) (githubID: ls-hyu)&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo [https://github.com/yhslo/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza click here]&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139196</id>
		<title>CSC/ECE 517 Fall 2021 - E2134. Write unit tests for admin controller.rb and institution controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139196"/>
		<updated>2021-10-19T19:00:05Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Demo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== E2134. Write unit tests for admin controller.rb and institution controller.rb ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2134. - Write unit tests for admin controller.rb and institution controller.rb&lt;br /&gt;
&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza allows authorized users to create/edit/delete information of institutions and for the admin to create/edit/delete information of instructors. The repository lacks systematic unit tests for both the admin controller and institution controller. We designed unit tests for these controllers based on several scenarios.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Admin_controller ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: admin1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 3, role_id: 4, parent_id: 1, name: 'Aministrator1'&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Lists all the instructors&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to list all the instructors in the database.&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to remove an instructor from the database.&lt;br /&gt;
*Tested tasks that are not allowed:&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
#:For users like admin, they are not supposed to be able to delete his/her own user account or any other administrators.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: admin2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 4, role_id: 4, parent_id: 1, name: 'Aministrator2'&lt;br /&gt;
&lt;br /&gt;
The data of admin 2 is used for super admin to test functions such as list administrators, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: super_admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: superadmin, id: 1, role_id: 5&lt;br /&gt;
&lt;br /&gt;
Super admin should be able to perform all the tasks other types of users can do.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: instructor1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1'&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 5: instructor2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2'&lt;br /&gt;
&lt;br /&gt;
The data of instructor 2 is used to test functions such as list instructors, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 6: student1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: student, id: 21, role_id: 1&lt;br /&gt;
&lt;br /&gt;
Student should not be able to perform any tasks within the admin controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#spec/controllers/admin_controller_spec.rb&lt;br /&gt;
describe AdminController do&lt;br /&gt;
  # create fake users&lt;br /&gt;
  let(:admin1) { build(:admin, id: 3, role_id: 4, parent_id: 1, name: 'Administrator1') }&lt;br /&gt;
  let(:admin2) { build(:admin, id: 4, role_id: 4, parent_id: 1, name: 'Administrator2') }&lt;br /&gt;
  let(:super_admin) { build(:superadmin, id: 1, role_id: 5) }&lt;br /&gt;
  let(:instructor1) { build(:instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1') }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2') }&lt;br /&gt;
  let(:student1) { build(:student, id: 21, role_id: 1) }&lt;br /&gt;
&lt;br /&gt;
  # create fake lists&lt;br /&gt;
  let(:admin_list) { [admin1, admin2] }&lt;br /&gt;
  let(:instructor_list) { [instructor1, instructor2] }&lt;br /&gt;
  let(:instructor_list_pid3) { [instructor1] }&lt;br /&gt;
  let(:instructor_list_pid4) { [instructor2] }&lt;br /&gt;
&lt;br /&gt;
  # define default behaviors for each method call&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(User).to receive(:find).with('3').and_return(admin1)&lt;br /&gt;
    allow(User).to receive(:find).with('1').and_return(super_admin)&lt;br /&gt;
    allow(User).to receive(:find).with('10').and_return(instructor1)&lt;br /&gt;
    allow(User).to receive(:where).with([&amp;quot;role_id = ?&amp;quot;, super_admin.role_id]).and_return([ super_admin ])&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: admin1.role).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:order).with(:name).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, super_admin.id).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:paginate).with(page: '1', per_page: 50).and_return(admin_list)&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: instructor1.role).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:order).with(:name).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, admin1.id).and_return(instructor_list_pid3)&lt;br /&gt;
    allow(instructor_list_pid3).to receive(:paginate).with(page: '1', per_page: 50).and_return(instructor_list_pid3)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    context 'when params action is list all instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'list_instructors'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is remove an instructor' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'remove_instructor'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is other than list and remove instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {:action =&amp;gt; 'remove_administrator'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   context '#list_super_administrators' do&lt;br /&gt;
     it 'lists all the Super-Administrators' do&lt;br /&gt;
       stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
       get :list_super_administrators&lt;br /&gt;
       expect(assigns(:users)).to eq([ super_admin ])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
  context '#show_super_administrator' do&lt;br /&gt;
    it 'find selected Super-Administrator and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '1'}&lt;br /&gt;
      get :show_super_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(super_admin)&lt;br /&gt;
      expect(assigns(:role)).to eq(super_admin.role)&lt;br /&gt;
      expect(response).to render_template(:show_super_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_administrators' do&lt;br /&gt;
    it 'lists all the admins' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_administrators, params&lt;br /&gt;
      expect(assigns(:users)).to eq(admin_list)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_administrator' do&lt;br /&gt;
    it 'find selected admin and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '3'}&lt;br /&gt;
      get :show_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(admin1)&lt;br /&gt;
      expect(assigns(:role)).to eq(admin1.role)&lt;br /&gt;
      expect(response).to render_template(:show_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_instructors' do&lt;br /&gt;
    it 'lists all the instructors' do&lt;br /&gt;
      stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_instructors, params&lt;br /&gt;
      expect(assigns(:users)).to eq(instructor_list_pid3)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_instructor' do&lt;br /&gt;
    it 'find selected instructor and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '10'}&lt;br /&gt;
      get :show_instructor, params&lt;br /&gt;
      expect(assigns(:user)).to eq(instructor1)&lt;br /&gt;
      expect(assigns(:role)).to eq(instructor1.role)&lt;br /&gt;
      expect(response).to render_template(:show_instructor)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Institution_controller ===&lt;br /&gt;
:institution, id: 1, name: 'test institution'&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: Admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:admin&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#:For users like admin, they are supposed to be able to edit all the institutions in the database.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: Instructor&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:instructor, id: 6&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#Creates a new institution object and renders institution new page&lt;br /&gt;
#Save a new institution to the database and being redirected to the institution list page with a successful message&lt;br /&gt;
#Update the information of an institution&lt;br /&gt;
#Delete an institution&lt;br /&gt;
*Tested tasks that will receive false:&lt;br /&gt;
#Fail to save a new institution to the database&lt;br /&gt;
#Fail to update the information of an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: TA&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:teaching_assistant, id: 8&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: student&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:student&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
describe InstitutionController do&lt;br /&gt;
  let(:admin) { build(:admin) }&lt;br /&gt;
  let(:instructor) { build(:instructor, id: 6) }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 66) }&lt;br /&gt;
  let(:ta) { build(:teaching_assistant, id: 8) }&lt;br /&gt;
  let(:student) { build(:student) }&lt;br /&gt;
&lt;br /&gt;
  # create fake data&lt;br /&gt;
  let(:institution) do&lt;br /&gt;
    build(:institution, id: 1, name: 'test institution')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # set default testing user&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(Institution).to receive(:find).with('1').and_return(institution)&lt;br /&gt;
    stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  end&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is edit or update' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {id: '1', action: 'edit'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role name of current user is admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the instructor' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the TAs or the students' do&lt;br /&gt;
        it 'deny certain action' do&lt;br /&gt;
          stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      context 'when current user is the students' do&lt;br /&gt;
        it 'deny certain action' do&lt;br /&gt;
          stub_current_user(student, student.role.name, student.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#new' do&lt;br /&gt;
    it 'creates a new Institution object and renders institution#new page' do&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      get :new&lt;br /&gt;
      expect(response).to render_template(:new)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    context 'when institution is saved successfully' do&lt;br /&gt;
      it 'redirects to institution#list page and returns a successful message' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        allow(institution).to receive(:name).and_return(&amp;quot;test institution&amp;quot;)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(flash.now[:success]).to eq('The institution was successfully created.')&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when institution is not saved successfully' do&lt;br /&gt;
      it 'renders institution#new page and returns an error message' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        # make save function always return false&lt;br /&gt;
        allow(institution).to receive(:save).and_return(false)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(flash.now[:error]).to eq('The creation of the institution failed.')&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#edit' do&lt;br /&gt;
    it 'renders institution#edit' do&lt;br /&gt;
      @params = {&lt;br /&gt;
          id: 1&lt;br /&gt;
      }&lt;br /&gt;
      get :edit, @params&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#update' do&lt;br /&gt;
    context 'when institution is updated successfully' do&lt;br /&gt;
      it 'renders institution#list and returns a successful message' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1,&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        put :update, @params&lt;br /&gt;
        expect(flash[:success]).to eq('The institution was successfully updated.')&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'when institution is not updated successfully' do&lt;br /&gt;
      it 'renders institution#edit' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1,&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        allow(institution).to receive(:update_attribute).with(any_args).and_return(false)&lt;br /&gt;
        put :update, @params&lt;br /&gt;
        expect(response).to render_template(:edit)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#index' do&lt;br /&gt;
    context 'when institution query all institution' do&lt;br /&gt;
      it 'renders institution#list' do&lt;br /&gt;
        get :index&lt;br /&gt;
        expect(response).to render_template(:list)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#show' do&lt;br /&gt;
    context 'when try to show a institution' do&lt;br /&gt;
      it 'renders institution#show when find the target institution' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        get :show, @params&lt;br /&gt;
        expect(response).to render_template(:show)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#delete' do&lt;br /&gt;
    context 'when try to delete a institution' do&lt;br /&gt;
      it 'renders institution#list when delete successfully' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        # mock a situation that delete action successfully&lt;br /&gt;
        allow(institution).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
        post :delete, @params&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo ==&lt;br /&gt;
&lt;br /&gt;
Demo of admin_controller_spec [https://www.youtube.com/watch?v=OZaaVLBul6Y&amp;amp;list=PLaoBe-cpzKA6Eq9xSogYiatOcOeSoRLQN&amp;amp;index=1 click here]&lt;br /&gt;
&lt;br /&gt;
Demo of institution_controller_spec [https://www.youtube.com/watch?v=A1vuITGSRBI&amp;amp;list=PLaoBe-cpzKA6Eq9xSogYiatOcOeSoRLQN&amp;amp;index=2 click here]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo [https://github.com/yhslo/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza click here]&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139195</id>
		<title>CSC/ECE 517 Fall 2021 - E2134. Write unit tests for admin controller.rb and institution controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139195"/>
		<updated>2021-10-19T18:50:42Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /*  Code Snippet */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== E2134. Write unit tests for admin controller.rb and institution controller.rb ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2134. - Write unit tests for admin controller.rb and institution controller.rb&lt;br /&gt;
&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza allows authorized users to create/edit/delete information of institutions and for the admin to create/edit/delete information of instructors. The repository lacks systematic unit tests for both the admin controller and institution controller. We designed unit tests for these controllers based on several scenarios.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Admin_controller ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: admin1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 3, role_id: 4, parent_id: 1, name: 'Aministrator1'&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Lists all the instructors&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to list all the instructors in the database.&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to remove an instructor from the database.&lt;br /&gt;
*Tested tasks that are not allowed:&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
#:For users like admin, they are not supposed to be able to delete his/her own user account or any other administrators.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: admin2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 4, role_id: 4, parent_id: 1, name: 'Aministrator2'&lt;br /&gt;
&lt;br /&gt;
The data of admin 2 is used for super admin to test functions such as list administrators, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: super_admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: superadmin, id: 1, role_id: 5&lt;br /&gt;
&lt;br /&gt;
Super admin should be able to perform all the tasks other types of users can do.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: instructor1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1'&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 5: instructor2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2'&lt;br /&gt;
&lt;br /&gt;
The data of instructor 2 is used to test functions such as list instructors, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 6: student1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: student, id: 21, role_id: 1&lt;br /&gt;
&lt;br /&gt;
Student should not be able to perform any tasks within the admin controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#spec/controllers/admin_controller_spec.rb&lt;br /&gt;
describe AdminController do&lt;br /&gt;
  # create fake users&lt;br /&gt;
  let(:admin1) { build(:admin, id: 3, role_id: 4, parent_id: 1, name: 'Administrator1') }&lt;br /&gt;
  let(:admin2) { build(:admin, id: 4, role_id: 4, parent_id: 1, name: 'Administrator2') }&lt;br /&gt;
  let(:super_admin) { build(:superadmin, id: 1, role_id: 5) }&lt;br /&gt;
  let(:instructor1) { build(:instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1') }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2') }&lt;br /&gt;
  let(:student1) { build(:student, id: 21, role_id: 1) }&lt;br /&gt;
&lt;br /&gt;
  # create fake lists&lt;br /&gt;
  let(:admin_list) { [admin1, admin2] }&lt;br /&gt;
  let(:instructor_list) { [instructor1, instructor2] }&lt;br /&gt;
  let(:instructor_list_pid3) { [instructor1] }&lt;br /&gt;
  let(:instructor_list_pid4) { [instructor2] }&lt;br /&gt;
&lt;br /&gt;
  # define default behaviors for each method call&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(User).to receive(:find).with('3').and_return(admin1)&lt;br /&gt;
    allow(User).to receive(:find).with('1').and_return(super_admin)&lt;br /&gt;
    allow(User).to receive(:find).with('10').and_return(instructor1)&lt;br /&gt;
    allow(User).to receive(:where).with([&amp;quot;role_id = ?&amp;quot;, super_admin.role_id]).and_return([ super_admin ])&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: admin1.role).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:order).with(:name).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, super_admin.id).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:paginate).with(page: '1', per_page: 50).and_return(admin_list)&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: instructor1.role).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:order).with(:name).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, admin1.id).and_return(instructor_list_pid3)&lt;br /&gt;
    allow(instructor_list_pid3).to receive(:paginate).with(page: '1', per_page: 50).and_return(instructor_list_pid3)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    context 'when params action is list all instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'list_instructors'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is remove an instructor' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'remove_instructor'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is other than list and remove instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {:action =&amp;gt; 'remove_administrator'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   context '#list_super_administrators' do&lt;br /&gt;
     it 'lists all the Super-Administrators' do&lt;br /&gt;
       stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
       get :list_super_administrators&lt;br /&gt;
       expect(assigns(:users)).to eq([ super_admin ])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
  context '#show_super_administrator' do&lt;br /&gt;
    it 'find selected Super-Administrator and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '1'}&lt;br /&gt;
      get :show_super_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(super_admin)&lt;br /&gt;
      expect(assigns(:role)).to eq(super_admin.role)&lt;br /&gt;
      expect(response).to render_template(:show_super_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_administrators' do&lt;br /&gt;
    it 'lists all the admins' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_administrators, params&lt;br /&gt;
      expect(assigns(:users)).to eq(admin_list)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_administrator' do&lt;br /&gt;
    it 'find selected admin and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '3'}&lt;br /&gt;
      get :show_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(admin1)&lt;br /&gt;
      expect(assigns(:role)).to eq(admin1.role)&lt;br /&gt;
      expect(response).to render_template(:show_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_instructors' do&lt;br /&gt;
    it 'lists all the instructors' do&lt;br /&gt;
      stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_instructors, params&lt;br /&gt;
      expect(assigns(:users)).to eq(instructor_list_pid3)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_instructor' do&lt;br /&gt;
    it 'find selected instructor and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '10'}&lt;br /&gt;
      get :show_instructor, params&lt;br /&gt;
      expect(assigns(:user)).to eq(instructor1)&lt;br /&gt;
      expect(assigns(:role)).to eq(instructor1.role)&lt;br /&gt;
      expect(response).to render_template(:show_instructor)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Institution_controller ===&lt;br /&gt;
:institution, id: 1, name: 'test institution'&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: Admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:admin&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#:For users like admin, they are supposed to be able to edit all the institutions in the database.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: Instructor&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:instructor, id: 6&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#Creates a new institution object and renders institution new page&lt;br /&gt;
#Save a new institution to the database and being redirected to the institution list page with a successful message&lt;br /&gt;
#Update the information of an institution&lt;br /&gt;
#Delete an institution&lt;br /&gt;
*Tested tasks that will receive false:&lt;br /&gt;
#Fail to save a new institution to the database&lt;br /&gt;
#Fail to update the information of an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: TA&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:teaching_assistant, id: 8&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: student&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:student&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
describe InstitutionController do&lt;br /&gt;
  let(:admin) { build(:admin) }&lt;br /&gt;
  let(:instructor) { build(:instructor, id: 6) }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 66) }&lt;br /&gt;
  let(:ta) { build(:teaching_assistant, id: 8) }&lt;br /&gt;
  let(:student) { build(:student) }&lt;br /&gt;
&lt;br /&gt;
  # create fake data&lt;br /&gt;
  let(:institution) do&lt;br /&gt;
    build(:institution, id: 1, name: 'test institution')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # set default testing user&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(Institution).to receive(:find).with('1').and_return(institution)&lt;br /&gt;
    stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  end&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is edit or update' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {id: '1', action: 'edit'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role name of current user is admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the instructor' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the TAs or the students' do&lt;br /&gt;
        it 'deny certain action' do&lt;br /&gt;
          stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      context 'when current user is the students' do&lt;br /&gt;
        it 'deny certain action' do&lt;br /&gt;
          stub_current_user(student, student.role.name, student.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#new' do&lt;br /&gt;
    it 'creates a new Institution object and renders institution#new page' do&lt;br /&gt;
      stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
      get :new&lt;br /&gt;
      expect(response).to render_template(:new)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    context 'when institution is saved successfully' do&lt;br /&gt;
      it 'redirects to institution#list page and returns a successful message' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        allow(institution).to receive(:name).and_return(&amp;quot;test institution&amp;quot;)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(flash.now[:success]).to eq('The institution was successfully created.')&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when institution is not saved successfully' do&lt;br /&gt;
      it 'renders institution#new page and returns an error message' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        # make save function always return false&lt;br /&gt;
        allow(institution).to receive(:save).and_return(false)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(flash.now[:error]).to eq('The creation of the institution failed.')&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#edit' do&lt;br /&gt;
    it 'renders institution#edit' do&lt;br /&gt;
      @params = {&lt;br /&gt;
          id: 1&lt;br /&gt;
      }&lt;br /&gt;
      get :edit, @params&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#update' do&lt;br /&gt;
    context 'when institution is updated successfully' do&lt;br /&gt;
      it 'renders institution#list and returns a successful message' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1,&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        put :update, @params&lt;br /&gt;
        expect(flash[:success]).to eq('The institution was successfully updated.')&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'when institution is not updated successfully' do&lt;br /&gt;
      it 'renders institution#edit' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1,&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        allow(institution).to receive(:update_attribute).with(any_args).and_return(false)&lt;br /&gt;
        put :update, @params&lt;br /&gt;
        expect(response).to render_template(:edit)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#index' do&lt;br /&gt;
    context 'when institution query all institution' do&lt;br /&gt;
      it 'renders institution#list' do&lt;br /&gt;
        get :index&lt;br /&gt;
        expect(response).to render_template(:list)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#show' do&lt;br /&gt;
    context 'when try to show a institution' do&lt;br /&gt;
      it 'renders institution#show when find the target institution' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        get :show, @params&lt;br /&gt;
        expect(response).to render_template(:show)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#delete' do&lt;br /&gt;
    context 'when try to delete a institution' do&lt;br /&gt;
      it 'renders institution#list when delete successfully' do&lt;br /&gt;
        stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        # mock a situation that delete action successfully&lt;br /&gt;
        allow(institution).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
        post :delete, @params&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo ==&lt;br /&gt;
&lt;br /&gt;
Demo of admin_controller_spec [https://youtu.be/OZaaVLBul6Y click here]&lt;br /&gt;
&lt;br /&gt;
Demo of institution_controller_spec [https://youtu.be/A1vuITGSRBI click here]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo [https://github.com/yhslo/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza click here]&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139168</id>
		<title>CSC/ECE 517 Fall 2021 - E2134. Write unit tests for admin controller.rb and institution controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139168"/>
		<updated>2021-10-19T03:06:26Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Institution_controller */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== E2134. Write unit tests for admin controller.rb and institution controller.rb ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2134. - Write unit tests for admin controller.rb and institution controller.rb&lt;br /&gt;
&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza allows authorized users to create/edit/delete information of institutions and for the admin to create/edit/delete information of instructors. The repository lacks systematic unit tests for both the admin controller and institution controller. We designed unit tests for these controllers based on several scenarios.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Admin_controller ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: admin1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 3, role_id: 4, parent_id: 1, name: 'Aministrator1'&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Lists all the instructors&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to list all the instructors in the database.&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to remove an instructor from the database.&lt;br /&gt;
*Tested tasks that are not allowed:&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
#:For users like admin, they are not supposed to be able to delete his/her own user account or any other administrators.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: admin2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 4, role_id: 4, parent_id: 1, name: 'Aministrator2'&lt;br /&gt;
&lt;br /&gt;
The data of admin 2 is used for super admin to test functions such as list administrators, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: super_admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: superadmin, id: 1, role_id: 5&lt;br /&gt;
&lt;br /&gt;
Super admin should be able to perform all the tasks other types of users can do.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: instructor1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1'&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 5: instructor2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2'&lt;br /&gt;
&lt;br /&gt;
The data of instructor 2 is used to test functions such as list instructors, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 6: student1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: student, id: 21, role_id: 1&lt;br /&gt;
&lt;br /&gt;
Student should not be able to perform any tasks within the admin controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#spec/controllers/admin_controller_spec.rb&lt;br /&gt;
describe AdminController do&lt;br /&gt;
  # create fake users&lt;br /&gt;
  let(:admin1) { build(:admin, id: 3, role_id: 4, parent_id: 1, name: 'Administrator1') }&lt;br /&gt;
  let(:admin2) { build(:admin, id: 4, role_id: 4, parent_id: 1, name: 'Administrator2') }&lt;br /&gt;
  let(:super_admin) { build(:superadmin, id: 1, role_id: 5) }&lt;br /&gt;
  let(:instructor1) { build(:instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1') }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2') }&lt;br /&gt;
  let(:student1) { build(:student, id: 21, role_id: 1) }&lt;br /&gt;
&lt;br /&gt;
  # create fake lists&lt;br /&gt;
  let(:admin_list) { [admin1, admin2] }&lt;br /&gt;
  let(:instructor_list) { [instructor1, instructor2] }&lt;br /&gt;
  let(:instructor_list_pid3) { [instructor1] }&lt;br /&gt;
  let(:instructor_list_pid4) { [instructor2] }&lt;br /&gt;
&lt;br /&gt;
  # define default behaviors for each method call&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(User).to receive(:find).with('3').and_return(admin1)&lt;br /&gt;
    allow(User).to receive(:find).with('1').and_return(super_admin)&lt;br /&gt;
    allow(User).to receive(:find).with('10').and_return(instructor1)&lt;br /&gt;
    allow(User).to receive(:where).with([&amp;quot;role_id = ?&amp;quot;, super_admin.role_id]).and_return([ super_admin ])&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: admin1.role).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:order).with(:name).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, super_admin.id).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:paginate).with(page: '1', per_page: 50).and_return(admin_list)&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: instructor1.role).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:order).with(:name).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, admin1.id).and_return(instructor_list_pid3)&lt;br /&gt;
    allow(instructor_list_pid3).to receive(:paginate).with(page: '1', per_page: 50).and_return(instructor_list_pid3)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    context 'when params action is list all instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'list_instructors'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is remove an instructor' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'remove_instructor'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is other than list and remove instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {:action =&amp;gt; 'remove_administrator'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   context '#list_super_administrators' do&lt;br /&gt;
     it 'lists all the Super-Administrators' do&lt;br /&gt;
       stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
       get :list_super_administrators&lt;br /&gt;
       expect(assigns(:users)).to eq([ super_admin ])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
  context '#show_super_administrator' do&lt;br /&gt;
    it 'find selected Super-Administrator and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '1'}&lt;br /&gt;
      get :show_super_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(super_admin)&lt;br /&gt;
      expect(assigns(:role)).to eq(super_admin.role)&lt;br /&gt;
      expect(response).to render_template(:show_super_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_administrators' do&lt;br /&gt;
    it 'lists all the admins' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_administrators, params&lt;br /&gt;
      expect(assigns(:users)).to eq(admin_list)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_administrator' do&lt;br /&gt;
    it 'find selected admin and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '3'}&lt;br /&gt;
      get :show_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(admin1)&lt;br /&gt;
      expect(assigns(:role)).to eq(admin1.role)&lt;br /&gt;
      expect(response).to render_template(:show_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_instructors' do&lt;br /&gt;
    it 'lists all the instructors' do&lt;br /&gt;
      stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_instructors, params&lt;br /&gt;
      expect(assigns(:users)).to eq(instructor_list_pid3)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_instructor' do&lt;br /&gt;
    it 'find selected instructor and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '10'}&lt;br /&gt;
      get :show_instructor, params&lt;br /&gt;
      expect(assigns(:user)).to eq(instructor1)&lt;br /&gt;
      expect(assigns(:role)).to eq(instructor1.role)&lt;br /&gt;
      expect(response).to render_template(:show_instructor)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Institution_controller ===&lt;br /&gt;
:institution, id: 1, name: 'test institution'&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: Admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:admin&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#:For users like admin, they are supposed to be able to edit all the institutions in the database.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: Instructor&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:instructor, id: 6&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#Creates a new institution object and renders institution new page&lt;br /&gt;
#Save a new institution to the database and being redirected to the institution list page with a successful message&lt;br /&gt;
#Update the information of an institution&lt;br /&gt;
#Delete an institution&lt;br /&gt;
*Tested tasks that will receive false:&lt;br /&gt;
#Fail to save a new institution to the database&lt;br /&gt;
#Fail to update the information of an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: TA&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:teaching_assistant, id: 8&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: student&amp;lt;/font&amp;gt; ====&lt;br /&gt;
:student&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
describe InstitutionController do&lt;br /&gt;
  let(:admin) { build(:admin) }&lt;br /&gt;
  let(:instructor) { build(:instructor, id: 6) }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 66) }&lt;br /&gt;
  let(:ta) { build(:teaching_assistant, id: 8) }&lt;br /&gt;
  let(:student) { build(:student) }&lt;br /&gt;
&lt;br /&gt;
  # create fake data&lt;br /&gt;
  let(:institution) do&lt;br /&gt;
    build(:institution, id: 1, name: 'test institution')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  let(:course) do&lt;br /&gt;
    build(:course, instructor_id: 6, institutions_id:1, name: 'abc')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # set default testing user&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(Institution).to receive(:find).with('1').and_return(institution)&lt;br /&gt;
    allow(Course).to receive(:where).with(institution_id: '1').and_return(course)&lt;br /&gt;
    stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  end&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is edit or update' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {id: '1', action: 'edit'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role name of current user is super admin or admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the instructor' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the TAs or the students' do&lt;br /&gt;
        it 'deny certain action if current user is the TA' do&lt;br /&gt;
          stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        it 'deny certain action if current user is the student' do&lt;br /&gt;
          stub_current_user(student, student.role.name, student.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#new' do&lt;br /&gt;
    it 'creates a new Institution object and renders institution#new page' do&lt;br /&gt;
      get :new&lt;br /&gt;
      expect(response).to render_template(:new)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    context 'when institution is saved successfully' do&lt;br /&gt;
      it 'redirects to institution#list page' do&lt;br /&gt;
        allow(institution).to receive(:name).and_return(&amp;quot;test institution&amp;quot;)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when institution is not saved successfully' do&lt;br /&gt;
      it 'renders institution#new page' do&lt;br /&gt;
        allow(institution).to receive(:save).and_return(false)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(flash.now[:error]).to eq('The creation of the institution failed.')&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#edit' do&lt;br /&gt;
    it 'renders institution#edit' do&lt;br /&gt;
      @params = {&lt;br /&gt;
          id: 1&lt;br /&gt;
      }&lt;br /&gt;
      get :edit, @params&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#update' do&lt;br /&gt;
    context 'when institution is updated successfully' do&lt;br /&gt;
      it 'renders institution#list' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1,&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        put :update, @params&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#index' do&lt;br /&gt;
    context 'when institution query all institution' do&lt;br /&gt;
      it 'renders institution#list' do&lt;br /&gt;
        get :index&lt;br /&gt;
        expect(response).to render_template(:list)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#show' do&lt;br /&gt;
    context 'when try to show a institution' do&lt;br /&gt;
      it 'renders institution#show when find the target institution' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        get :show, @params&lt;br /&gt;
        expect(response).to render_template(:show)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#delete' do&lt;br /&gt;
    context 'when try to delete a institution' do&lt;br /&gt;
      it 'renders institution#list when delete successfully' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        post :delete, @params, session&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo ==&lt;br /&gt;
&lt;br /&gt;
Demo of admin_controller_spec [https://youtu.be/OZaaVLBul6Y click here]&lt;br /&gt;
&lt;br /&gt;
Demo of institution_controller_spec [https://youtu.be/A1vuITGSRBI click here]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo [https://github.com/yhslo/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza click here]&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139167</id>
		<title>CSC/ECE 517 Fall 2021 - E2134. Write unit tests for admin controller.rb and institution controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139167"/>
		<updated>2021-10-19T03:03:23Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Institution_controller */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== E2134. Write unit tests for admin controller.rb and institution controller.rb ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2134. - Write unit tests for admin controller.rb and institution controller.rb&lt;br /&gt;
&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza allows authorized users to create/edit/delete information of institutions and for the admin to create/edit/delete information of instructors. The repository lacks systematic unit tests for both the admin controller and institution controller. We designed unit tests for these controllers based on several scenarios.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Admin_controller ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: admin1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 3, role_id: 4, parent_id: 1, name: 'Aministrator1'&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Lists all the instructors&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to list all the instructors in the database.&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to remove an instructor from the database.&lt;br /&gt;
*Tested tasks that are not allowed:&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
#:For users like admin, they are not supposed to be able to delete his/her own user account or any other administrators.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: admin2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 4, role_id: 4, parent_id: 1, name: 'Aministrator2'&lt;br /&gt;
&lt;br /&gt;
The data of admin 2 is used for super admin to test functions such as list administrators, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: super_admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: superadmin, id: 1, role_id: 5&lt;br /&gt;
&lt;br /&gt;
Super admin should be able to perform all the tasks other types of users can do.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: instructor1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1'&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 5: instructor2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2'&lt;br /&gt;
&lt;br /&gt;
The data of instructor 2 is used to test functions such as list instructors, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 6: student1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: student, id: 21, role_id: 1&lt;br /&gt;
&lt;br /&gt;
Student should not be able to perform any tasks within the admin controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#spec/controllers/admin_controller_spec.rb&lt;br /&gt;
describe AdminController do&lt;br /&gt;
  # create fake users&lt;br /&gt;
  let(:admin1) { build(:admin, id: 3, role_id: 4, parent_id: 1, name: 'Administrator1') }&lt;br /&gt;
  let(:admin2) { build(:admin, id: 4, role_id: 4, parent_id: 1, name: 'Administrator2') }&lt;br /&gt;
  let(:super_admin) { build(:superadmin, id: 1, role_id: 5) }&lt;br /&gt;
  let(:instructor1) { build(:instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1') }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2') }&lt;br /&gt;
  let(:student1) { build(:student, id: 21, role_id: 1) }&lt;br /&gt;
&lt;br /&gt;
  # create fake lists&lt;br /&gt;
  let(:admin_list) { [admin1, admin2] }&lt;br /&gt;
  let(:instructor_list) { [instructor1, instructor2] }&lt;br /&gt;
  let(:instructor_list_pid3) { [instructor1] }&lt;br /&gt;
  let(:instructor_list_pid4) { [instructor2] }&lt;br /&gt;
&lt;br /&gt;
  # define default behaviors for each method call&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(User).to receive(:find).with('3').and_return(admin1)&lt;br /&gt;
    allow(User).to receive(:find).with('1').and_return(super_admin)&lt;br /&gt;
    allow(User).to receive(:find).with('10').and_return(instructor1)&lt;br /&gt;
    allow(User).to receive(:where).with([&amp;quot;role_id = ?&amp;quot;, super_admin.role_id]).and_return([ super_admin ])&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: admin1.role).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:order).with(:name).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, super_admin.id).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:paginate).with(page: '1', per_page: 50).and_return(admin_list)&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: instructor1.role).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:order).with(:name).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, admin1.id).and_return(instructor_list_pid3)&lt;br /&gt;
    allow(instructor_list_pid3).to receive(:paginate).with(page: '1', per_page: 50).and_return(instructor_list_pid3)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    context 'when params action is list all instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'list_instructors'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is remove an instructor' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'remove_instructor'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is other than list and remove instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {:action =&amp;gt; 'remove_administrator'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   context '#list_super_administrators' do&lt;br /&gt;
     it 'lists all the Super-Administrators' do&lt;br /&gt;
       stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
       get :list_super_administrators&lt;br /&gt;
       expect(assigns(:users)).to eq([ super_admin ])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
  context '#show_super_administrator' do&lt;br /&gt;
    it 'find selected Super-Administrator and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '1'}&lt;br /&gt;
      get :show_super_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(super_admin)&lt;br /&gt;
      expect(assigns(:role)).to eq(super_admin.role)&lt;br /&gt;
      expect(response).to render_template(:show_super_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_administrators' do&lt;br /&gt;
    it 'lists all the admins' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_administrators, params&lt;br /&gt;
      expect(assigns(:users)).to eq(admin_list)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_administrator' do&lt;br /&gt;
    it 'find selected admin and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '3'}&lt;br /&gt;
      get :show_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(admin1)&lt;br /&gt;
      expect(assigns(:role)).to eq(admin1.role)&lt;br /&gt;
      expect(response).to render_template(:show_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_instructors' do&lt;br /&gt;
    it 'lists all the instructors' do&lt;br /&gt;
      stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_instructors, params&lt;br /&gt;
      expect(assigns(:users)).to eq(instructor_list_pid3)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_instructor' do&lt;br /&gt;
    it 'find selected instructor and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '10'}&lt;br /&gt;
      get :show_instructor, params&lt;br /&gt;
      expect(assigns(:user)).to eq(instructor1)&lt;br /&gt;
      expect(assigns(:role)).to eq(instructor1.role)&lt;br /&gt;
      expect(response).to render_template(:show_instructor)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Institution_controller ===&lt;br /&gt;
:institution, id: 1, name: 'institution'&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: Admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#:For users like admin, they are supposed to be able to edit all the institutions in the database.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: Instructor&amp;lt;/font&amp;gt; ====&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#Creates a new institution object and renders institution new page&lt;br /&gt;
#Save a new institution to the database and being redirected to the institution list page with a successful message&lt;br /&gt;
#Update the information of an institution&lt;br /&gt;
#Delete an institution&lt;br /&gt;
*Tested tasks that will receive false:&lt;br /&gt;
#Fail to save a new institution to the database&lt;br /&gt;
#Fail to update the information of an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: TA&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: student&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
describe InstitutionController do&lt;br /&gt;
  let(:admin) { build(:admin) }&lt;br /&gt;
  let(:instructor) { build(:instructor, id: 6) }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 66) }&lt;br /&gt;
  let(:ta) { build(:teaching_assistant, id: 8) }&lt;br /&gt;
  let(:student) { build(:student) }&lt;br /&gt;
&lt;br /&gt;
  # create fake data&lt;br /&gt;
  let(:institution) do&lt;br /&gt;
    build(:institution, id: 1, name: 'test institution')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  let(:course) do&lt;br /&gt;
    build(:course, instructor_id: 6, institutions_id:1, name: 'abc')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # set default testing user&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(Institution).to receive(:find).with('1').and_return(institution)&lt;br /&gt;
    allow(Course).to receive(:where).with(institution_id: '1').and_return(course)&lt;br /&gt;
    stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  end&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is edit or update' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {id: '1', action: 'edit'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role name of current user is super admin or admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the instructor' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the TAs or the students' do&lt;br /&gt;
        it 'deny certain action if current user is the TA' do&lt;br /&gt;
          stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        it 'deny certain action if current user is the student' do&lt;br /&gt;
          stub_current_user(student, student.role.name, student.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#new' do&lt;br /&gt;
    it 'creates a new Institution object and renders institution#new page' do&lt;br /&gt;
      get :new&lt;br /&gt;
      expect(response).to render_template(:new)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    context 'when institution is saved successfully' do&lt;br /&gt;
      it 'redirects to institution#list page' do&lt;br /&gt;
        allow(institution).to receive(:name).and_return(&amp;quot;test institution&amp;quot;)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when institution is not saved successfully' do&lt;br /&gt;
      it 'renders institution#new page' do&lt;br /&gt;
        allow(institution).to receive(:save).and_return(false)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(flash.now[:error]).to eq('The creation of the institution failed.')&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#edit' do&lt;br /&gt;
    it 'renders institution#edit' do&lt;br /&gt;
      @params = {&lt;br /&gt;
          id: 1&lt;br /&gt;
      }&lt;br /&gt;
      get :edit, @params&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#update' do&lt;br /&gt;
    context 'when institution is updated successfully' do&lt;br /&gt;
      it 'renders institution#list' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1,&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        put :update, @params&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#index' do&lt;br /&gt;
    context 'when institution query all institution' do&lt;br /&gt;
      it 'renders institution#list' do&lt;br /&gt;
        get :index&lt;br /&gt;
        expect(response).to render_template(:list)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#show' do&lt;br /&gt;
    context 'when try to show a institution' do&lt;br /&gt;
      it 'renders institution#show when find the target institution' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        get :show, @params&lt;br /&gt;
        expect(response).to render_template(:show)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#delete' do&lt;br /&gt;
    context 'when try to delete a institution' do&lt;br /&gt;
      it 'renders institution#list when delete successfully' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        post :delete, @params, session&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo ==&lt;br /&gt;
&lt;br /&gt;
Demo of admin_controller_spec [https://youtu.be/OZaaVLBul6Y click here]&lt;br /&gt;
&lt;br /&gt;
Demo of institution_controller_spec [https://youtu.be/A1vuITGSRBI click here]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo [https://github.com/yhslo/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza click here]&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139166</id>
		<title>CSC/ECE 517 Fall 2021 - E2134. Write unit tests for admin controller.rb and institution controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139166"/>
		<updated>2021-10-19T03:02:13Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Role 2: instructor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== E2134. Write unit tests for admin controller.rb and institution controller.rb ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2134. - Write unit tests for admin controller.rb and institution controller.rb&lt;br /&gt;
&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza allows authorized users to create/edit/delete information of institutions and for the admin to create/edit/delete information of instructors. The repository lacks systematic unit tests for both the admin controller and institution controller. We designed unit tests for these controllers based on several scenarios.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Admin_controller ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: admin1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 3, role_id: 4, parent_id: 1, name: 'Aministrator1'&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Lists all the instructors&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to list all the instructors in the database.&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to remove an instructor from the database.&lt;br /&gt;
*Tested tasks that are not allowed:&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
#:For users like admin, they are not supposed to be able to delete his/her own user account or any other administrators.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: admin2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 4, role_id: 4, parent_id: 1, name: 'Aministrator2'&lt;br /&gt;
&lt;br /&gt;
The data of admin 2 is used for super admin to test functions such as list administrators, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: super_admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: superadmin, id: 1, role_id: 5&lt;br /&gt;
&lt;br /&gt;
Super admin should be able to perform all the tasks other types of users can do.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: instructor1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1'&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 5: instructor2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2'&lt;br /&gt;
&lt;br /&gt;
The data of instructor 2 is used to test functions such as list instructors, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 6: student1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: student, id: 21, role_id: 1&lt;br /&gt;
&lt;br /&gt;
Student should not be able to perform any tasks within the admin controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#spec/controllers/admin_controller_spec.rb&lt;br /&gt;
describe AdminController do&lt;br /&gt;
  # create fake users&lt;br /&gt;
  let(:admin1) { build(:admin, id: 3, role_id: 4, parent_id: 1, name: 'Administrator1') }&lt;br /&gt;
  let(:admin2) { build(:admin, id: 4, role_id: 4, parent_id: 1, name: 'Administrator2') }&lt;br /&gt;
  let(:super_admin) { build(:superadmin, id: 1, role_id: 5) }&lt;br /&gt;
  let(:instructor1) { build(:instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1') }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2') }&lt;br /&gt;
  let(:student1) { build(:student, id: 21, role_id: 1) }&lt;br /&gt;
&lt;br /&gt;
  # create fake lists&lt;br /&gt;
  let(:admin_list) { [admin1, admin2] }&lt;br /&gt;
  let(:instructor_list) { [instructor1, instructor2] }&lt;br /&gt;
  let(:instructor_list_pid3) { [instructor1] }&lt;br /&gt;
  let(:instructor_list_pid4) { [instructor2] }&lt;br /&gt;
&lt;br /&gt;
  # define default behaviors for each method call&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(User).to receive(:find).with('3').and_return(admin1)&lt;br /&gt;
    allow(User).to receive(:find).with('1').and_return(super_admin)&lt;br /&gt;
    allow(User).to receive(:find).with('10').and_return(instructor1)&lt;br /&gt;
    allow(User).to receive(:where).with([&amp;quot;role_id = ?&amp;quot;, super_admin.role_id]).and_return([ super_admin ])&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: admin1.role).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:order).with(:name).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, super_admin.id).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:paginate).with(page: '1', per_page: 50).and_return(admin_list)&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: instructor1.role).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:order).with(:name).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, admin1.id).and_return(instructor_list_pid3)&lt;br /&gt;
    allow(instructor_list_pid3).to receive(:paginate).with(page: '1', per_page: 50).and_return(instructor_list_pid3)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    context 'when params action is list all instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'list_instructors'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is remove an instructor' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'remove_instructor'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is other than list and remove instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {:action =&amp;gt; 'remove_administrator'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   context '#list_super_administrators' do&lt;br /&gt;
     it 'lists all the Super-Administrators' do&lt;br /&gt;
       stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
       get :list_super_administrators&lt;br /&gt;
       expect(assigns(:users)).to eq([ super_admin ])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
  context '#show_super_administrator' do&lt;br /&gt;
    it 'find selected Super-Administrator and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '1'}&lt;br /&gt;
      get :show_super_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(super_admin)&lt;br /&gt;
      expect(assigns(:role)).to eq(super_admin.role)&lt;br /&gt;
      expect(response).to render_template(:show_super_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_administrators' do&lt;br /&gt;
    it 'lists all the admins' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_administrators, params&lt;br /&gt;
      expect(assigns(:users)).to eq(admin_list)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_administrator' do&lt;br /&gt;
    it 'find selected admin and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '3'}&lt;br /&gt;
      get :show_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(admin1)&lt;br /&gt;
      expect(assigns(:role)).to eq(admin1.role)&lt;br /&gt;
      expect(response).to render_template(:show_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_instructors' do&lt;br /&gt;
    it 'lists all the instructors' do&lt;br /&gt;
      stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_instructors, params&lt;br /&gt;
      expect(assigns(:users)).to eq(instructor_list_pid3)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_instructor' do&lt;br /&gt;
    it 'find selected instructor and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '10'}&lt;br /&gt;
      get :show_instructor, params&lt;br /&gt;
      expect(assigns(:user)).to eq(instructor1)&lt;br /&gt;
      expect(assigns(:role)).to eq(instructor1.role)&lt;br /&gt;
      expect(response).to render_template(:show_instructor)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Institution_controller ===&lt;br /&gt;
:institution, id: 1, name: 'institution'&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#:For users like admin, they are supposed to be able to edit all the institutions in the database.&lt;br /&gt;
&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to remove an instructor from the database.&lt;br /&gt;
*Tested tasks that are not allowed:&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
#:For users like admin, they are not supposed to be able to delete his/her own user account or any other administrators.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: instructor&amp;lt;/font&amp;gt; ====&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#Creates a new institution object and renders institution new page&lt;br /&gt;
#Save a new institution to the database and being redirected to the institution list page with a successful message&lt;br /&gt;
#Update the information of an institution&lt;br /&gt;
#Delete an institution&lt;br /&gt;
*Tested tasks that will receive false:&lt;br /&gt;
#Fail to save a new institution to the database&lt;br /&gt;
#Fail to update the information of an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: ta&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: student&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 5: instructor2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
The data of instructor 2 is used to test functions such as list instructors, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 6: student1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
Student should not be able to perform any tasks within the admin controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
describe InstitutionController do&lt;br /&gt;
  let(:admin) { build(:admin) }&lt;br /&gt;
  let(:instructor) { build(:instructor, id: 6) }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 66) }&lt;br /&gt;
  let(:ta) { build(:teaching_assistant, id: 8) }&lt;br /&gt;
  let(:student) { build(:student) }&lt;br /&gt;
&lt;br /&gt;
  # create fake data&lt;br /&gt;
  let(:institution) do&lt;br /&gt;
    build(:institution, id: 1, name: 'test institution')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  let(:course) do&lt;br /&gt;
    build(:course, instructor_id: 6, institutions_id:1, name: 'abc')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # set default testing user&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(Institution).to receive(:find).with('1').and_return(institution)&lt;br /&gt;
    allow(Course).to receive(:where).with(institution_id: '1').and_return(course)&lt;br /&gt;
    stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  end&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is edit or update' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {id: '1', action: 'edit'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role name of current user is super admin or admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the instructor' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the TAs or the students' do&lt;br /&gt;
        it 'deny certain action if current user is the TA' do&lt;br /&gt;
          stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        it 'deny certain action if current user is the student' do&lt;br /&gt;
          stub_current_user(student, student.role.name, student.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#new' do&lt;br /&gt;
    it 'creates a new Institution object and renders institution#new page' do&lt;br /&gt;
      get :new&lt;br /&gt;
      expect(response).to render_template(:new)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    context 'when institution is saved successfully' do&lt;br /&gt;
      it 'redirects to institution#list page' do&lt;br /&gt;
        allow(institution).to receive(:name).and_return(&amp;quot;test institution&amp;quot;)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when institution is not saved successfully' do&lt;br /&gt;
      it 'renders institution#new page' do&lt;br /&gt;
        allow(institution).to receive(:save).and_return(false)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(flash.now[:error]).to eq('The creation of the institution failed.')&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#edit' do&lt;br /&gt;
    it 'renders institution#edit' do&lt;br /&gt;
      @params = {&lt;br /&gt;
          id: 1&lt;br /&gt;
      }&lt;br /&gt;
      get :edit, @params&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#update' do&lt;br /&gt;
    context 'when institution is updated successfully' do&lt;br /&gt;
      it 'renders institution#list' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1,&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        put :update, @params&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#index' do&lt;br /&gt;
    context 'when institution query all institution' do&lt;br /&gt;
      it 'renders institution#list' do&lt;br /&gt;
        get :index&lt;br /&gt;
        expect(response).to render_template(:list)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#show' do&lt;br /&gt;
    context 'when try to show a institution' do&lt;br /&gt;
      it 'renders institution#show when find the target institution' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        get :show, @params&lt;br /&gt;
        expect(response).to render_template(:show)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#delete' do&lt;br /&gt;
    context 'when try to delete a institution' do&lt;br /&gt;
      it 'renders institution#list when delete successfully' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        post :delete, @params, session&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo ==&lt;br /&gt;
&lt;br /&gt;
Demo of admin_controller_spec [https://youtu.be/OZaaVLBul6Y click here]&lt;br /&gt;
&lt;br /&gt;
Demo of institution_controller_spec [https://youtu.be/A1vuITGSRBI click here]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo [https://github.com/yhslo/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza click here]&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139165</id>
		<title>CSC/ECE 517 Fall 2021 - E2134. Write unit tests for admin controller.rb and institution controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139165"/>
		<updated>2021-10-19T03:01:12Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Role 2: instructor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== E2134. Write unit tests for admin controller.rb and institution controller.rb ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2134. - Write unit tests for admin controller.rb and institution controller.rb&lt;br /&gt;
&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza allows authorized users to create/edit/delete information of institutions and for the admin to create/edit/delete information of instructors. The repository lacks systematic unit tests for both the admin controller and institution controller. We designed unit tests for these controllers based on several scenarios.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Admin_controller ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: admin1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 3, role_id: 4, parent_id: 1, name: 'Aministrator1'&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Lists all the instructors&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to list all the instructors in the database.&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to remove an instructor from the database.&lt;br /&gt;
*Tested tasks that are not allowed:&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
#:For users like admin, they are not supposed to be able to delete his/her own user account or any other administrators.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: admin2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 4, role_id: 4, parent_id: 1, name: 'Aministrator2'&lt;br /&gt;
&lt;br /&gt;
The data of admin 2 is used for super admin to test functions such as list administrators, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: super_admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: superadmin, id: 1, role_id: 5&lt;br /&gt;
&lt;br /&gt;
Super admin should be able to perform all the tasks other types of users can do.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: instructor1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1'&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 5: instructor2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2'&lt;br /&gt;
&lt;br /&gt;
The data of instructor 2 is used to test functions such as list instructors, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 6: student1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: student, id: 21, role_id: 1&lt;br /&gt;
&lt;br /&gt;
Student should not be able to perform any tasks within the admin controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#spec/controllers/admin_controller_spec.rb&lt;br /&gt;
describe AdminController do&lt;br /&gt;
  # create fake users&lt;br /&gt;
  let(:admin1) { build(:admin, id: 3, role_id: 4, parent_id: 1, name: 'Administrator1') }&lt;br /&gt;
  let(:admin2) { build(:admin, id: 4, role_id: 4, parent_id: 1, name: 'Administrator2') }&lt;br /&gt;
  let(:super_admin) { build(:superadmin, id: 1, role_id: 5) }&lt;br /&gt;
  let(:instructor1) { build(:instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1') }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2') }&lt;br /&gt;
  let(:student1) { build(:student, id: 21, role_id: 1) }&lt;br /&gt;
&lt;br /&gt;
  # create fake lists&lt;br /&gt;
  let(:admin_list) { [admin1, admin2] }&lt;br /&gt;
  let(:instructor_list) { [instructor1, instructor2] }&lt;br /&gt;
  let(:instructor_list_pid3) { [instructor1] }&lt;br /&gt;
  let(:instructor_list_pid4) { [instructor2] }&lt;br /&gt;
&lt;br /&gt;
  # define default behaviors for each method call&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(User).to receive(:find).with('3').and_return(admin1)&lt;br /&gt;
    allow(User).to receive(:find).with('1').and_return(super_admin)&lt;br /&gt;
    allow(User).to receive(:find).with('10').and_return(instructor1)&lt;br /&gt;
    allow(User).to receive(:where).with([&amp;quot;role_id = ?&amp;quot;, super_admin.role_id]).and_return([ super_admin ])&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: admin1.role).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:order).with(:name).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, super_admin.id).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:paginate).with(page: '1', per_page: 50).and_return(admin_list)&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: instructor1.role).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:order).with(:name).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, admin1.id).and_return(instructor_list_pid3)&lt;br /&gt;
    allow(instructor_list_pid3).to receive(:paginate).with(page: '1', per_page: 50).and_return(instructor_list_pid3)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    context 'when params action is list all instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'list_instructors'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is remove an instructor' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'remove_instructor'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is other than list and remove instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {:action =&amp;gt; 'remove_administrator'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   context '#list_super_administrators' do&lt;br /&gt;
     it 'lists all the Super-Administrators' do&lt;br /&gt;
       stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
       get :list_super_administrators&lt;br /&gt;
       expect(assigns(:users)).to eq([ super_admin ])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
  context '#show_super_administrator' do&lt;br /&gt;
    it 'find selected Super-Administrator and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '1'}&lt;br /&gt;
      get :show_super_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(super_admin)&lt;br /&gt;
      expect(assigns(:role)).to eq(super_admin.role)&lt;br /&gt;
      expect(response).to render_template(:show_super_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_administrators' do&lt;br /&gt;
    it 'lists all the admins' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_administrators, params&lt;br /&gt;
      expect(assigns(:users)).to eq(admin_list)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_administrator' do&lt;br /&gt;
    it 'find selected admin and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '3'}&lt;br /&gt;
      get :show_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(admin1)&lt;br /&gt;
      expect(assigns(:role)).to eq(admin1.role)&lt;br /&gt;
      expect(response).to render_template(:show_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_instructors' do&lt;br /&gt;
    it 'lists all the instructors' do&lt;br /&gt;
      stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_instructors, params&lt;br /&gt;
      expect(assigns(:users)).to eq(instructor_list_pid3)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_instructor' do&lt;br /&gt;
    it 'find selected instructor and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '10'}&lt;br /&gt;
      get :show_instructor, params&lt;br /&gt;
      expect(assigns(:user)).to eq(instructor1)&lt;br /&gt;
      expect(assigns(:role)).to eq(instructor1.role)&lt;br /&gt;
      expect(response).to render_template(:show_instructor)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Institution_controller ===&lt;br /&gt;
:institution, id: 1, name: 'institution'&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#:For users like admin, they are supposed to be able to edit all the institutions in the database.&lt;br /&gt;
&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to remove an instructor from the database.&lt;br /&gt;
*Tested tasks that are not allowed:&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
#:For users like admin, they are not supposed to be able to delete his/her own user account or any other administrators.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: instructor&amp;lt;/font&amp;gt; ====&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#Creates a new institution object and renders institution new page&lt;br /&gt;
#Save a new institution to the database and being redirected to the institution list page with a successful message&lt;br /&gt;
#Update the information of an institution&lt;br /&gt;
*Tested tasks that will receive false:&lt;br /&gt;
#Fail to save a new institution to the database&lt;br /&gt;
#Fail to update the information of an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: ta&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: student&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 5: instructor2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
The data of instructor 2 is used to test functions such as list instructors, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 6: student1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
Student should not be able to perform any tasks within the admin controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
describe InstitutionController do&lt;br /&gt;
  let(:admin) { build(:admin) }&lt;br /&gt;
  let(:instructor) { build(:instructor, id: 6) }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 66) }&lt;br /&gt;
  let(:ta) { build(:teaching_assistant, id: 8) }&lt;br /&gt;
  let(:student) { build(:student) }&lt;br /&gt;
&lt;br /&gt;
  # create fake data&lt;br /&gt;
  let(:institution) do&lt;br /&gt;
    build(:institution, id: 1, name: 'test institution')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  let(:course) do&lt;br /&gt;
    build(:course, instructor_id: 6, institutions_id:1, name: 'abc')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # set default testing user&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(Institution).to receive(:find).with('1').and_return(institution)&lt;br /&gt;
    allow(Course).to receive(:where).with(institution_id: '1').and_return(course)&lt;br /&gt;
    stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  end&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is edit or update' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {id: '1', action: 'edit'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role name of current user is super admin or admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the instructor' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the TAs or the students' do&lt;br /&gt;
        it 'deny certain action if current user is the TA' do&lt;br /&gt;
          stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        it 'deny certain action if current user is the student' do&lt;br /&gt;
          stub_current_user(student, student.role.name, student.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#new' do&lt;br /&gt;
    it 'creates a new Institution object and renders institution#new page' do&lt;br /&gt;
      get :new&lt;br /&gt;
      expect(response).to render_template(:new)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    context 'when institution is saved successfully' do&lt;br /&gt;
      it 'redirects to institution#list page' do&lt;br /&gt;
        allow(institution).to receive(:name).and_return(&amp;quot;test institution&amp;quot;)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when institution is not saved successfully' do&lt;br /&gt;
      it 'renders institution#new page' do&lt;br /&gt;
        allow(institution).to receive(:save).and_return(false)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(flash.now[:error]).to eq('The creation of the institution failed.')&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#edit' do&lt;br /&gt;
    it 'renders institution#edit' do&lt;br /&gt;
      @params = {&lt;br /&gt;
          id: 1&lt;br /&gt;
      }&lt;br /&gt;
      get :edit, @params&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#update' do&lt;br /&gt;
    context 'when institution is updated successfully' do&lt;br /&gt;
      it 'renders institution#list' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1,&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        put :update, @params&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#index' do&lt;br /&gt;
    context 'when institution query all institution' do&lt;br /&gt;
      it 'renders institution#list' do&lt;br /&gt;
        get :index&lt;br /&gt;
        expect(response).to render_template(:list)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#show' do&lt;br /&gt;
    context 'when try to show a institution' do&lt;br /&gt;
      it 'renders institution#show when find the target institution' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        get :show, @params&lt;br /&gt;
        expect(response).to render_template(:show)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#delete' do&lt;br /&gt;
    context 'when try to delete a institution' do&lt;br /&gt;
      it 'renders institution#list when delete successfully' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        post :delete, @params, session&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo ==&lt;br /&gt;
&lt;br /&gt;
Demo of admin_controller_spec [https://youtu.be/OZaaVLBul6Y click here]&lt;br /&gt;
&lt;br /&gt;
Demo of institution_controller_spec [https://youtu.be/A1vuITGSRBI click here]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo [https://github.com/yhslo/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza click here]&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139164</id>
		<title>CSC/ECE 517 Fall 2021 - E2134. Write unit tests for admin controller.rb and institution controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139164"/>
		<updated>2021-10-19T02:55:56Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Role 2: instructor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== E2134. Write unit tests for admin controller.rb and institution controller.rb ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2134. - Write unit tests for admin controller.rb and institution controller.rb&lt;br /&gt;
&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza allows authorized users to create/edit/delete information of institutions and for the admin to create/edit/delete information of instructors. The repository lacks systematic unit tests for both the admin controller and institution controller. We designed unit tests for these controllers based on several scenarios.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Admin_controller ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: admin1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 3, role_id: 4, parent_id: 1, name: 'Aministrator1'&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Lists all the instructors&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to list all the instructors in the database.&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to remove an instructor from the database.&lt;br /&gt;
*Tested tasks that are not allowed:&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
#:For users like admin, they are not supposed to be able to delete his/her own user account or any other administrators.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: admin2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 4, role_id: 4, parent_id: 1, name: 'Aministrator2'&lt;br /&gt;
&lt;br /&gt;
The data of admin 2 is used for super admin to test functions such as list administrators, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: super_admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: superadmin, id: 1, role_id: 5&lt;br /&gt;
&lt;br /&gt;
Super admin should be able to perform all the tasks other types of users can do.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: instructor1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1'&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 5: instructor2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2'&lt;br /&gt;
&lt;br /&gt;
The data of instructor 2 is used to test functions such as list instructors, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 6: student1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: student, id: 21, role_id: 1&lt;br /&gt;
&lt;br /&gt;
Student should not be able to perform any tasks within the admin controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#spec/controllers/admin_controller_spec.rb&lt;br /&gt;
describe AdminController do&lt;br /&gt;
  # create fake users&lt;br /&gt;
  let(:admin1) { build(:admin, id: 3, role_id: 4, parent_id: 1, name: 'Administrator1') }&lt;br /&gt;
  let(:admin2) { build(:admin, id: 4, role_id: 4, parent_id: 1, name: 'Administrator2') }&lt;br /&gt;
  let(:super_admin) { build(:superadmin, id: 1, role_id: 5) }&lt;br /&gt;
  let(:instructor1) { build(:instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1') }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2') }&lt;br /&gt;
  let(:student1) { build(:student, id: 21, role_id: 1) }&lt;br /&gt;
&lt;br /&gt;
  # create fake lists&lt;br /&gt;
  let(:admin_list) { [admin1, admin2] }&lt;br /&gt;
  let(:instructor_list) { [instructor1, instructor2] }&lt;br /&gt;
  let(:instructor_list_pid3) { [instructor1] }&lt;br /&gt;
  let(:instructor_list_pid4) { [instructor2] }&lt;br /&gt;
&lt;br /&gt;
  # define default behaviors for each method call&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(User).to receive(:find).with('3').and_return(admin1)&lt;br /&gt;
    allow(User).to receive(:find).with('1').and_return(super_admin)&lt;br /&gt;
    allow(User).to receive(:find).with('10').and_return(instructor1)&lt;br /&gt;
    allow(User).to receive(:where).with([&amp;quot;role_id = ?&amp;quot;, super_admin.role_id]).and_return([ super_admin ])&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: admin1.role).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:order).with(:name).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, super_admin.id).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:paginate).with(page: '1', per_page: 50).and_return(admin_list)&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: instructor1.role).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:order).with(:name).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, admin1.id).and_return(instructor_list_pid3)&lt;br /&gt;
    allow(instructor_list_pid3).to receive(:paginate).with(page: '1', per_page: 50).and_return(instructor_list_pid3)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    context 'when params action is list all instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'list_instructors'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is remove an instructor' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'remove_instructor'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is other than list and remove instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {:action =&amp;gt; 'remove_administrator'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   context '#list_super_administrators' do&lt;br /&gt;
     it 'lists all the Super-Administrators' do&lt;br /&gt;
       stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
       get :list_super_administrators&lt;br /&gt;
       expect(assigns(:users)).to eq([ super_admin ])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
  context '#show_super_administrator' do&lt;br /&gt;
    it 'find selected Super-Administrator and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '1'}&lt;br /&gt;
      get :show_super_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(super_admin)&lt;br /&gt;
      expect(assigns(:role)).to eq(super_admin.role)&lt;br /&gt;
      expect(response).to render_template(:show_super_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_administrators' do&lt;br /&gt;
    it 'lists all the admins' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_administrators, params&lt;br /&gt;
      expect(assigns(:users)).to eq(admin_list)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_administrator' do&lt;br /&gt;
    it 'find selected admin and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '3'}&lt;br /&gt;
      get :show_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(admin1)&lt;br /&gt;
      expect(assigns(:role)).to eq(admin1.role)&lt;br /&gt;
      expect(response).to render_template(:show_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_instructors' do&lt;br /&gt;
    it 'lists all the instructors' do&lt;br /&gt;
      stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_instructors, params&lt;br /&gt;
      expect(assigns(:users)).to eq(instructor_list_pid3)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_instructor' do&lt;br /&gt;
    it 'find selected instructor and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '10'}&lt;br /&gt;
      get :show_instructor, params&lt;br /&gt;
      expect(assigns(:user)).to eq(instructor1)&lt;br /&gt;
      expect(assigns(:role)).to eq(instructor1.role)&lt;br /&gt;
      expect(response).to render_template(:show_instructor)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Institution_controller ===&lt;br /&gt;
:institution, id: 1, name: 'institution'&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#:For users like admin, they are supposed to be able to edit all the institutions in the database.&lt;br /&gt;
&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to remove an instructor from the database.&lt;br /&gt;
*Tested tasks that are not allowed:&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
#:For users like admin, they are not supposed to be able to delete his/her own user account or any other administrators.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: instructor&amp;lt;/font&amp;gt; ====&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#Creates a new institution object and renders institution new page&lt;br /&gt;
#Save a new institution to the database and being redirected to the institution list page with a successful message&lt;br /&gt;
*Tested tasks that will receive false:&lt;br /&gt;
#Fail to save a new institution to the database&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: ta&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: student&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 5: instructor2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
The data of instructor 2 is used to test functions such as list instructors, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 6: student1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
Student should not be able to perform any tasks within the admin controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
describe InstitutionController do&lt;br /&gt;
  let(:admin) { build(:admin) }&lt;br /&gt;
  let(:instructor) { build(:instructor, id: 6) }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 66) }&lt;br /&gt;
  let(:ta) { build(:teaching_assistant, id: 8) }&lt;br /&gt;
  let(:student) { build(:student) }&lt;br /&gt;
&lt;br /&gt;
  # create fake data&lt;br /&gt;
  let(:institution) do&lt;br /&gt;
    build(:institution, id: 1, name: 'test institution')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  let(:course) do&lt;br /&gt;
    build(:course, instructor_id: 6, institutions_id:1, name: 'abc')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # set default testing user&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(Institution).to receive(:find).with('1').and_return(institution)&lt;br /&gt;
    allow(Course).to receive(:where).with(institution_id: '1').and_return(course)&lt;br /&gt;
    stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  end&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is edit or update' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {id: '1', action: 'edit'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role name of current user is super admin or admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the instructor' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the TAs or the students' do&lt;br /&gt;
        it 'deny certain action if current user is the TA' do&lt;br /&gt;
          stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        it 'deny certain action if current user is the student' do&lt;br /&gt;
          stub_current_user(student, student.role.name, student.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#new' do&lt;br /&gt;
    it 'creates a new Institution object and renders institution#new page' do&lt;br /&gt;
      get :new&lt;br /&gt;
      expect(response).to render_template(:new)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    context 'when institution is saved successfully' do&lt;br /&gt;
      it 'redirects to institution#list page' do&lt;br /&gt;
        allow(institution).to receive(:name).and_return(&amp;quot;test institution&amp;quot;)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when institution is not saved successfully' do&lt;br /&gt;
      it 'renders institution#new page' do&lt;br /&gt;
        allow(institution).to receive(:save).and_return(false)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(flash.now[:error]).to eq('The creation of the institution failed.')&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#edit' do&lt;br /&gt;
    it 'renders institution#edit' do&lt;br /&gt;
      @params = {&lt;br /&gt;
          id: 1&lt;br /&gt;
      }&lt;br /&gt;
      get :edit, @params&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#update' do&lt;br /&gt;
    context 'when institution is updated successfully' do&lt;br /&gt;
      it 'renders institution#list' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1,&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        put :update, @params&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#index' do&lt;br /&gt;
    context 'when institution query all institution' do&lt;br /&gt;
      it 'renders institution#list' do&lt;br /&gt;
        get :index&lt;br /&gt;
        expect(response).to render_template(:list)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#show' do&lt;br /&gt;
    context 'when try to show a institution' do&lt;br /&gt;
      it 'renders institution#show when find the target institution' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        get :show, @params&lt;br /&gt;
        expect(response).to render_template(:show)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#delete' do&lt;br /&gt;
    context 'when try to delete a institution' do&lt;br /&gt;
      it 'renders institution#list when delete successfully' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        post :delete, @params, session&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo ==&lt;br /&gt;
&lt;br /&gt;
Demo of admin_controller_spec [https://youtu.be/OZaaVLBul6Y click here]&lt;br /&gt;
&lt;br /&gt;
Demo of institution_controller_spec [https://youtu.be/A1vuITGSRBI click here]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo [https://github.com/yhslo/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza click here]&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139163</id>
		<title>CSC/ECE 517 Fall 2021 - E2134. Write unit tests for admin controller.rb and institution controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2021_-_E2134._Write_unit_tests_for_admin_controller.rb_and_institution_controller.rb&amp;diff=139163"/>
		<updated>2021-10-19T02:54:04Z</updated>

		<summary type="html">&lt;p&gt;Lshyu: /* Role 2: instructor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
== E2134. Write unit tests for admin controller.rb and institution controller.rb ==&lt;br /&gt;
This page is a description of Expertiza OSS project E2134. - Write unit tests for admin controller.rb and institution controller.rb&lt;br /&gt;
&lt;br /&gt;
== Problem Statement and Background ==&lt;br /&gt;
&lt;br /&gt;
Expertiza allows authorized users to create/edit/delete information of institutions and for the admin to create/edit/delete information of instructors. The repository lacks systematic unit tests for both the admin controller and institution controller. We designed unit tests for these controllers based on several scenarios.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Admin_controller ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: admin1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 3, role_id: 4, parent_id: 1, name: 'Aministrator1'&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Lists all the instructors&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to list all the instructors in the database.&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to remove an instructor from the database.&lt;br /&gt;
*Tested tasks that are not allowed:&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
#:For users like admin, they are not supposed to be able to delete his/her own user account or any other administrators.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: admin2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: admin, id: 4, role_id: 4, parent_id: 1, name: 'Aministrator2'&lt;br /&gt;
&lt;br /&gt;
The data of admin 2 is used for super admin to test functions such as list administrators, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: super_admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: superadmin, id: 1, role_id: 5&lt;br /&gt;
&lt;br /&gt;
Super admin should be able to perform all the tasks other types of users can do.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: instructor1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1'&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 5: instructor2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2'&lt;br /&gt;
&lt;br /&gt;
The data of instructor 2 is used to test functions such as list instructors, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 6: student1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
User type: student, id: 21, role_id: 1&lt;br /&gt;
&lt;br /&gt;
Student should not be able to perform any tasks within the admin controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#spec/controllers/admin_controller_spec.rb&lt;br /&gt;
describe AdminController do&lt;br /&gt;
  # create fake users&lt;br /&gt;
  let(:admin1) { build(:admin, id: 3, role_id: 4, parent_id: 1, name: 'Administrator1') }&lt;br /&gt;
  let(:admin2) { build(:admin, id: 4, role_id: 4, parent_id: 1, name: 'Administrator2') }&lt;br /&gt;
  let(:super_admin) { build(:superadmin, id: 1, role_id: 5) }&lt;br /&gt;
  let(:instructor1) { build(:instructor, id: 10, role_id: 3, parent_id: 3, name: 'Instructor1') }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 11, role_id: 3, parent_id: 4, name: 'Instructor2') }&lt;br /&gt;
  let(:student1) { build(:student, id: 21, role_id: 1) }&lt;br /&gt;
&lt;br /&gt;
  # create fake lists&lt;br /&gt;
  let(:admin_list) { [admin1, admin2] }&lt;br /&gt;
  let(:instructor_list) { [instructor1, instructor2] }&lt;br /&gt;
  let(:instructor_list_pid3) { [instructor1] }&lt;br /&gt;
  let(:instructor_list_pid4) { [instructor2] }&lt;br /&gt;
&lt;br /&gt;
  # define default behaviors for each method call&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(User).to receive(:find).with('3').and_return(admin1)&lt;br /&gt;
    allow(User).to receive(:find).with('1').and_return(super_admin)&lt;br /&gt;
    allow(User).to receive(:find).with('10').and_return(instructor1)&lt;br /&gt;
    allow(User).to receive(:where).with([&amp;quot;role_id = ?&amp;quot;, super_admin.role_id]).and_return([ super_admin ])&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: admin1.role).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:order).with(:name).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, super_admin.id).and_return(admin_list)&lt;br /&gt;
    allow(admin_list).to receive(:paginate).with(page: '1', per_page: 50).and_return(admin_list)&lt;br /&gt;
&lt;br /&gt;
    allow(User).to receive(:where).with(role_id: instructor1.role).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:order).with(:name).and_return(instructor_list)&lt;br /&gt;
    allow(instructor_list).to receive(:where).with(&amp;quot;parent_id = ?&amp;quot;, admin1.id).and_return(instructor_list_pid3)&lt;br /&gt;
    allow(instructor_list_pid3).to receive(:paginate).with(page: '1', per_page: 50).and_return(instructor_list_pid3)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    context 'when params action is list all instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'list_instructors'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is remove an instructor' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {action: 'remove_instructor'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is other than list and remove instructors' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {:action =&amp;gt; 'remove_administrator'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Admin' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Super-Admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Instructor' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role of current user is Student' do&lt;br /&gt;
        it 'refuses certain action' do&lt;br /&gt;
          stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
   context '#list_super_administrators' do&lt;br /&gt;
     it 'lists all the Super-Administrators' do&lt;br /&gt;
       stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
       get :list_super_administrators&lt;br /&gt;
       expect(assigns(:users)).to eq([ super_admin ])&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
  context '#show_super_administrator' do&lt;br /&gt;
    it 'find selected Super-Administrator and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '1'}&lt;br /&gt;
      get :show_super_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(super_admin)&lt;br /&gt;
      expect(assigns(:role)).to eq(super_admin.role)&lt;br /&gt;
      expect(response).to render_template(:show_super_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_administrators' do&lt;br /&gt;
    it 'lists all the admins' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_administrators, params&lt;br /&gt;
      expect(assigns(:users)).to eq(admin_list)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_administrator' do&lt;br /&gt;
    it 'find selected admin and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '3'}&lt;br /&gt;
      get :show_administrator, params&lt;br /&gt;
      expect(assigns(:user)).to eq(admin1)&lt;br /&gt;
      expect(assigns(:role)).to eq(admin1.role)&lt;br /&gt;
      expect(response).to render_template(:show_administrator)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#list_instructors' do&lt;br /&gt;
    it 'lists all the instructors' do&lt;br /&gt;
      stub_current_user(admin1, admin1.role.name, admin1.role)&lt;br /&gt;
      params = {page: '1'}&lt;br /&gt;
      get :list_instructors, params&lt;br /&gt;
      expect(assigns(:users)).to eq(instructor_list_pid3)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  context '#show_instructor' do&lt;br /&gt;
    it 'find selected instructor and render #show' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      params = {id: '10'}&lt;br /&gt;
      get :show_instructor, params&lt;br /&gt;
      expect(assigns(:user)).to eq(instructor1)&lt;br /&gt;
      expect(assigns(:role)).to eq(instructor1.role)&lt;br /&gt;
      expect(response).to render_template(:show_instructor)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;font size = '4'&amp;gt;Institution_controller ===&lt;br /&gt;
:institution, id: 1, name: 'institution'&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 1: admin&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#:For users like admin, they are supposed to be able to edit all the institutions in the database.&lt;br /&gt;
&lt;br /&gt;
#:For users like admin or super admin, they are supposed to be able to remove an instructor from the database.&lt;br /&gt;
*Tested tasks that are not allowed:&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
#:For users like admin, they are not supposed to be able to delete his/her own user account or any other administrators.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 2: instructor&amp;lt;/font&amp;gt; ====&lt;br /&gt;
*Tested tasks allowed:&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#Creates a new institution object and renders institution new page&lt;br /&gt;
#Save a new institution to the database and being redirected to the institution list page with a successful message&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 3: ta&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 4: student&amp;lt;/font&amp;gt; ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#Edit an institution&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove administrator&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 5: instructor2&amp;lt;/font&amp;gt; ====&lt;br /&gt;
The data of instructor 2 is used to test functions such as list instructors, etc.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '3'&amp;gt;Role 6: student1&amp;lt;/font&amp;gt; ====&lt;br /&gt;
Student should not be able to perform any tasks within the admin controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Tested tasks that are not allowed and will return false:&amp;lt;/p&amp;gt;&lt;br /&gt;
#List all instructors&lt;br /&gt;
#Remove an instructor&lt;br /&gt;
#Remove an administrator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;font size = '2'&amp;gt; Code Snippet ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
describe InstitutionController do&lt;br /&gt;
  let(:admin) { build(:admin) }&lt;br /&gt;
  let(:instructor) { build(:instructor, id: 6) }&lt;br /&gt;
  let(:instructor2) { build(:instructor, id: 66) }&lt;br /&gt;
  let(:ta) { build(:teaching_assistant, id: 8) }&lt;br /&gt;
  let(:student) { build(:student) }&lt;br /&gt;
&lt;br /&gt;
  # create fake data&lt;br /&gt;
  let(:institution) do&lt;br /&gt;
    build(:institution, id: 1, name: 'test institution')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  let(:course) do&lt;br /&gt;
    build(:course, instructor_id: 6, institutions_id:1, name: 'abc')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  # set default testing user&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    allow(Institution).to receive(:find).with('1').and_return(institution)&lt;br /&gt;
    allow(Course).to receive(:where).with(institution_id: '1').and_return(course)&lt;br /&gt;
    stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
  end&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
&lt;br /&gt;
    context 'when params action is edit or update' do&lt;br /&gt;
      before(:each) do&lt;br /&gt;
        controller.params = {id: '1', action: 'edit'}&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when the role name of current user is super admin or admin' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the instructor' do&lt;br /&gt;
        it 'allows certain action' do&lt;br /&gt;
          stub_current_user(instructor, instructor.role.name, instructor.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be true&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when current user is the TAs or the students' do&lt;br /&gt;
        it 'deny certain action if current user is the TA' do&lt;br /&gt;
          stub_current_user(ta, ta.role.name, ta.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        it 'deny certain action if current user is the student' do&lt;br /&gt;
          stub_current_user(student, student.role.name, student.role)&lt;br /&gt;
          (controller.send(:action_allowed?)).should be false&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#new' do&lt;br /&gt;
    it 'creates a new Institution object and renders institution#new page' do&lt;br /&gt;
      get :new&lt;br /&gt;
      expect(response).to render_template(:new)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    context 'when institution is saved successfully' do&lt;br /&gt;
      it 'redirects to institution#list page' do&lt;br /&gt;
        allow(institution).to receive(:name).and_return(&amp;quot;test institution&amp;quot;)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'when institution is not saved successfully' do&lt;br /&gt;
      it 'renders institution#new page' do&lt;br /&gt;
        allow(institution).to receive(:save).and_return(false)&lt;br /&gt;
        @params = {&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        post :create, @params&lt;br /&gt;
        expect(flash.now[:error]).to eq('The creation of the institution failed.')&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  describe '#edit' do&lt;br /&gt;
    it 'renders institution#edit' do&lt;br /&gt;
      @params = {&lt;br /&gt;
          id: 1&lt;br /&gt;
      }&lt;br /&gt;
      get :edit, @params&lt;br /&gt;
      expect(response).to render_template(:edit)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#update' do&lt;br /&gt;
    context 'when institution is updated successfully' do&lt;br /&gt;
      it 'renders institution#list' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1,&lt;br /&gt;
            institution: {&lt;br /&gt;
                name: &amp;quot;test institution&amp;quot;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        put :update, @params&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#index' do&lt;br /&gt;
    context 'when institution query all institution' do&lt;br /&gt;
      it 'renders institution#list' do&lt;br /&gt;
        get :index&lt;br /&gt;
        expect(response).to render_template(:list)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#show' do&lt;br /&gt;
    context 'when try to show a institution' do&lt;br /&gt;
      it 'renders institution#show when find the target institution' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        get :show, @params&lt;br /&gt;
        expect(response).to render_template(:show)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#delete' do&lt;br /&gt;
    context 'when try to delete a institution' do&lt;br /&gt;
      it 'renders institution#list when delete successfully' do&lt;br /&gt;
        @params = {&lt;br /&gt;
            id:1&lt;br /&gt;
        }&lt;br /&gt;
        post :delete, @params, session&lt;br /&gt;
        expect(response).to redirect_to(&amp;quot;/institution/list&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo ==&lt;br /&gt;
&lt;br /&gt;
Demo of admin_controller_spec [https://youtu.be/OZaaVLBul6Y click here]&lt;br /&gt;
&lt;br /&gt;
Demo of institution_controller_spec [https://youtu.be/A1vuITGSRBI click here]&lt;br /&gt;
&lt;br /&gt;
== Our Team ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Expertiza on GitHub [https://github.com/expertiza/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
To visit our forked repo [https://github.com/yhslo/expertiza click here]&lt;br /&gt;
&lt;br /&gt;
View our pull request [https://github.com/expertiza/expertiza click here]&lt;/div&gt;</summary>
		<author><name>Lshyu</name></author>
	</entry>
</feed>