<?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=Jmhardy3</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=Jmhardy3"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Jmhardy3"/>
	<updated>2026-08-17T04:29:57Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_S2201:_Improving_User_Experience_for_SQLFE&amp;diff=144068</id>
		<title>CSC/ECE 517 Spring 2022 - S2201: Improving User Experience for SQLFE</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_S2201:_Improving_User_Experience_for_SQLFE&amp;diff=144068"/>
		<updated>2022-04-05T04:07:52Z</updated>

		<summary type="html">&lt;p&gt;Jmhardy3: /* Technologies Used */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About SQLFE==&lt;br /&gt;
&lt;br /&gt;
SQL File Evaluation (SQLFE) is an open-source tool that helps in the flexible scoring of multiple SQL queries in multiple submitted files from assignments, lab tests, or other work. It was developed by [https://www.uwec.edu/profiles/wagnerpj/ Prof. Paul Wagner] at [https://www.uwec.edu/ University Of Wisconsin Eau Claire]. This tool has features to support the automated grading of the SQL assignments. It allows partial grading of the question to fairly grade the students and also allows students to provide comments, and multiple solutions to the same problem.&lt;br /&gt;
&lt;br /&gt;
== Technologies Used ==&lt;br /&gt;
The technologies used include Maven, Junit, Java, MySQL ,Oracledb. Java is a high level object oriented programming language that is mainly used for back-end server-side development. Java is used in this project to write the underlying program used to assist professors in grading SQL student submissions.  Maven is a build automation tool used for building and managing Java based projects. With Maven, the user can have different build profiles to set up different configurations of the Java project used for testing, development, and deployment configurations. Maven has POM files that are basically XML files that contain information related to the project and configuration like dependencies, source directory, plugin, and goals. Junit is a unit testing framework. Similar to Rspec for Ruby, Junit allows the user to automate unit testing to ensure that the classes work well for a system using Java. Oracledb, like any database, is a collection of structured data. This is different from MySQL, which was previously used to store the data on this particular project. However, both database platforms essentially serve the same purpose. In comparison, Oracledb supports parallel and distributed databases and also better indexing than MySQL. Though, MySQL is said to be more configurable, the commercially used Oracledb is the selected relational database management system for this particular project.&lt;br /&gt;
&lt;br /&gt;
== Tasks ==&lt;br /&gt;
The project tasks range over several smaller tasks with a cumulative effort directed towards improving the user experience and setting up better processes.&lt;br /&gt;
&lt;br /&gt;
===Task 1===&lt;br /&gt;
Improve the formatting of the query and feedback output in each individual evaluation output file. &lt;br /&gt;
&lt;br /&gt;
====Current Implementation====&lt;br /&gt;
The evaluation files that are generated have a randomly formatted output which is hard to read and is not user-friendly.&lt;br /&gt;
&lt;br /&gt;
[[File:s_2201_1.png|800px|thumb|center|&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Unformatted AAA_grade_summary.out file. There is no indentation and unwanted commas are present to the end.]]&lt;br /&gt;
&lt;br /&gt;
====Proposed Output====&lt;br /&gt;
For a cleaner experience, we are going to remove the commas at the end of the lines. Also, we are going to change the alignment of the lines such that they all are indented in the correct manner.&lt;br /&gt;
&lt;br /&gt;
[[File:s_2201_2.png|800px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Similar changes will be done for each student's output file.&lt;/div&gt;</summary>
		<author><name>Jmhardy3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_S2201:_Improving_User_Experience_for_SQLFE&amp;diff=144067</id>
		<title>CSC/ECE 517 Spring 2022 - S2201: Improving User Experience for SQLFE</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_S2201:_Improving_User_Experience_for_SQLFE&amp;diff=144067"/>
		<updated>2022-04-05T04:07:10Z</updated>

		<summary type="html">&lt;p&gt;Jmhardy3: /* Technologies Used */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About SQLFE==&lt;br /&gt;
&lt;br /&gt;
SQL File Evaluation (SQLFE) is an open-source tool that helps in the flexible scoring of multiple SQL queries in multiple submitted files from assignments, lab tests, or other work. It was developed by [https://www.uwec.edu/profiles/wagnerpj/ Prof. Paul Wagner] at [https://www.uwec.edu/ University Of Wisconsin Eau Claire]. This tool has features to support the automated grading of the SQL assignments. It allows partial grading of the question to fairly grade the students and also allows students to provide comments, and multiple solutions to the same problem.&lt;br /&gt;
&lt;br /&gt;
== Technologies Used ==&lt;br /&gt;
The technologies used include maven, junit, java, mysql ,oracledb. Java is a high level object oriented programming language that is mainly used for back-end server-side development. Java is used in this project to write the underlying program used to assist professors in grading SQL student submissions.  Maven is a build automation tool used for building and managing Java based projects. With Maven, the user can have different build profiles to set up different configurations of the Java project used for testing, development, and deployment configurations. Maven has POM files that are basically XML files that contain information related to the project and configuration like dependencies, source directory, plugin, and goals. Junit is a unit testing framework. Similar to Rspec for Ruby, Junit allows the user to automate unit testing to ensure that the classes work well for a system using Java. Oracledb, like any database, is a collection of structured data. This is different from MySQL, which was previously used to store the data on this particular project. However, both database platforms essentially serve the same purpose. In comparison, Oracledb supports parallel and distributed databases and also better indexing than MySQL. Though, MySQL is said to be more configurable, the commercially used Oracledb is the selected relational database management system for this particular project.&lt;br /&gt;
&lt;br /&gt;
== Tasks ==&lt;br /&gt;
The project tasks range over several smaller tasks with a cumulative effort directed towards improving the user experience and setting up better processes.&lt;br /&gt;
&lt;br /&gt;
===Task 1===&lt;br /&gt;
Improve the formatting of the query and feedback output in each individual evaluation output file. &lt;br /&gt;
&lt;br /&gt;
====Current Implementation====&lt;br /&gt;
The evaluation files that are generated have a randomly formatted output which is hard to read and is not user-friendly.&lt;br /&gt;
&lt;br /&gt;
[[File:s_2201_1.png|800px|thumb|center|&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Unformatted AAA_grade_summary.out file. There is no indentation and unwanted commas are present to the end.]]&lt;br /&gt;
&lt;br /&gt;
====Proposed Output====&lt;br /&gt;
For a cleaner experience, we are going to remove the commas at the end of the lines. Also, we are going to change the alignment of the lines such that they all are indented in the correct manner.&lt;br /&gt;
&lt;br /&gt;
[[File:s_2201_2.png|800px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Similar changes will be done for each student's output file.&lt;/div&gt;</summary>
		<author><name>Jmhardy3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143729</id>
		<title>CSC/ECE 517 Spring 2022 - E2201: Testing for assignment questionnaire controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143729"/>
		<updated>2022-03-28T01:13:05Z</updated>

		<summary type="html">&lt;p&gt;Jmhardy3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2201: Testing for assignment_questionnaire_controller&amp;quot; is focused on adding unit tests for assignment_questionnaire_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* assignment_questionnaire_controller.rb&lt;br /&gt;
* assignment_questionnaire_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/assignment_questionnaire_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
assignment_questionnaire_controller had 3 methods for which unit tests were missing. The RSpec unit tests added for these methods in the spec file 'assignment_questionnaire_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
===Assignment Questionnaire Controller Methods===&lt;br /&gt;
The code of the controller can be found [https://github.com/rachanakondabala/expertiza/blob/master/app/controllers/assignment_questionnaire_controller.rb here]&lt;br /&gt;
The methods which miss test cases are:&lt;br /&gt;
&lt;br /&gt;
*action_allowed?&lt;br /&gt;
*delete_all&lt;br /&gt;
*create&lt;br /&gt;
&lt;br /&gt;
===Test Code===&lt;br /&gt;
==== action_allowed? ====&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the Assignment. The action is passed in the params.&lt;br /&gt;
For the controller tested, there were 4 contexts to test. The first being when there is not an assignment associated with the assignment id, the action should not be allowed and returns false. Next, a stub instructor was created to verify if the action would also be false for when an instructor of the assignment was the current user. Similarly this was done for finding if the user was the ancestor of the assignment and this would return true. And again this was done for the case if the assignment's course's ta is the same ta who signed in.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when no assignment is associated with the id' do&lt;br /&gt;
      #If there is no assignment ID passed, the action should not be allowed. &lt;br /&gt;
      it 'refuses further actions' do&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(nil)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_falsey&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'instructor is not the instructor of the assignment found' do&lt;br /&gt;
      #If the instructor is not an instructor of the assignment found then the instructor mustn't be allowed to perform action&lt;br /&gt;
      it 'does not allow instructor to perform action wrt the assignment' do&lt;br /&gt;
        stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_falsey&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'instructor is the instructor for the assignment found' do&lt;br /&gt;
      ## If no questionnaire is associated with the id in database, then appropriate missing record error should be flashed&lt;br /&gt;
      it 'allows instructor to perform action wrt the assignment' do&lt;br /&gt;
        stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment1)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_truthy&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'user is the ancestor of the assignment found' do&lt;br /&gt;
      ##If the user is the ancestor of the instructor who created the course then this user allowed to perform the action. &lt;br /&gt;
      it 'allows user to perform action wrt the assignment' do&lt;br /&gt;
        stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment1)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_truthy&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'TA who is not course TA is not allowed to perform actions on the assignment found' do&lt;br /&gt;
      ##If the user is assignment's course's TA, then the user is allowed to perform action wrt assignment.&lt;br /&gt;
      it 'does not allow TA to perform action wrt the assignment' do&lt;br /&gt;
        course2 = create(:course)&lt;br /&gt;
        assignment2 = create(:assignment, course_id: course2.id, instructor_id: instructor1)&lt;br /&gt;
        ta1 = create(:teaching_assistant, id: 20)&lt;br /&gt;
        ta2 = create(:teaching_assistant, id:40, name: 'test_ta_2')&lt;br /&gt;
        TaMapping.create(ta_id: ta1.id, course_id: course2.id)&lt;br /&gt;
        &lt;br /&gt;
        stub_current_user(ta2, ta2.role.name, ta2.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment2)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== delete_all ====&lt;br /&gt;
This action is called in the process of deleting an assignment_questionnaire that is associated with an assignment. When this action is successfully executed or the questionnaire is successfully destroyed upon an assignment's deletion, then the test below tests to see that the AssignmentQuestionnaire table is updated to reflect this deletion. Furthermore, the tests below verify that an error flash is present if there is no such assignment_id associated with the requested assignment to be deleted.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   context 'when no assignment is associated with the id in the database' do&lt;br /&gt;
      ##If there is no assignment associated with the id in the database then controller must throw an error&lt;br /&gt;
      it 'throws an error that the assignment does not exist' do&lt;br /&gt;
        stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
&lt;br /&gt;
        allow(Assignment).to receive(:find).with(20).and_return(nil)&lt;br /&gt;
        allow(controller).to receive(:params).and_return({ assignment_id: 20})&lt;br /&gt;
        controller.send(:delete_all)&lt;br /&gt;
        expect(flash[:error]).to be_eql('Assignment #20 does not currently exist.')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
    # context 'when questionnaires related to an assignment are deleted' do&lt;br /&gt;
    #   #When all the questionnaires related to an assignment are deleted the count of assignment_questionnaire records should be 0 for that assignment&lt;br /&gt;
    #   it 'should persist that delete in the database' do&lt;br /&gt;
    #     assignment3 = create(:assignment)&lt;br /&gt;
&lt;br /&gt;
    #     questionnaire1 = create(:questionnaire)&lt;br /&gt;
    #     questionnaire2 = create(:questionnaire)&lt;br /&gt;
    #     questionnaire3 = create(:questionnaire)&lt;br /&gt;
&lt;br /&gt;
    #     assignment_questionnaire1 = create(:assignment_questionnaire, assignment_id: assignment3.id, questionnaire_id: questionnaire1.id)&lt;br /&gt;
    #     assignment_questionnaire2 = create(:assignment_questionnaire, assignment_id: assignment3.id, questionnaire_id: questionnaire2.id)&lt;br /&gt;
    #     assignment_questionnaire3 = create(:assignment_questionnaire, assignment_id: assignment3.id, questionnaire_id: questionnaire3.id)&lt;br /&gt;
&lt;br /&gt;
    #     allow(Assignment).to receive(:find).and_return(assignment3)&lt;br /&gt;
    #     allow(controller).to receive(:params).and_return({assignment_id: assignment3.id})&lt;br /&gt;
    #     controller.send(:delete_all)&lt;br /&gt;
&lt;br /&gt;
    #     expect(AssignmentQuestionnaire.where(assignment_id: assignment3.id).count).to eq(0)&lt;br /&gt;
&lt;br /&gt;
    #   end&lt;br /&gt;
    # end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== create ====&lt;br /&gt;
This method is used to create an AssignmentQuestionnaire entry. But first, the testing file below verifies that there is not a missing assignment id when creating an entry. This testing confirmed that the assignment_questionnaire_controller.rb file needed to be updated to remove a portion of the proposed error flash that was unable to convert a nil value to a string in the case of a missing assignment_id. This was the same result for in the case of a missing questionnaire_id.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'when assignment id is entered as nil' do&lt;br /&gt;
        ## If assignment id is nil, then appropriate missing assignment id error should be flashed. &lt;br /&gt;
        it 'flashes a response of missing assignment id' do&lt;br /&gt;
          params = {  assignment_id: nil}&lt;br /&gt;
&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          allow(Assignment).to receive(:find).and_return(nil)      &lt;br /&gt;
          allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
          controller.send(:create)&lt;br /&gt;
          expect(flash[:error]).to be_eql('Missing assignment ID - Assignment ID entered is Nil')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when questionnaire id is entered as nil' do&lt;br /&gt;
        ## If questionnaire id is nil, then appropriate missing questionnaire id error should be flashed. &lt;br /&gt;
        it 'flashes a response of missing questionnaire id' do&lt;br /&gt;
          params = {  assignment_id: 1, questionnaire_id: nil }&lt;br /&gt;
&lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          allow(Assignment).to receive(:find).and_return(assignment)&lt;br /&gt;
          allow(Questionnaire).to receive(:find).and_return(nil)&lt;br /&gt;
          allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
          controller.send(:create)&lt;br /&gt;
          expect(flash[:error]).to be_eql('Missing questionnaire ID - Questionnaire ID entered is Nil')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      context 'when no assignment is associated with the id in the database' do&lt;br /&gt;
        ## If no assignment is associated with the id in database, then appropriate missing record error should be flashed&lt;br /&gt;
        it 'throws an error that the assignment does not exist in the db' do&lt;br /&gt;
          questionnaire1 = create(:questionnaire)&lt;br /&gt;
          params = {  assignment_id: 7, questionnaire_id: questionnaire1.id}&lt;br /&gt;
          &lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(7).and_return(nil)&lt;br /&gt;
          allow(Questionnaire).to receive(:find).and_return(questionnaire1)&lt;br /&gt;
          allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
          controller.send(:create)&lt;br /&gt;
          expect(flash[:error]).to be_eql('Assignment #7 does not currently exist.')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      context 'when no questionnaire is associated with the id in the database' do&lt;br /&gt;
         ## If no questionnaire is associated with the id in database, then appropriate missing record error should be flashed&lt;br /&gt;
        it 'throws an error that the questionnaire does not exist in the db' do&lt;br /&gt;
          params = { assignment_id: assignment.id, questionnaire_id: 7}&lt;br /&gt;
          &lt;br /&gt;
          stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
          allow(Assignment).to receive(:find).and_return(assignment)&lt;br /&gt;
          allow(Questionnaire).to receive(:find).with(7).and_return(nil)&lt;br /&gt;
          allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
          controller.send(:create)&lt;br /&gt;
          &lt;br /&gt;
          expect(flash[:error]).to be_eql('Questionnaire #7 does not currently exist.')&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
      # context 'when saving a new assignment questionnaire' do&lt;br /&gt;
      #   ## Checking if the assignment question is saved correctly to the database. &lt;br /&gt;
      #   it 'should save and redirect appropriatley' do&lt;br /&gt;
      #     assignment5 = create(:assignment)&lt;br /&gt;
      #     questionnaire1 = create(:questionnaire)&lt;br /&gt;
      #     params = { assignment_id: assignment5.id, questionnaire_id: questionnaire1.id }&lt;br /&gt;
&lt;br /&gt;
      #     stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      #     allow(Assignment).to receive(:find).and_return(assignment5)&lt;br /&gt;
      #     allow(Questionnaire).to receive(:find).and_return(questionnaire1)&lt;br /&gt;
      #     allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
      #     controller.send(:create)&lt;br /&gt;
&lt;br /&gt;
      #     expect(AssignmentQuestionnaire.where(assignment_id: assignment5.id).count).to eq(1)&lt;br /&gt;
      #   end&lt;br /&gt;
      # end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
The assignment_questionnaire_controller has been thoroughly tested to be merged with expertiza by the use of 12 different contexts as described in detail throughout this wiki page. Building this controller and respective rspec tests using Travis CI in the pull request fails due to a mimemagic error that is currently being resolved by expertiza leadership and does not reflect performance of the assignment_questionnaire rspec testing. There were several errors found and reported for the assignment_questionnaire controller that the team made a point to resolve. An error was found in the controller to include a flash message for both the case of a missing assignment_id and missing questionnaire_id where a nil value was attempting to be converted to a string. To solve this, the team changed the flash message to not include a nil.to_s value and instead implemented a pure string. Next, there were errors in the controller to which .id methods were being called on non-existing objects. To solve this, through testing results, the team passed params[:id].to_s instead for several cases throughout the controller. Additionally, there were several errors related to rendering the assignment_questionnaire paths. It was mentioned that the views associated with the rendering paths may be made with javascript at a later time, so the team chose to test the all the other parts of the controller except for the rendering portions of delete_all and create. However, the test cases for both the delete_all and create method's rendering portion were made and simply commented out for when the expertiza leadership decides which rendering format would benefit expertiza the most. Our goal for this project was to produce controller improving tests and update the controller so that it can be merged with the total system and make the total system perform better.&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/rachanakondabala/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [https://drive.google.com/file/d/1ipwrkq7zybhHWLjCHoajGTC2pNm2nLz3/view?usp=sharing here].&lt;/div&gt;</summary>
		<author><name>Jmhardy3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143517</id>
		<title>CSC/ECE 517 Spring 2022 - E2201: Testing for assignment questionnaire controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143517"/>
		<updated>2022-03-22T03:15:32Z</updated>

		<summary type="html">&lt;p&gt;Jmhardy3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2201: Testing for assignment_questionnaire_controller&amp;quot; is focused on adding unit tests for assignment_questionnaire_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* assignment_questionnaire_controller.rb&lt;br /&gt;
* assignment_questionnaire_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/assignment_questionnaire_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
assignment_questionnaire_controller had 3 methods for which unit tests were missing. The RSpec unit tests added for these methods in the spec file 'assignment_questionnaire_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the Assignment. The action is passed in the params.&lt;br /&gt;
For the controller tested, there were 4 contexts to test. The first being when there is not an assignment associated with the assignment id, the action should not be allowed and returns false. Next, a stub instructor was created to verify if the action would also be false for when an instructor of the assignment was the current user. Similarly this was done for finding if the user was the ancestor of the assignment and this would return true. And again this was done for the case if the assignment's course's ta is the same ta who signed in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when no assignment is associated with the id' do&lt;br /&gt;
      it 'refuses certain action' do&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(nil)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_falsey&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'instructor is the parent of the assignment found' do&lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_falsey&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'user is the ancestor of the assignment found' do&lt;br /&gt;
      ##Assert if the user, who is the ancestor of the instructor who created the course, is allowed to perform the action. &lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment3)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_truthy&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'course ta is allowed to perform actions on the assignment found' do&lt;br /&gt;
      ##Created an assignment for a course&lt;br /&gt;
      ##Assigned a ta to that course&lt;br /&gt;
      ##Assert if this assignment's course's ta is the same guy who signed in. &lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        ta1 = create(:teaching_assistant, id: 25)&lt;br /&gt;
        ta2 = create(:teaching_assistant, id:40, name: 'test_ta_2')&lt;br /&gt;
        course1 = create(:course)&lt;br /&gt;
        assignment4 = create(:assignment, course_id: course1.id, instructor_id: instructor1)&lt;br /&gt;
        TaMapping.create(ta_id: ta1.id, course_id: course1.id)&lt;br /&gt;
        &lt;br /&gt;
        stub_current_user(ta2, ta2.role.name, ta2.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment4)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== delete_all ===&lt;br /&gt;
This action is called in the process of deleting an assignment_questionnaire that is associated with an assignment. When this action is successfully executed or the questionnaire is successfully destroyed upon an assignment's deletion, then the test below tests to see that the AssignmentQuestionnaire table is updated to reflect this deltion. Furthermore, the tests below verify that a error flash is present if there is no such assignment_id associated with the requested assignment to be deleted.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   context 'when no assignment is associated with the id in the database' do&lt;br /&gt;
      it 'refuses certain action' do&lt;br /&gt;
        params = {:assignment_id =&amp;gt; 20}&lt;br /&gt;
        session = { user: super_admin }&lt;br /&gt;
&lt;br /&gt;
        allow(Assignment).to receive(:find).with('20').and_return(nil)&lt;br /&gt;
        post :delete_all, params, session&lt;br /&gt;
        expect(flash[:error]).to be_present&lt;br /&gt;
        # expect(flash[:error]).to eq('Assignment #' + params[:assignment_id].to_s + ' does not currently exist.')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
    context 'when questionnaires related to an assignment are deleted' do&lt;br /&gt;
      it 'should persist that delete in the database' do&lt;br /&gt;
        assignment5 = create(:assignment)&lt;br /&gt;
&lt;br /&gt;
        questionnaire1 = create(:questionnaire)&lt;br /&gt;
        questionnaire2 = create(:questionnaire)&lt;br /&gt;
        questionnaire3 = create(:questionnaire)&lt;br /&gt;
&lt;br /&gt;
        assignment_questionnaire1 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire1.id)&lt;br /&gt;
        assignment_questionnaire2 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire2.id)&lt;br /&gt;
        assignment_questionnaire3 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire3.id)&lt;br /&gt;
&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment5)&lt;br /&gt;
        allow(controller).to receive(:params).and_return({assignment_id: assignment5.id})&lt;br /&gt;
        controller.send(:delete_all)&lt;br /&gt;
&lt;br /&gt;
        expect(AssignmentQuestionnaire.where(assignment_id: assignment5.id).count).to eq(0)&lt;br /&gt;
&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create ===&lt;br /&gt;
This method is used to create an AssignmentQuestionnaire entry. But first, the testing file below verifies that there is not a missing assignment id when creating an entry. This testing confirmed that the assignment_questionnaire_controller.rb file needed to be updated to remove a portion of the proposed error flash that was unable to convert a nil value to a string in the case of a missing assignment_id. This was the same result for in the case of a missing questionnaire_id.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'when assignment id is not entered' do&lt;br /&gt;
        it 'flashes a response of missing assignment id' do&lt;br /&gt;
          session = { user: super_admin}&lt;br /&gt;
          params = { :assignment_id =&amp;gt; nil}&lt;br /&gt;
          get :create, params, session&lt;br /&gt;
          # expect(flash[:error]).to eq('Missing assignment:' + params[:assigment_id])&lt;br /&gt;
          expect(flash[:error]).to be_present&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
The assignment_questionnaire_controller has been thoroughly tested in its present state. An error was found in the controller to include a flash message for both the case of a missing assignment_id and missing questionnaire_id where a nil value was attempting to be converted to a string.&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/rachanakondabala/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [https://drive.google.com/file/d/1IWC_8jxRqejfJEGVIB_SzV9enKW31yo7/view?usp=sharing here].&lt;/div&gt;</summary>
		<author><name>Jmhardy3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143516</id>
		<title>CSC/ECE 517 Spring 2022 - E2201: Testing for assignment questionnaire controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143516"/>
		<updated>2022-03-22T03:14:43Z</updated>

		<summary type="html">&lt;p&gt;Jmhardy3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2201: Testing for assignment_questionnaire_controller&amp;quot; is focused on adding unit tests for assignment_questionnaire_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* assignment_questionnaire_controller.rb&lt;br /&gt;
* assignment_questionnaire_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/assignment_questionnaire_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
assignment_questionnaire_controller had 3 methods for which unit tests were missing as seen in this [https://coveralls.io/builds/46937123/source?filename=app/controllers/users_controller.rb coverall]. The RSpec unit tests added for these methods in the spec file 'assignment_questionnaire_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the Assignment. The action is passed in the params.&lt;br /&gt;
For the controller tested, there were 4 contexts to test. The first being when there is not an assignment associated with the assignment id, the action should not be allowed and returns false. Next, a stub instructor was created to verify if the action would also be false for when an instructor of the assignment was the current user. Similarly this was done for finding if the user was the ancestor of the assignment and this would return true. And again this was done for the case if the assignment's course's ta is the same ta who signed in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when no assignment is associated with the id' do&lt;br /&gt;
      it 'refuses certain action' do&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(nil)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_falsey&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'instructor is the parent of the assignment found' do&lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_falsey&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'user is the ancestor of the assignment found' do&lt;br /&gt;
      ##Assert if the user, who is the ancestor of the instructor who created the course, is allowed to perform the action. &lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment3)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_truthy&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'course ta is allowed to perform actions on the assignment found' do&lt;br /&gt;
      ##Created an assignment for a course&lt;br /&gt;
      ##Assigned a ta to that course&lt;br /&gt;
      ##Assert if this assignment's course's ta is the same guy who signed in. &lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        ta1 = create(:teaching_assistant, id: 25)&lt;br /&gt;
        ta2 = create(:teaching_assistant, id:40, name: 'test_ta_2')&lt;br /&gt;
        course1 = create(:course)&lt;br /&gt;
        assignment4 = create(:assignment, course_id: course1.id, instructor_id: instructor1)&lt;br /&gt;
        TaMapping.create(ta_id: ta1.id, course_id: course1.id)&lt;br /&gt;
        &lt;br /&gt;
        stub_current_user(ta2, ta2.role.name, ta2.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment4)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== delete_all ===&lt;br /&gt;
This action is called in the process of deleting an assignment_questionnaire that is associated with an assignment. When this action is successfully executed or the questionnaire is successfully destroyed upon an assignment's deletion, then the test below tests to see that the AssignmentQuestionnaire table is updated to reflect this deltion. Furthermore, the tests below verify that a error flash is present if there is no such assignment_id associated with the requested assignment to be deleted.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   context 'when no assignment is associated with the id in the database' do&lt;br /&gt;
      it 'refuses certain action' do&lt;br /&gt;
        params = {:assignment_id =&amp;gt; 20}&lt;br /&gt;
        session = { user: super_admin }&lt;br /&gt;
&lt;br /&gt;
        allow(Assignment).to receive(:find).with('20').and_return(nil)&lt;br /&gt;
        post :delete_all, params, session&lt;br /&gt;
        expect(flash[:error]).to be_present&lt;br /&gt;
        # expect(flash[:error]).to eq('Assignment #' + params[:assignment_id].to_s + ' does not currently exist.')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
    context 'when questionnaires related to an assignment are deleted' do&lt;br /&gt;
      it 'should persist that delete in the database' do&lt;br /&gt;
        assignment5 = create(:assignment)&lt;br /&gt;
&lt;br /&gt;
        questionnaire1 = create(:questionnaire)&lt;br /&gt;
        questionnaire2 = create(:questionnaire)&lt;br /&gt;
        questionnaire3 = create(:questionnaire)&lt;br /&gt;
&lt;br /&gt;
        assignment_questionnaire1 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire1.id)&lt;br /&gt;
        assignment_questionnaire2 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire2.id)&lt;br /&gt;
        assignment_questionnaire3 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire3.id)&lt;br /&gt;
&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment5)&lt;br /&gt;
        allow(controller).to receive(:params).and_return({assignment_id: assignment5.id})&lt;br /&gt;
        controller.send(:delete_all)&lt;br /&gt;
&lt;br /&gt;
        expect(AssignmentQuestionnaire.where(assignment_id: assignment5.id).count).to eq(0)&lt;br /&gt;
&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create ===&lt;br /&gt;
This method is used to create an AssignmentQuestionnaire entry. But first, the testing file below verifies that there is not a missing assignment id when creating an entry. This testing confirmed that the assignment_questionnaire_controller.rb file needed to be updated to remove a portion of the proposed error flash that was unable to convert a nil value to a string in the case of a missing assignment_id. This was the same result for in the case of a missing questionnaire_id.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'when assignment id is not entered' do&lt;br /&gt;
        it 'flashes a response of missing assignment id' do&lt;br /&gt;
          session = { user: super_admin}&lt;br /&gt;
          params = { :assignment_id =&amp;gt; nil}&lt;br /&gt;
          get :create, params, session&lt;br /&gt;
          # expect(flash[:error]).to eq('Missing assignment:' + params[:assigment_id])&lt;br /&gt;
          expect(flash[:error]).to be_present&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
The assignment_questionnaire_controller has been thoroughly tested in its present state. An error was found in the controller to include a flash message for both the case of a missing assignment_id and missing questionnaire_id where a nil value was attempting to be converted to a string.&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/rachanakondabala/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [https://drive.google.com/file/d/1IWC_8jxRqejfJEGVIB_SzV9enKW31yo7/view?usp=sharing here].&lt;/div&gt;</summary>
		<author><name>Jmhardy3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143515</id>
		<title>CSC/ECE 517 Spring 2022 - E2201: Testing for assignment questionnaire controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143515"/>
		<updated>2022-03-22T03:07:23Z</updated>

		<summary type="html">&lt;p&gt;Jmhardy3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2201: Testing for assignment_questionnaire_controller&amp;quot; is focused on adding unit tests for assignment_questionnaire_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* assignment_questionnaire_controller.rb&lt;br /&gt;
* assignment_questionnaire_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/assignment_questionnaire_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
assignment_questionnaire_controller had 3 methods for which unit tests were missing as seen in this [https://coveralls.io/builds/46937123/source?filename=app/controllers/users_controller.rb coverall]. The RSpec unit tests added for these methods in the spec file 'assignment_questionnaire_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the Assignment. The action is passed in the params.&lt;br /&gt;
For the controller tested, there were 4 contexts to test. The first being when there is not an assignment associated with the assignment id, the action should not be allowed and returns false. Next, a stub instructor was created to verify if the action would also be false for when an instructor of the assignment was the current user. Similarly this was done for finding if the user was the ancestor of the assignment and this would return true. And again this was done for the case if the assignment's course's ta is the same ta who signed in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when no assignment is associated with the id' do&lt;br /&gt;
      it 'refuses certain action' do&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(nil)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_falsey&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'instructor is the parent of the assignment found' do&lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_falsey&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'user is the ancestor of the assignment found' do&lt;br /&gt;
      ##Assert if the user, who is the ancestor of the instructor who created the course, is allowed to perform the action. &lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment3)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_truthy&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'course ta is allowed to perform actions on the assignment found' do&lt;br /&gt;
      ##Created an assignment for a course&lt;br /&gt;
      ##Assigned a ta to that course&lt;br /&gt;
      ##Assert if this assignment's course's ta is the same guy who signed in. &lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        ta1 = create(:teaching_assistant, id: 25)&lt;br /&gt;
        ta2 = create(:teaching_assistant, id:40, name: 'test_ta_2')&lt;br /&gt;
        course1 = create(:course)&lt;br /&gt;
        assignment4 = create(:assignment, course_id: course1.id, instructor_id: instructor1)&lt;br /&gt;
        TaMapping.create(ta_id: ta1.id, course_id: course1.id)&lt;br /&gt;
        &lt;br /&gt;
        stub_current_user(ta2, ta2.role.name, ta2.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment4)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== delete_all ===&lt;br /&gt;
This action is called in the process of deleting an assignment_questionnaire that is associated with an assignment. When this action is successfully executed or the questionnaire is successfully destroyed upon an assignment's deletion, then the test below tests to see that the AssignmentQuestionnaire table is updated to reflect this deltion. Furthermore, the tests below verify that a error flash is present if there is no such assignment_id associated with the requested assignment to be deleted.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   context 'when no assignment is associated with the id in the database' do&lt;br /&gt;
      it 'refuses certain action' do&lt;br /&gt;
        params = {:assignment_id =&amp;gt; 20}&lt;br /&gt;
        session = { user: super_admin }&lt;br /&gt;
&lt;br /&gt;
        allow(Assignment).to receive(:find).with('20').and_return(nil)&lt;br /&gt;
        post :delete_all, params, session&lt;br /&gt;
        expect(flash[:error]).to be_present&lt;br /&gt;
        # expect(flash[:error]).to eq('Assignment #' + params[:assignment_id].to_s + ' does not currently exist.')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
    context 'when questionnaires related to an assignment are deleted' do&lt;br /&gt;
      it 'should persist that delete in the database' do&lt;br /&gt;
        assignment5 = create(:assignment)&lt;br /&gt;
&lt;br /&gt;
        questionnaire1 = create(:questionnaire)&lt;br /&gt;
        questionnaire2 = create(:questionnaire)&lt;br /&gt;
        questionnaire3 = create(:questionnaire)&lt;br /&gt;
&lt;br /&gt;
        assignment_questionnaire1 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire1.id)&lt;br /&gt;
        assignment_questionnaire2 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire2.id)&lt;br /&gt;
        assignment_questionnaire3 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire3.id)&lt;br /&gt;
&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment5)&lt;br /&gt;
        allow(controller).to receive(:params).and_return({assignment_id: assignment5.id})&lt;br /&gt;
        controller.send(:delete_all)&lt;br /&gt;
&lt;br /&gt;
        expect(AssignmentQuestionnaire.where(assignment_id: assignment5.id).count).to eq(0)&lt;br /&gt;
&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create ===&lt;br /&gt;
This method is used to create an AssignmentQuestionnaire entry. But first, the testing file below verifies that there is not a missing assignment id when creating an entry. This testing confirmed that the assignment_questionnaire_controller.rb file needed to be updated to remove a portion of the proposed error flash that was unable to convert a nil value to a string in the case of a missing assignment_id. This was the same result for in the case of a missing questionnaire_id.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'when assignment id is not entered' do&lt;br /&gt;
        it 'flashes a response of missing assignment id' do&lt;br /&gt;
          session = { user: super_admin}&lt;br /&gt;
          params = { :assignment_id =&amp;gt; nil}&lt;br /&gt;
          get :create, params, session&lt;br /&gt;
          # expect(flash[:error]).to eq('Missing assignment:' + params[:assigment_id])&lt;br /&gt;
          expect(flash[:error]).to be_present&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
The assignment_questionnaire_controller has been thoroughly tested in its present state. An error was found in the controller to include a flash message for both the case of a missing assignment_id and missing questionnaire_id where a nil value was attempting to be converted to a string.&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/rachanakondabala/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [ here].&lt;/div&gt;</summary>
		<author><name>Jmhardy3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143513</id>
		<title>CSC/ECE 517 Spring 2022 - E2201: Testing for assignment questionnaire controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143513"/>
		<updated>2022-03-22T03:04:23Z</updated>

		<summary type="html">&lt;p&gt;Jmhardy3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2201: Testing for assignment_questionnaire_controller&amp;quot; is focused on adding unit tests for assignment_questionnaire_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* assignment_questionnaire_controller.rb&lt;br /&gt;
* assignment_questionnaire_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/assignment_questionnaire_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
assignment_questionnaire_controller had 3 methods for which unit tests were missing as seen in this [https://coveralls.io/builds/46937123/source?filename=app/controllers/users_controller.rb coverall]. The RSpec unit tests added for these methods in the spec file 'assignment_questionnaire_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the Assignment. The action is passed in the params. In this case we are testing the action list_pending_requested.&lt;br /&gt;
For the controller tested, there were 4 contexts to test. The first being when there is not an assignment associated with the assignment id, the action should not be allowed and returns false. Next, a stub instructor was created to verify if the action would also be false for when an instructor of the assignment was the current user. Similarly this was done for finding if the user was the ancestor of the assignment and this would return true. And again this was done for the case if the assignment's course's ta is the same ta who signed in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when no assignment is associated with the id' do&lt;br /&gt;
      it 'refuses certain action' do&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(nil)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_falsey&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'instructor is the parent of the assignment found' do&lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_falsey&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'user is the ancestor of the assignment found' do&lt;br /&gt;
      ##Assert if the user, who is the ancestor of the instructor who created the course, is allowed to perform the action. &lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment3)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_truthy&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'course ta is allowed to perform actions on the assignment found' do&lt;br /&gt;
      ##Created an assignment for a course&lt;br /&gt;
      ##Assigned a ta to that course&lt;br /&gt;
      ##Assert if this assignment's course's ta is the same guy who signed in. &lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        ta1 = create(:teaching_assistant, id: 25)&lt;br /&gt;
        ta2 = create(:teaching_assistant, id:40, name: 'test_ta_2')&lt;br /&gt;
        course1 = create(:course)&lt;br /&gt;
        assignment4 = create(:assignment, course_id: course1.id, instructor_id: instructor1)&lt;br /&gt;
        TaMapping.create(ta_id: ta1.id, course_id: course1.id)&lt;br /&gt;
        &lt;br /&gt;
        stub_current_user(ta2, ta2.role.name, ta2.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment4)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== delete_all ===&lt;br /&gt;
This action is called in the process of deleting an assignment_questionnaire that is associated with an assignment. When this action is successfully executed or the questionnaire is successfully destroyed upon an assignment's deletion, then the test below tests to see that the AssignmentQuestionnaire table is updated to reflect this deltion. Furthermore, the tests below verify that a error flash is present if there is no such assignment_id associated with the requested assignment to be deleted.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   context 'when no assignment is associated with the id in the database' do&lt;br /&gt;
      it 'refuses certain action' do&lt;br /&gt;
        params = {:assignment_id =&amp;gt; 20}&lt;br /&gt;
        session = { user: super_admin }&lt;br /&gt;
&lt;br /&gt;
        allow(Assignment).to receive(:find).with('20').and_return(nil)&lt;br /&gt;
        post :delete_all, params, session&lt;br /&gt;
        expect(flash[:error]).to be_present&lt;br /&gt;
        # expect(flash[:error]).to eq('Assignment #' + params[:assignment_id].to_s + ' does not currently exist.')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
    context 'when questionnaires related to an assignment are deleted' do&lt;br /&gt;
      it 'should persist that delete in the database' do&lt;br /&gt;
        assignment5 = create(:assignment)&lt;br /&gt;
&lt;br /&gt;
        questionnaire1 = create(:questionnaire)&lt;br /&gt;
        questionnaire2 = create(:questionnaire)&lt;br /&gt;
        questionnaire3 = create(:questionnaire)&lt;br /&gt;
&lt;br /&gt;
        assignment_questionnaire1 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire1.id)&lt;br /&gt;
        assignment_questionnaire2 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire2.id)&lt;br /&gt;
        assignment_questionnaire3 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire3.id)&lt;br /&gt;
&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment5)&lt;br /&gt;
        allow(controller).to receive(:params).and_return({assignment_id: assignment5.id})&lt;br /&gt;
        controller.send(:delete_all)&lt;br /&gt;
&lt;br /&gt;
        expect(AssignmentQuestionnaire.where(assignment_id: assignment5.id).count).to eq(0)&lt;br /&gt;
&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create ===&lt;br /&gt;
This method is used to create an AssignmentQuestionnaire entry. But first, the testing file below verifies that there is not a missing assignment id when creating an entry. This testing confirmed that the assignment_questionnaire_controller.rb file needed to be updated to remove a portion of the proposed error flash that was unable to convert a nil value to a string in the case of a missing assignment_id. This was the same result for in the case of a missing questionnaire_id.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'when assignment id is not entered' do&lt;br /&gt;
        it 'flashes a response of missing assignment id' do&lt;br /&gt;
          session = { user: super_admin}&lt;br /&gt;
          params = { :assignment_id =&amp;gt; nil}&lt;br /&gt;
          get :create, params, session&lt;br /&gt;
          # expect(flash[:error]).to eq('Missing assignment:' + params[:assigment_id])&lt;br /&gt;
          expect(flash[:error]).to be_present&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
The assignment_questionnaire_controller has been thoroughly tested in its present state. An error was found in the controller to include a flash message for both the case of a missing assignment_id and missing questionnaire_id where a nil value was attempting to be converted to a string.&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/rachanakondabala/expertiza.git here].&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [ here].&lt;/div&gt;</summary>
		<author><name>Jmhardy3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143512</id>
		<title>CSC/ECE 517 Spring 2022 - E2201: Testing for assignment questionnaire controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143512"/>
		<updated>2022-03-22T02:59:45Z</updated>

		<summary type="html">&lt;p&gt;Jmhardy3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2201: Testing for assignment_questionnaire_controller&amp;quot; is focused on adding unit tests for assignment_questionnaire_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* assignment_questionnaire_controller.rb&lt;br /&gt;
* assignment_questionnaire_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/assignment_questionnaire_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
assignment_questionnaire_controller had 3 methods for which unit tests were missing as seen in this [https://coveralls.io/builds/46937123/source?filename=app/controllers/users_controller.rb coverall]. The RSpec unit tests added for these methods in the spec file 'assignment_questionnaire_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the Assignment. The action is passed in the params. In this case we are testing the action list_pending_requested.&lt;br /&gt;
For the controller tested, there were 4 contexts to test. The first being when there is not an assignment associated with the assignment id, the action should not be allowed and returns false. Next, a stub instructor was created to verify if the action would also be false for when an instructor of the assignment was the current user. Similarly this was done for finding if the user was the ancestor of the assignment and this would return true. And again this was done for the case if the assignment's course's ta is the same ta who signed in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when no assignment is associated with the id' do&lt;br /&gt;
      it 'refuses certain action' do&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(nil)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_falsey&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'instructor is the parent of the assignment found' do&lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_falsey&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'user is the ancestor of the assignment found' do&lt;br /&gt;
      ##Assert if the user, who is the ancestor of the instructor who created the course, is allowed to perform the action. &lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment3)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_truthy&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'course ta is allowed to perform actions on the assignment found' do&lt;br /&gt;
      ##Created an assignment for a course&lt;br /&gt;
      ##Assigned a ta to that course&lt;br /&gt;
      ##Assert if this assignment's course's ta is the same guy who signed in. &lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        ta1 = create(:teaching_assistant, id: 25)&lt;br /&gt;
        ta2 = create(:teaching_assistant, id:40, name: 'test_ta_2')&lt;br /&gt;
        course1 = create(:course)&lt;br /&gt;
        assignment4 = create(:assignment, course_id: course1.id, instructor_id: instructor1)&lt;br /&gt;
        TaMapping.create(ta_id: ta1.id, course_id: course1.id)&lt;br /&gt;
        &lt;br /&gt;
        stub_current_user(ta2, ta2.role.name, ta2.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment4)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== delete_all ===&lt;br /&gt;
This action is called in the process of deleting an assignment_questionnaire that is associated with an assignment. When this action is successfully executed or the questionnaire is successfully destroyed upon an assignment's deletion, then the test below tests to see that the AssignmentQuestionnaire table is updated to reflect this deltion. Furthermore, the tests below verify that a error flash is present if there is no such assignment_id associated with the requested assignment to be deleted.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   context 'when no assignment is associated with the id in the database' do&lt;br /&gt;
      it 'refuses certain action' do&lt;br /&gt;
        params = {:assignment_id =&amp;gt; 20}&lt;br /&gt;
        session = { user: super_admin }&lt;br /&gt;
&lt;br /&gt;
        allow(Assignment).to receive(:find).with('20').and_return(nil)&lt;br /&gt;
        post :delete_all, params, session&lt;br /&gt;
        expect(flash[:error]).to be_present&lt;br /&gt;
        # expect(flash[:error]).to eq('Assignment #' + params[:assignment_id].to_s + ' does not currently exist.')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
    context 'when questionnaires related to an assignment are deleted' do&lt;br /&gt;
      it 'should persist that delete in the database' do&lt;br /&gt;
        assignment5 = create(:assignment)&lt;br /&gt;
&lt;br /&gt;
        questionnaire1 = create(:questionnaire)&lt;br /&gt;
        questionnaire2 = create(:questionnaire)&lt;br /&gt;
        questionnaire3 = create(:questionnaire)&lt;br /&gt;
&lt;br /&gt;
        assignment_questionnaire1 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire1.id)&lt;br /&gt;
        assignment_questionnaire2 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire2.id)&lt;br /&gt;
        assignment_questionnaire3 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire3.id)&lt;br /&gt;
&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment5)&lt;br /&gt;
        allow(controller).to receive(:params).and_return({assignment_id: assignment5.id})&lt;br /&gt;
        controller.send(:delete_all)&lt;br /&gt;
&lt;br /&gt;
        expect(AssignmentQuestionnaire.where(assignment_id: assignment5.id).count).to eq(0)&lt;br /&gt;
&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create ===&lt;br /&gt;
This method is used to create an AssignmentQuestionnaire entry. But first, the testing file below verifies that there is not a missing assignment id when creating an entry. This testing confirmed that the assignment_questionnaire_controller.rb file needed to be updated to remove a portion of the proposed error flash that was unable to convert a nil value to a string in the case of a missing assignment_id. This was the same result for in the case of a missing questionnaire_id.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context 'when assignment id is not entered' do&lt;br /&gt;
        it 'flashes a response of missing assignment id' do&lt;br /&gt;
          session = { user: super_admin}&lt;br /&gt;
          params = { :assignment_id =&amp;gt; nil}&lt;br /&gt;
          get :create, params, session&lt;br /&gt;
          # expect(flash[:error]).to eq('Missing assignment:' + params[:assigment_id])&lt;br /&gt;
          expect(flash[:error]).to be_present&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
The assignment_questionnaire_controller has been thoroughly tested in its present state. An error was found in the controller to include a flash message for both the case of a missing assignment_id and missing questionnaire_id where a nil value was attempting to be converted to a string.&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/Harshil-Shah99/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [https://drive.google.com/file/d/1rpMtT_sEtHmTHOUvq4Qw4lLyrpbVWU5Q/view?usp=sharing here].&lt;/div&gt;</summary>
		<author><name>Jmhardy3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143509</id>
		<title>CSC/ECE 517 Spring 2022 - E2201: Testing for assignment questionnaire controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143509"/>
		<updated>2022-03-22T02:51:50Z</updated>

		<summary type="html">&lt;p&gt;Jmhardy3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2201: Testing for assignment_questionnaire_controller&amp;quot; is focused on adding unit tests for assignment_questionnaire_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* assignment_questionnaire_controller.rb&lt;br /&gt;
* assignment_questionnaire_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/assignment_questionnaire_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
assignment_questionnaire_controller had 3 methods for which unit tests were missing as seen in this [https://coveralls.io/builds/46937123/source?filename=app/controllers/users_controller.rb coverall]. The RSpec unit tests added for these methods in the spec file 'assignment_questionnaire_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the Assignment. The action is passed in the params. In this case we are testing the action list_pending_requested.&lt;br /&gt;
For the controller tested, there were 4 contexts to test. The first being when there is not an assignment associated with the assignment id, the action should not be allowed and returns false. Next, a stub instructor was created to verify if the action would also be false for when an instructor of the assignment was the current user. Similarly this was done for finding if the user was the ancestor of the assignment and this would return true. And again this was done for the case if the assignment's course's ta is the same ta who signed in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when no assignment is associated with the id' do&lt;br /&gt;
      it 'refuses certain action' do&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(nil)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_falsey&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'instructor is the parent of the assignment found' do&lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_falsey&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'user is the ancestor of the assignment found' do&lt;br /&gt;
      ##Assert if the user, who is the ancestor of the instructor who created the course, is allowed to perform the action. &lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment3)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_truthy&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'course ta is allowed to perform actions on the assignment found' do&lt;br /&gt;
      ##Created an assignment for a course&lt;br /&gt;
      ##Assigned a ta to that course&lt;br /&gt;
      ##Assert if this assignment's course's ta is the same guy who signed in. &lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        ta1 = create(:teaching_assistant, id: 25)&lt;br /&gt;
        ta2 = create(:teaching_assistant, id:40, name: 'test_ta_2')&lt;br /&gt;
        course1 = create(:course)&lt;br /&gt;
        assignment4 = create(:assignment, course_id: course1.id, instructor_id: instructor1)&lt;br /&gt;
        TaMapping.create(ta_id: ta1.id, course_id: course1.id)&lt;br /&gt;
        &lt;br /&gt;
        stub_current_user(ta2, ta2.role.name, ta2.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment4)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== delete_all ===&lt;br /&gt;
This action is called in the process of deleting an assignment_questionnaire that is associated with an assignment. When this action is successfully executed or the questionnaire is successfully destroyed upon an assignment's deletion, then the test below tests to see that the AssignmentQuestionnaire table is updated to reflect this deltion. Furthermore, the tests below verify that a error flash is present if there is no such assignment_id associated with the requested assignment to be deleted.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   context 'when no assignment is associated with the id in the database' do&lt;br /&gt;
      it 'refuses certain action' do&lt;br /&gt;
        params = {:assignment_id =&amp;gt; 20}&lt;br /&gt;
        session = { user: super_admin }&lt;br /&gt;
&lt;br /&gt;
        allow(Assignment).to receive(:find).with('20').and_return(nil)&lt;br /&gt;
        post :delete_all, params, session&lt;br /&gt;
        expect(flash[:error]).to be_present&lt;br /&gt;
        # expect(flash[:error]).to eq('Assignment #' + params[:assignment_id].to_s + ' does not currently exist.')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
    context 'when questionnaires related to an assignment are deleted' do&lt;br /&gt;
      it 'should persist that delete in the database' do&lt;br /&gt;
        assignment5 = create(:assignment)&lt;br /&gt;
&lt;br /&gt;
        questionnaire1 = create(:questionnaire)&lt;br /&gt;
        questionnaire2 = create(:questionnaire)&lt;br /&gt;
        questionnaire3 = create(:questionnaire)&lt;br /&gt;
&lt;br /&gt;
        assignment_questionnaire1 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire1.id)&lt;br /&gt;
        assignment_questionnaire2 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire2.id)&lt;br /&gt;
        assignment_questionnaire3 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire3.id)&lt;br /&gt;
&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment5)&lt;br /&gt;
        allow(controller).to receive(:params).and_return({assignment_id: assignment5.id})&lt;br /&gt;
        controller.send(:delete_all)&lt;br /&gt;
&lt;br /&gt;
        expect(AssignmentQuestionnaire.where(assignment_id: assignment5.id).count).to eq(0)&lt;br /&gt;
&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;br /&gt;
This method is also private and needs to be tested through list action. The parameter paginate_options which decides the execution of statement we need to test is predefined in the paginate_list, and thus the required statement cannot be accessed or tested. So, we tested the other statements in the method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#list' do&lt;br /&gt;
    it 'checks that paginate_list does not fail with controller' do&lt;br /&gt;
      expect{controller.list}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with post' do&lt;br /&gt;
      post :list&lt;br /&gt;
      expect(response.status).to eq(200)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
The users_controller has been thoroughly tested in its present state. The auto_complete_result method in auto_complete_for_user_name method needs to be defined. Further, the paginate_list method needs to be refactored so that all statements in the method are accessible and may be tested.&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/Harshil-Shah99/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [https://drive.google.com/file/d/1rpMtT_sEtHmTHOUvq4Qw4lLyrpbVWU5Q/view?usp=sharing here].&lt;/div&gt;</summary>
		<author><name>Jmhardy3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143508</id>
		<title>CSC/ECE 517 Spring 2022 - E2201: Testing for assignment questionnaire controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143508"/>
		<updated>2022-03-22T02:42:17Z</updated>

		<summary type="html">&lt;p&gt;Jmhardy3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2201: Testing for assignment_questionnaire_controller&amp;quot; is focused on adding unit tests for assignment_questionnaire_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* assignment_questionnaire_controller.rb&lt;br /&gt;
* assignment_questionnaire_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/assignment_questionnaire_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
assignment_questionnaire_controller had 3 methods for which unit tests were missing as seen in this [https://coveralls.io/builds/46937123/source?filename=app/controllers/users_controller.rb coverall]. The RSpec unit tests added for these methods in the spec file 'assignment_questionnaire_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the Assignment. The action is passed in the params. In this case we are testing the action list_pending_requested.&lt;br /&gt;
For the controller tested, there were 4 contexts to test. The first being when there is not an assignment associated with the assignment id, the action should not be allowed and returns false. Next, a stub instructor was created to verify if the action would also be false for when an instructor of the assignment was the current user. Similarly this was done for finding if the user was the ancestor of the assignment and this would return true. And again this was done for the case if the assignment's course's ta is the same ta who signed in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when no assignment is associated with the id' do&lt;br /&gt;
      it 'refuses certain action' do&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(nil)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_falsey&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'instructor is the parent of the assignment found' do&lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_falsey&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'user is the ancestor of the assignment found' do&lt;br /&gt;
      ##Assert if the user, who is the ancestor of the instructor who created the course, is allowed to perform the action. &lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment3)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_truthy&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'course ta is allowed to perform actions on the assignment found' do&lt;br /&gt;
      ##Created an assignment for a course&lt;br /&gt;
      ##Assigned a ta to that course&lt;br /&gt;
      ##Assert if this assignment's course's ta is the same guy who signed in. &lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        ta1 = create(:teaching_assistant, id: 25)&lt;br /&gt;
        ta2 = create(:teaching_assistant, id:40, name: 'test_ta_2')&lt;br /&gt;
        course1 = create(:course)&lt;br /&gt;
        assignment4 = create(:assignment, course_id: course1.id, instructor_id: instructor1)&lt;br /&gt;
        TaMapping.create(ta_id: ta1.id, course_id: course1.id)&lt;br /&gt;
        &lt;br /&gt;
        stub_current_user(ta2, ta2.role.name, ta2.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment4)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== delete_all ===&lt;br /&gt;
This action is called in the process of deleting a user. When this action is successfully executed or user is successfully destroyed (when User is passed a valid value 'student1') a note alert is flashed, whereas in case user is not destroyed (when User is passed an invalid value 'nil') an error is flashed. Further, it is being tested that at the end in both cases it redirects to list action.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   context 'when no assignment is associated with the id in the database' do&lt;br /&gt;
      it 'refuses certain action' do&lt;br /&gt;
        params = {:assignment_id =&amp;gt; 20}&lt;br /&gt;
        session = { user: super_admin }&lt;br /&gt;
&lt;br /&gt;
        allow(Assignment).to receive(:find).with('20').and_return(nil)&lt;br /&gt;
        post :delete_all, params, session&lt;br /&gt;
        expect(flash[:error]).to be_present&lt;br /&gt;
        # expect(flash[:error]).to eq('Assignment #' + params[:assignment_id].to_s + ' does not currently exist.')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
    context 'when questionnaires related to an assignment are deleted' do&lt;br /&gt;
      it 'should persist that delete in the database' do&lt;br /&gt;
        assignment5 = create(:assignment)&lt;br /&gt;
&lt;br /&gt;
        questionnaire1 = create(:questionnaire)&lt;br /&gt;
        questionnaire2 = create(:questionnaire)&lt;br /&gt;
        questionnaire3 = create(:questionnaire)&lt;br /&gt;
&lt;br /&gt;
        assignment_questionnaire1 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire1.id)&lt;br /&gt;
        assignment_questionnaire2 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire2.id)&lt;br /&gt;
        assignment_questionnaire3 = create(:assignment_questionnaire, assignment_id: assignment5.id, questionnaire_id: questionnaire3.id)&lt;br /&gt;
&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment5)&lt;br /&gt;
        allow(controller).to receive(:params).and_return({assignment_id: assignment5.id})&lt;br /&gt;
        controller.send(:delete_all)&lt;br /&gt;
&lt;br /&gt;
        expect(AssignmentQuestionnaire.where(assignment_id: assignment5.id).count).to eq(0)&lt;br /&gt;
&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;br /&gt;
This method is also private and needs to be tested through list action. The parameter paginate_options which decides the execution of statement we need to test is predefined in the paginate_list, and thus the required statement cannot be accessed or tested. So, we tested the other statements in the method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#list' do&lt;br /&gt;
    it 'checks that paginate_list does not fail with controller' do&lt;br /&gt;
      expect{controller.list}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with post' do&lt;br /&gt;
      post :list&lt;br /&gt;
      expect(response.status).to eq(200)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
The users_controller has been thoroughly tested in its present state. The auto_complete_result method in auto_complete_for_user_name method needs to be defined. Further, the paginate_list method needs to be refactored so that all statements in the method are accessible and may be tested.&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/Harshil-Shah99/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [https://drive.google.com/file/d/1rpMtT_sEtHmTHOUvq4Qw4lLyrpbVWU5Q/view?usp=sharing here].&lt;/div&gt;</summary>
		<author><name>Jmhardy3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143498</id>
		<title>CSC/ECE 517 Spring 2022 - E2201: Testing for assignment questionnaire controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143498"/>
		<updated>2022-03-22T02:27:43Z</updated>

		<summary type="html">&lt;p&gt;Jmhardy3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2201: Testing for assignment_questionnaire_controller&amp;quot; is focused on adding unit tests for assignment_questionnaire_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* assignment_questionnaire_controller.rb&lt;br /&gt;
* assignment_questionnaire_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  rspec ./spec/controllers/assignment_questionnaire_controller_spec.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
assignment_questionnaire_controller had 3 methods for which unit tests were missing as seen in this [https://coveralls.io/builds/46937123/source?filename=app/controllers/users_controller.rb coverall]. The RSpec unit tests added for these methods in the spec file 'assignment_questionnaire_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
=== action_allowed? ===&lt;br /&gt;
This method checks if a particular action is allowed when it is called for the current user. The action is passed in the params. In this case we are testing the action list_pending_requested.&lt;br /&gt;
We stub a student, an instructor and an admin, and we test if only the admin has the right to perform this action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
context 'when no assignment is associated with the id' do&lt;br /&gt;
      it 'refuses certain action' do&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(nil)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_falsey&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'instructor is the parent of the assignment found' do&lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_falsey&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'user is the ancestor of the assignment found' do&lt;br /&gt;
      ##Assert if the user, who is the ancestor of the instructor who created the course, is allowed to perform the action. &lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment3)&lt;br /&gt;
        allow_any_instance_of(Assignment).to receive(:instructor).and_return(instructor1)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be_truthy&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'course ta is allowed to perform actions on the assignment found' do&lt;br /&gt;
      ##Created an assignment for a course&lt;br /&gt;
      ##Assigned a ta to that course&lt;br /&gt;
      ##Assert if this assignment's course's ta is the same guy who signed in. &lt;br /&gt;
      it 'allows a certain action' do&lt;br /&gt;
        ta1 = create(:teaching_assistant, id: 25)&lt;br /&gt;
        ta2 = create(:teaching_assistant, id:40, name: 'test_ta_2')&lt;br /&gt;
        course1 = create(:course)&lt;br /&gt;
        assignment4 = create(:assignment, course_id: course1.id, instructor_id: instructor1)&lt;br /&gt;
        TaMapping.create(ta_id: ta1.id, course_id: course1.id)&lt;br /&gt;
        &lt;br /&gt;
        stub_current_user(ta2, ta2.role.name, ta2.role)&lt;br /&gt;
        allow(Assignment).to receive(:find).and_return(assignment4)&lt;br /&gt;
        expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== destroy ===&lt;br /&gt;
This action is called in the process of deleting a user. When this action is successfully executed or user is successfully destroyed (when User is passed a valid value 'student1') a note alert is flashed, whereas in case user is not destroyed (when User is passed an invalid value 'nil') an error is flashed. Further, it is being tested that at the end in both cases it redirects to list action.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#destroy' do&lt;br /&gt;
    it 'check if user was successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:note]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if user was not successfully destroyed' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(flash[:error]).to be_present&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if successful destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(student1)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'check if error during destroy leads to redirect' do&lt;br /&gt;
      allow(User).to receive(:find).with(any_args).and_return(nil)&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(TeamsUser).to receive(:delete).with(any_args).and_return(true)&lt;br /&gt;
      allow(AssignmentQuestionnaire).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      allow(User).to receive(:destroy).with(any_args).and_return(true)&lt;br /&gt;
      post :destroy&lt;br /&gt;
      expect(response).to redirect_to :action=&amp;gt; :list&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== paginate_list ===&lt;br /&gt;
This method is also private and needs to be tested through list action. The parameter paginate_options which decides the execution of statement we need to test is predefined in the paginate_list, and thus the required statement cannot be accessed or tested. So, we tested the other statements in the method.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  context '#list' do&lt;br /&gt;
    it 'checks that paginate_list does not fail with controller' do&lt;br /&gt;
      expect{controller.list}.not_to raise_error&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    it 'checks that paginate_list does not fail with post' do&lt;br /&gt;
      post :list&lt;br /&gt;
      expect(response.status).to eq(200)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
The users_controller has been thoroughly tested in its present state. The auto_complete_result method in auto_complete_for_user_name method needs to be defined. Further, the paginate_list method needs to be refactored so that all statements in the method are accessible and may be tested.&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/Harshil-Shah99/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [https://drive.google.com/file/d/1rpMtT_sEtHmTHOUvq4Qw4lLyrpbVWU5Q/view?usp=sharing here].&lt;/div&gt;</summary>
		<author><name>Jmhardy3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143494</id>
		<title>CSC/ECE 517 Spring 2022 - E2201: Testing for assignment questionnaire controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2201:_Testing_for_assignment_questionnaire_controller.rb&amp;diff=143494"/>
		<updated>2022-03-22T02:18:21Z</updated>

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

		<summary type="html">&lt;p&gt;Jmhardy3: /* OSS Projects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OSS Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2200: Testing advice_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2203: Adding tests for courses_controller, eula_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2204: Adding tests for markup_styles_controller, lock_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2208: Testing for submission_records_controller, profile_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2218: Refactor response_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2217: Refactor questionnaires_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2216: Refactor late_policies_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2215: Refactor student_quizzes_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2214: Refactor teams_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2219: Improve assessment360_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2211: Testing for summary_helper]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2225: Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2221: Refactor submitted content controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2206: Testing for users_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2205: Testing for participants_controller, versions_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2212: Testing for hamer.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - S2200: Refactoring evaluation of SQL queries (Java/JUnit)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - S2222: Refactor impersonate_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2202- Testing for badges_controller, publishing_controller]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2022 - E2220: Refactor reputation_web_service_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2224: Refactor review_mapping_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2209: Testing for analytic helper.rb, join team requests helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2227: SQL Injection Fix]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2201: Testing for assignment_questionnaire_controller.rb]]&lt;br /&gt;
&lt;br /&gt;
== Final Projects ==&lt;/div&gt;</summary>
		<author><name>Jmhardy3</name></author>
	</entry>
</feed>