<?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=Ssaluja</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=Ssaluja"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Ssaluja"/>
	<updated>2026-06-01T18:03:19Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1868_remove_reports_from_review_mapping_controller&amp;diff=120450</id>
		<title>E1868 remove reports from review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1868_remove_reports_from_review_mapping_controller&amp;diff=120450"/>
		<updated>2018-11-21T00:07:12Z</updated>

		<summary type="html">&lt;p&gt;Ssaluja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Background =&lt;br /&gt;
review_mapping_controller is the largest controller in Expertiza with 614 lines of code. The basic functionality of this controller is to assign reviewers to review artefacts or submissions by other participants or teams. But this controller includes a major chunk of code for generating and rendering several reports to the instructors. As part of the project E1837[http://wiki.expertiza.ncsu.edu/index.php/E1837_refactor_review_mapping_controller], the review_mapping_controller.rb file has been significantly modified to improve maintainability, code quality and code readability. To summarize, the review_mapping_controller was modified by separating the report generation functionality into a new helper named report_formatter_helper. This helper serves the logic for rendering different reports as per the instructor's request, thus segregating the controller specific code from the code for rendering the reports.&lt;br /&gt;
&lt;br /&gt;
Refactoring from E1837 served as one of the primary design improvements to achieve scalability with different reports. But, this improvement contradicts with the single responsibility Object-Oriented Design Principles. The aim of this project is to extrapolate the report_formatter_helper code into a reports_controller.&lt;br /&gt;
&lt;br /&gt;
= Goals =&lt;br /&gt;
:- Separation of concerns&lt;br /&gt;
:- Generalize code to render reports&lt;br /&gt;
:- Modify the UI to list reports&lt;br /&gt;
:- Testing the newly introduced reports_controller&lt;br /&gt;
&lt;br /&gt;
=== Separation of Concerns ===&lt;br /&gt;
The reports and reviews are two different components which should not be clubbed. As part of this refactoring, the existing design of review_mapping_controller handles the following two different functionalities: &lt;br /&gt;
:1. Manage various reviewers&lt;br /&gt;
:2. Display and manage different reports&lt;br /&gt;
&lt;br /&gt;
This violates the single responsibility principle[https://en.wikipedia.org/wiki/Single_responsibility_principle] by handling two different functionalities. This project aims to segregate these functionalities into the following two controllers:&lt;br /&gt;
:1. review_mapping_controller to manage the functionalities of reviewers&lt;br /&gt;
:2. reports_controller to handle the reports functionalities&lt;br /&gt;
&lt;br /&gt;
=== Generalize code to display reports ===&lt;br /&gt;
The reports provide functionality such as presenting reviews for grading, showing author feedback (rejoinders), showing a table of all teammate reviews, showing a calibration report in an assignment where students rate the same work that has been previously rated by an instructor, and showing how many answers students have tagged.&lt;br /&gt;
&lt;br /&gt;
Every report boils down to one single idea i.e. loop through either participants or teams. This loop can be generalized so that the layout (includes headers, footers etc) can be consistent across reports while delivering the desired content.&lt;br /&gt;
&lt;br /&gt;
=== Modify the UI to list reports ===&lt;br /&gt;
In the current implementation, the reports are accessed by clicking on the “view review report” button in the buttons tray of an assignment, which leads into the review report page. This page contains a drop-down menu listing various reports to navigate to. &lt;br /&gt;
&lt;br /&gt;
This two-step navigation to view the reports can be converted into a single step. There are two ways of doing so:&lt;br /&gt;
:1. Introduce a new ‘...’ icon in the buttons tray, which on hovering on it, would show the menu of various reports&lt;br /&gt;
:2. Rename the &amp;quot;view review report&amp;quot; button to reports with a drop down menu listing all the report types&lt;br /&gt;
&lt;br /&gt;
=== Testing the new controller ===&lt;br /&gt;
Since the logic for report generation has been abstracted into a new controller, existing tests for report generation must be verified for regression and also check for improving the code coverage statistics.&lt;br /&gt;
&lt;br /&gt;
= Implementation specifics =&lt;br /&gt;
&lt;br /&gt;
=== Refactored Design ===&lt;br /&gt;
In order to follow good design practices, the logic to differentiate reports will be implemented using Strategy Pattern[https://en.wikipedia.org/wiki/Strategy_pattern]. &lt;br /&gt;
&lt;br /&gt;
Currently, there are seven different reports&lt;br /&gt;
:1. Review report&lt;br /&gt;
:2. Author feedback report&lt;br /&gt;
:3. Teammate review report&lt;br /&gt;
:4. Aggregated comments by rubric question&lt;br /&gt;
:5. Comment summary by reviewee (team)&lt;br /&gt;
:6. Potential collusion report&lt;br /&gt;
:7. Answer tagging report&lt;br /&gt;
&lt;br /&gt;
The new implementation will have ReportStrategy class with following subclasses&lt;br /&gt;
:- ReviewReportStrategy&lt;br /&gt;
:- AuthorFeedbackReportStrategy&lt;br /&gt;
:- TeammateReviewReportStrategy&lt;br /&gt;
:- RubricQuestionReportStrategy&lt;br /&gt;
:- RevieweeCommentReportStrategy&lt;br /&gt;
:- CollusionReportStrategy&lt;br /&gt;
:- AnswerTagReportStrategy&lt;br /&gt;
&lt;br /&gt;
Below is a simple UML diagram of these new classes&lt;br /&gt;
&lt;br /&gt;
[[File: Report strategy.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Modified UI ===&lt;br /&gt;
:1. One of the proposed changes to existing UI involves adding a new button to the buttons tray. For the assignment ‘Final Project (and Design Document)’ below, hovering over the ‘...’ icon (highlighted in the red box) should bring up the menu of additional reports. The image is only an illustration. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File: Reports icon.jpg|frame|centre]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. Another proposed change is to modify &amp;quot;view review report&amp;quot; button to &amp;quot;view reports&amp;quot; drop-down menu listing all the available reports for the respective assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Test Plan =&lt;br /&gt;
We are using RSpec testing framework to test our review mapping controller. We are planning to implement the following test cases: &lt;br /&gt;
:1 When type is SummaryByRevieweeAndCriteria we check that the corresponding data is rendered. This method should return summary, reviewers, average scores by reviewee, average score by round and average score by criterion.&lt;br /&gt;
:2 When type is SummaryByCriteria we check that the corresponding data is rendered. This method should return summary, reviewers, average scores by reviewee, average score by round and average score by criterion.&lt;br /&gt;
:3 When type is ReviewResponseMap we check the corresponding report data is rendered. This returns participants , average and range.&lt;br /&gt;
:4 When type is FeedbackResponseMap and  assignment has varying_rubrics_by_round feature we check the corresponding report data is rendered. It should return participants.&lt;br /&gt;
:5 When type is FeedbackResponseMap and when assignment does not have varying_rubrics_by_round feature we check the corresponding page to report is rendered and participants are rendered.&lt;br /&gt;
:6 When type is TeammateReviewResponseMap we check that there is correct mapping between the participant and its response. We will return participant for corresponding response.&lt;br /&gt;
:7 When type is Calibration and participant variable is nil we check if correct report is rendered or not.&lt;br /&gt;
:8 When type is PlagiarismCheckerReport we check if the correct report page is rendered or not.&lt;/div&gt;</summary>
		<author><name>Ssaluja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1868_remove_reports_from_review_mapping_controller&amp;diff=120449</id>
		<title>E1868 remove reports from review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1868_remove_reports_from_review_mapping_controller&amp;diff=120449"/>
		<updated>2018-11-21T00:06:28Z</updated>

		<summary type="html">&lt;p&gt;Ssaluja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Background =&lt;br /&gt;
review_mapping_controller is the largest controller in Expertiza with 614 lines of code. The basic functionality of this controller is to assign reviewers to review artefacts or submissions by other participants or teams. But this controller includes a major chunk of code for generating and rendering several reports to the instructors. As part of the project E1837[http://wiki.expertiza.ncsu.edu/index.php/E1837_refactor_review_mapping_controller], the review_mapping_controller.rb file has been significantly modified to improve maintainability, code quality and code readability. To summarize, the review_mapping_controller was modified by separating the report generation functionality into a new helper named report_formatter_helper. This helper serves the logic for rendering different reports as per the instructor's request, thus segregating the controller specific code from the code for rendering the reports.&lt;br /&gt;
&lt;br /&gt;
Refactoring from E1837 served as one of the primary design improvements to achieve scalability with different reports. But, this improvement contradicts with the single responsibility Object-Oriented Design Principles. The aim of this project is to extrapolate the report_formatter_helper code into a reports_controller.&lt;br /&gt;
&lt;br /&gt;
= Goals =&lt;br /&gt;
:- Separation of concerns&lt;br /&gt;
:- Generalize code to render reports&lt;br /&gt;
:- Modify the UI to list reports&lt;br /&gt;
:- Testing the newly introduced reports_controller&lt;br /&gt;
&lt;br /&gt;
=== Separation of Concerns ===&lt;br /&gt;
The reports and reviews are two different components which should not be clubbed. As part of this refactoring, the existing design of review_mapping_controller handles the following two different functionalities: &lt;br /&gt;
:1. Manage various reviewers&lt;br /&gt;
:2. Display and manage different reports&lt;br /&gt;
&lt;br /&gt;
This violates the single responsibility principle[https://en.wikipedia.org/wiki/Single_responsibility_principle] by handling two different functionalities. This project aims to segregate these functionalities into the following two controllers:&lt;br /&gt;
:1. review_mapping_controller to manage the functionalities of reviewers&lt;br /&gt;
:2. reports_controller to handle the reports functionalities&lt;br /&gt;
&lt;br /&gt;
=== Generalize code to display reports ===&lt;br /&gt;
The reports provide functionality such as presenting reviews for grading, showing author feedback (rejoinders), showing a table of all teammate reviews, showing a calibration report in an assignment where students rate the same work that has been previously rated by an instructor, and showing how many answers students have tagged.&lt;br /&gt;
&lt;br /&gt;
Every report boils down to one single idea i.e. loop through either participants or teams. This loop can be generalized so that the layout (includes headers, footers etc) can be consistent across reports while delivering the desired content.&lt;br /&gt;
&lt;br /&gt;
=== Modify the UI to list reports ===&lt;br /&gt;
In the current implementation, the reports are accessed by clicking on the “view review report” button in the buttons tray of an assignment, which leads into the review report page. This page contains a drop-down menu listing various reports to navigate to. &lt;br /&gt;
&lt;br /&gt;
This two-step navigation to view the reports can be converted into a single step. There are two ways of doing so:&lt;br /&gt;
:1. Introduce a new ‘...’ icon in the buttons tray, which on hovering on it, would show the menu of various reports&lt;br /&gt;
:2. Rename the &amp;quot;view review report&amp;quot; button to reports with a drop down menu listing all the report types&lt;br /&gt;
&lt;br /&gt;
=== Testing the new controller ===&lt;br /&gt;
Since the logic for report generation has been abstracted into a new controller, existing tests for report generation must be verified for regression and also check for improving the code coverage statistics.&lt;br /&gt;
&lt;br /&gt;
= Implementation specifics =&lt;br /&gt;
&lt;br /&gt;
=== Refactored Design ===&lt;br /&gt;
In order to follow good design practices, the logic to differentiate reports will be implemented using Strategy Pattern[https://en.wikipedia.org/wiki/Strategy_pattern]. &lt;br /&gt;
&lt;br /&gt;
Currently, there are seven different reports&lt;br /&gt;
:1. Review report&lt;br /&gt;
:2. Author feedback report&lt;br /&gt;
:3. Teammate review report&lt;br /&gt;
:4. Aggregated comments by rubric question&lt;br /&gt;
:5. Comment summary by reviewee (team)&lt;br /&gt;
:6. Potential collusion report&lt;br /&gt;
:7. Answer tagging report&lt;br /&gt;
&lt;br /&gt;
The new implementation will have ReportStrategy class with following subclasses&lt;br /&gt;
:- ReviewReportStrategy&lt;br /&gt;
:- AuthorFeedbackReportStrategy&lt;br /&gt;
:- TeammateReviewReportStrategy&lt;br /&gt;
:- RubricQuestionReportStrategy&lt;br /&gt;
:- RevieweeCommentReportStrategy&lt;br /&gt;
:- CollusionReportStrategy&lt;br /&gt;
:- AnswerTagReportStrategy&lt;br /&gt;
&lt;br /&gt;
Below is a simple UML diagram of these new classes&lt;br /&gt;
&lt;br /&gt;
[[File: Report strategy.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Modified UI ===&lt;br /&gt;
:1. One of the proposed changes to existing UI involves adding a new button to the buttons tray. For the assignment ‘Final Project (and Design Document)’ below, hovering over the ‘...’ icon (highlighted in the red box) should bring up the menu of additional reports. The image is only an illustration. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File: Reports icon.jpg|frame|centre]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. Another proposed change is to modify &amp;quot;view review report&amp;quot; button to &amp;quot;view reports&amp;quot; drop-down menu listing all the available reports for the respective assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Test Plan =&lt;br /&gt;
We are using RSpec testing framework to test our review mapping controller. We are planning to implement the following test cases: &amp;lt; /br&amp;gt;&lt;br /&gt;
1 When type is SummaryByRevieweeAndCriteria we check that the corresponding data is rendered. This method should return summary, reviewers, average scores by reviewee, average score by round and average score by criterion.&lt;br /&gt;
2 When type is SummaryByCriteria we check that the corresponding data is rendered. This method should return summary, reviewers, average scores by reviewee, average score by round and average score by criterion.&lt;br /&gt;
3 When type is ReviewResponseMap we check the corresponding report data is rendered. This returns participants , average and range.&lt;br /&gt;
4 When type is FeedbackResponseMap and  assignment has varying_rubrics_by_round feature we check the corresponding report data is rendered. It should return participants.&lt;br /&gt;
5 When type is FeedbackResponseMap and when assignment does not have varying_rubrics_by_round feature we check the corresponding page to report is rendered and participants are rendered.&lt;br /&gt;
6 When type is TeammateReviewResponseMap we check that there is correct mapping between the participant and its response. We will return participant for corresponding response.&lt;br /&gt;
7 When type is Calibration and participant variable is nil we check if correct report is rendered or not.&lt;br /&gt;
8 When type is PlagiarismCheckerReport we check if the correct report page is rendered or not.&lt;/div&gt;</summary>
		<author><name>Ssaluja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1868_remove_reports_from_review_mapping_controller&amp;diff=120448</id>
		<title>E1868 remove reports from review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1868_remove_reports_from_review_mapping_controller&amp;diff=120448"/>
		<updated>2018-11-21T00:06:06Z</updated>

		<summary type="html">&lt;p&gt;Ssaluja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Background =&lt;br /&gt;
review_mapping_controller is the largest controller in Expertiza with 614 lines of code. The basic functionality of this controller is to assign reviewers to review artefacts or submissions by other participants or teams. But this controller includes a major chunk of code for generating and rendering several reports to the instructors. As part of the project E1837[http://wiki.expertiza.ncsu.edu/index.php/E1837_refactor_review_mapping_controller], the review_mapping_controller.rb file has been significantly modified to improve maintainability, code quality and code readability. To summarize, the review_mapping_controller was modified by separating the report generation functionality into a new helper named report_formatter_helper. This helper serves the logic for rendering different reports as per the instructor's request, thus segregating the controller specific code from the code for rendering the reports.&lt;br /&gt;
&lt;br /&gt;
Refactoring from E1837 served as one of the primary design improvements to achieve scalability with different reports. But, this improvement contradicts with the single responsibility Object-Oriented Design Principles. The aim of this project is to extrapolate the report_formatter_helper code into a reports_controller.&lt;br /&gt;
&lt;br /&gt;
= Goals =&lt;br /&gt;
:- Separation of concerns&lt;br /&gt;
:- Generalize code to render reports&lt;br /&gt;
:- Modify the UI to list reports&lt;br /&gt;
:- Testing the newly introduced reports_controller&lt;br /&gt;
&lt;br /&gt;
=== Separation of Concerns ===&lt;br /&gt;
The reports and reviews are two different components which should not be clubbed. As part of this refactoring, the existing design of review_mapping_controller handles the following two different functionalities: &lt;br /&gt;
:1. Manage various reviewers&lt;br /&gt;
:2. Display and manage different reports&lt;br /&gt;
&lt;br /&gt;
This violates the single responsibility principle[https://en.wikipedia.org/wiki/Single_responsibility_principle] by handling two different functionalities. This project aims to segregate these functionalities into the following two controllers:&lt;br /&gt;
:1. review_mapping_controller to manage the functionalities of reviewers&lt;br /&gt;
:2. reports_controller to handle the reports functionalities&lt;br /&gt;
&lt;br /&gt;
=== Generalize code to display reports ===&lt;br /&gt;
The reports provide functionality such as presenting reviews for grading, showing author feedback (rejoinders), showing a table of all teammate reviews, showing a calibration report in an assignment where students rate the same work that has been previously rated by an instructor, and showing how many answers students have tagged.&lt;br /&gt;
&lt;br /&gt;
Every report boils down to one single idea i.e. loop through either participants or teams. This loop can be generalized so that the layout (includes headers, footers etc) can be consistent across reports while delivering the desired content.&lt;br /&gt;
&lt;br /&gt;
=== Modify the UI to list reports ===&lt;br /&gt;
In the current implementation, the reports are accessed by clicking on the “view review report” button in the buttons tray of an assignment, which leads into the review report page. This page contains a drop-down menu listing various reports to navigate to. &lt;br /&gt;
&lt;br /&gt;
This two-step navigation to view the reports can be converted into a single step. There are two ways of doing so:&lt;br /&gt;
:1. Introduce a new ‘...’ icon in the buttons tray, which on hovering on it, would show the menu of various reports&lt;br /&gt;
:2. Rename the &amp;quot;view review report&amp;quot; button to reports with a drop down menu listing all the report types&lt;br /&gt;
&lt;br /&gt;
=== Testing the new controller ===&lt;br /&gt;
Since the logic for report generation has been abstracted into a new controller, existing tests for report generation must be verified for regression and also check for improving the code coverage statistics.&lt;br /&gt;
&lt;br /&gt;
= Implementation specifics =&lt;br /&gt;
&lt;br /&gt;
=== Refactored Design ===&lt;br /&gt;
In order to follow good design practices, the logic to differentiate reports will be implemented using Strategy Pattern[https://en.wikipedia.org/wiki/Strategy_pattern]. &lt;br /&gt;
&lt;br /&gt;
Currently, there are seven different reports&lt;br /&gt;
:1. Review report&lt;br /&gt;
:2. Author feedback report&lt;br /&gt;
:3. Teammate review report&lt;br /&gt;
:4. Aggregated comments by rubric question&lt;br /&gt;
:5. Comment summary by reviewee (team)&lt;br /&gt;
:6. Potential collusion report&lt;br /&gt;
:7. Answer tagging report&lt;br /&gt;
&lt;br /&gt;
The new implementation will have ReportStrategy class with following subclasses&lt;br /&gt;
:- ReviewReportStrategy&lt;br /&gt;
:- AuthorFeedbackReportStrategy&lt;br /&gt;
:- TeammateReviewReportStrategy&lt;br /&gt;
:- RubricQuestionReportStrategy&lt;br /&gt;
:- RevieweeCommentReportStrategy&lt;br /&gt;
:- CollusionReportStrategy&lt;br /&gt;
:- AnswerTagReportStrategy&lt;br /&gt;
&lt;br /&gt;
Below is a simple UML diagram of these new classes&lt;br /&gt;
&lt;br /&gt;
[[File: Report strategy.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Modified UI ===&lt;br /&gt;
:1. One of the proposed changes to existing UI involves adding a new button to the buttons tray. For the assignment ‘Final Project (and Design Document)’ below, hovering over the ‘...’ icon (highlighted in the red box) should bring up the menu of additional reports. The image is only an illustration. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File: Reports icon.jpg|frame|centre]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. Another proposed change is to modify &amp;quot;view review report&amp;quot; button to &amp;quot;view reports&amp;quot; drop-down menu listing all the available reports for the respective assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Test Plan =&lt;br /&gt;
We are using RSpec testing framework to test our review mapping controller. We are planning to implement the following test cases:&amp;lt; br&amp;gt;&lt;br /&gt;
1 When type is SummaryByRevieweeAndCriteria we check that the corresponding data is rendered. This method should return summary, reviewers, average scores by reviewee, average score by round and average score by criterion.&lt;br /&gt;
2 When type is SummaryByCriteria we check that the corresponding data is rendered. This method should return summary, reviewers, average scores by reviewee, average score by round and average score by criterion.&lt;br /&gt;
3 When type is ReviewResponseMap we check the corresponding report data is rendered. This returns participants , average and range.&lt;br /&gt;
4 When type is FeedbackResponseMap and  assignment has varying_rubrics_by_round feature we check the corresponding report data is rendered. It should return participants.&lt;br /&gt;
5 When type is FeedbackResponseMap and when assignment does not have varying_rubrics_by_round feature we check the corresponding page to report is rendered and participants are rendered.&lt;br /&gt;
6 When type is TeammateReviewResponseMap we check that there is correct mapping between the participant and its response. We will return participant for corresponding response.&lt;br /&gt;
7 When type is Calibration and participant variable is nil we check if correct report is rendered or not.&lt;br /&gt;
8 When type is PlagiarismCheckerReport we check if the correct report page is rendered or not.&lt;/div&gt;</summary>
		<author><name>Ssaluja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1868_remove_reports_from_review_mapping_controller&amp;diff=120446</id>
		<title>E1868 remove reports from review mapping controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1868_remove_reports_from_review_mapping_controller&amp;diff=120446"/>
		<updated>2018-11-21T00:05:38Z</updated>

		<summary type="html">&lt;p&gt;Ssaluja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Background =&lt;br /&gt;
review_mapping_controller is the largest controller in Expertiza with 614 lines of code. The basic functionality of this controller is to assign reviewers to review artefacts or submissions by other participants or teams. But this controller includes a major chunk of code for generating and rendering several reports to the instructors. As part of the project E1837[http://wiki.expertiza.ncsu.edu/index.php/E1837_refactor_review_mapping_controller], the review_mapping_controller.rb file has been significantly modified to improve maintainability, code quality and code readability. To summarize, the review_mapping_controller was modified by separating the report generation functionality into a new helper named report_formatter_helper. This helper serves the logic for rendering different reports as per the instructor's request, thus segregating the controller specific code from the code for rendering the reports.&lt;br /&gt;
&lt;br /&gt;
Refactoring from E1837 served as one of the primary design improvements to achieve scalability with different reports. But, this improvement contradicts with the single responsibility Object-Oriented Design Principles. The aim of this project is to extrapolate the report_formatter_helper code into a reports_controller.&lt;br /&gt;
&lt;br /&gt;
= Goals =&lt;br /&gt;
:- Separation of concerns&lt;br /&gt;
:- Generalize code to render reports&lt;br /&gt;
:- Modify the UI to list reports&lt;br /&gt;
:- Testing the newly introduced reports_controller&lt;br /&gt;
&lt;br /&gt;
=== Separation of Concerns ===&lt;br /&gt;
The reports and reviews are two different components which should not be clubbed. As part of this refactoring, the existing design of review_mapping_controller handles the following two different functionalities: &lt;br /&gt;
:1. Manage various reviewers&lt;br /&gt;
:2. Display and manage different reports&lt;br /&gt;
&lt;br /&gt;
This violates the single responsibility principle[https://en.wikipedia.org/wiki/Single_responsibility_principle] by handling two different functionalities. This project aims to segregate these functionalities into the following two controllers:&lt;br /&gt;
:1. review_mapping_controller to manage the functionalities of reviewers&lt;br /&gt;
:2. reports_controller to handle the reports functionalities&lt;br /&gt;
&lt;br /&gt;
=== Generalize code to display reports ===&lt;br /&gt;
The reports provide functionality such as presenting reviews for grading, showing author feedback (rejoinders), showing a table of all teammate reviews, showing a calibration report in an assignment where students rate the same work that has been previously rated by an instructor, and showing how many answers students have tagged.&lt;br /&gt;
&lt;br /&gt;
Every report boils down to one single idea i.e. loop through either participants or teams. This loop can be generalized so that the layout (includes headers, footers etc) can be consistent across reports while delivering the desired content.&lt;br /&gt;
&lt;br /&gt;
=== Modify the UI to list reports ===&lt;br /&gt;
In the current implementation, the reports are accessed by clicking on the “view review report” button in the buttons tray of an assignment, which leads into the review report page. This page contains a drop-down menu listing various reports to navigate to. &lt;br /&gt;
&lt;br /&gt;
This two-step navigation to view the reports can be converted into a single step. There are two ways of doing so:&lt;br /&gt;
:1. Introduce a new ‘...’ icon in the buttons tray, which on hovering on it, would show the menu of various reports&lt;br /&gt;
:2. Rename the &amp;quot;view review report&amp;quot; button to reports with a drop down menu listing all the report types&lt;br /&gt;
&lt;br /&gt;
=== Testing the new controller ===&lt;br /&gt;
Since the logic for report generation has been abstracted into a new controller, existing tests for report generation must be verified for regression and also check for improving the code coverage statistics.&lt;br /&gt;
&lt;br /&gt;
= Implementation specifics =&lt;br /&gt;
&lt;br /&gt;
=== Refactored Design ===&lt;br /&gt;
In order to follow good design practices, the logic to differentiate reports will be implemented using Strategy Pattern[https://en.wikipedia.org/wiki/Strategy_pattern]. &lt;br /&gt;
&lt;br /&gt;
Currently, there are seven different reports&lt;br /&gt;
:1. Review report&lt;br /&gt;
:2. Author feedback report&lt;br /&gt;
:3. Teammate review report&lt;br /&gt;
:4. Aggregated comments by rubric question&lt;br /&gt;
:5. Comment summary by reviewee (team)&lt;br /&gt;
:6. Potential collusion report&lt;br /&gt;
:7. Answer tagging report&lt;br /&gt;
&lt;br /&gt;
The new implementation will have ReportStrategy class with following subclasses&lt;br /&gt;
:- ReviewReportStrategy&lt;br /&gt;
:- AuthorFeedbackReportStrategy&lt;br /&gt;
:- TeammateReviewReportStrategy&lt;br /&gt;
:- RubricQuestionReportStrategy&lt;br /&gt;
:- RevieweeCommentReportStrategy&lt;br /&gt;
:- CollusionReportStrategy&lt;br /&gt;
:- AnswerTagReportStrategy&lt;br /&gt;
&lt;br /&gt;
Below is a simple UML diagram of these new classes&lt;br /&gt;
&lt;br /&gt;
[[File: Report strategy.jpg|frame|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Modified UI ===&lt;br /&gt;
:1. One of the proposed changes to existing UI involves adding a new button to the buttons tray. For the assignment ‘Final Project (and Design Document)’ below, hovering over the ‘...’ icon (highlighted in the red box) should bring up the menu of additional reports. The image is only an illustration. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File: Reports icon.jpg|frame|centre]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:2. Another proposed change is to modify &amp;quot;view review report&amp;quot; button to &amp;quot;view reports&amp;quot; drop-down menu listing all the available reports for the respective assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Test Plan =&lt;br /&gt;
We are using RSpec testing framework to test our review mapping controller. We are planning to implement the following test cases:&lt;br /&gt;
1 When type is SummaryByRevieweeAndCriteria we check that the corresponding data is rendered. This method should return summary, reviewers, average scores by reviewee, average score by round and average score by criterion.&lt;br /&gt;
2 When type is SummaryByCriteria we check that the corresponding data is rendered. This method should return summary, reviewers, average scores by reviewee, average score by round and average score by criterion.&lt;br /&gt;
3 When type is ReviewResponseMap we check the corresponding report data is rendered. This returns participants , average and range.&lt;br /&gt;
4 When type is FeedbackResponseMap and  assignment has varying_rubrics_by_round feature we check the corresponding report data is rendered. It should return participants.&lt;br /&gt;
5 When type is FeedbackResponseMap and when assignment does not have varying_rubrics_by_round feature we check the corresponding page to report is rendered and participants are rendered.&lt;br /&gt;
6 When type is TeammateReviewResponseMap we check that there is correct mapping between the participant and its response. We will return participant for corresponding response.&lt;br /&gt;
7 When type is Calibration and participant variable is nil we check if correct report is rendered or not.&lt;br /&gt;
8 When type is PlagiarismCheckerReport we check if the correct report page is rendered or not.&lt;/div&gt;</summary>
		<author><name>Ssaluja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=119431</id>
		<title>E1850 Write unit tests for review response map</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=119431"/>
		<updated>2018-11-12T14:11:54Z</updated>

		<summary type="html">&lt;p&gt;Ssaluja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
It is an open source software created by North Carolina State University's students. It works on ruby on rails framework. This platform allows instructor to post notification about tests and assignments and also allows students to view grades, submit assignments, find teammates etc.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Review_response_map.rb file is a newly added feature in Expertiza. The ReviewResponseMap class in the file is the sub class of ResponseMap class.The file review_response_map.rb deals with mapping of review's review to the feedback that reviewee gives to that review. Since the file is new it is not tested. We have worked on the file review_response_map_spec.rb which use RSpec framework to perform unit testing on the given file.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
1.Create a new file named review_response_map_spec.rb under spec/models folder&amp;lt;br&amp;gt;&lt;br /&gt;
2.Write RSpec unit tests to make the path coverage above 90%.&amp;lt;br&amp;gt;&lt;br /&gt;
3.Coverage as many edge cases as you can.&amp;lt;br&amp;gt;&lt;br /&gt;
4.Achieve as high branch coverage as you can. We will use the mutant-rspec gem to measure test thoroughness and fault-finding capability of your tests.&amp;lt;br&amp;gt;&lt;br /&gt;
==Test Plan==&lt;br /&gt;
We created the following stubs to implement unit testing:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   let(:participant) { build(:participant, id: 1, parent_id: 1, user: build(:student, name: 'no name', fullname: 'no one')) }&lt;br /&gt;
   let(:participant2) { build(:participant, id: 2, parent_id: 1, user: build(:student, name: 'no name', fullname: 'no one')) }&lt;br /&gt;
   let(:student){ build(:participant, id: 3, parent_id: 1, user: build(:student, name: 'no name', fullname: 'first user')) }&lt;br /&gt;
   let(:student2){ build(:participant, id: 4, parent_id: 1, user: build(:student, name: 'no name', fullname: 'second one')) }&lt;br /&gt;
   let(:team) { build(:assignment_team) }&lt;br /&gt;
   let(:assignment) { build(:assignment, id: 1, name: 'Test Assgt') }&lt;br /&gt;
   let(:assignment2) { build(:assignment, id: 2, name: 'Test Assgt') }&lt;br /&gt;
   let(:response_map) { build(:review_response_map, reviewer: student, response: [response], reviewee_id: 1, type: &amp;quot;ReviewResponseMap&amp;quot;) }&lt;br /&gt;
   let(:response_map2) { build(:review_response_map, reviewer: student2, response:[response2, response3],reviewee_id: 1, type: &amp;quot;ReviewResponseMap&amp;quot;) }&lt;br /&gt;
   let(:question) { Criterion.new(id: 1, weight: 2, break_before: true) }&lt;br /&gt;
   let(:questionnaire) { ReviewQuestionnaire.new(id: 1, questions: [question], max_question_score: 5) }&lt;br /&gt;
   let(:answer) { Answer.new(answer: 1, comments: 'Answer text', question_id: 1) }&lt;br /&gt;
   let(:response) { build(:response, id: 1, round: 1, is_submitted: true,map_id: 1, scores: [answer]) }&lt;br /&gt;
   let(:response2) { build(:response, id: 2, round: 1, is_submitted: true, map_id: 1, scores: [answer]) }&lt;br /&gt;
   let(:response3) { build(:response, id: 3, round: 1, is_submitted: false, map_id: 1, scores: [answer]) }&lt;br /&gt;
   let(:review_response_map) { build(:review_response_map, reviewer_id:1, assignment: assignment, reviewer: participant, reviewee: team) }&lt;br /&gt;
   let(:review_response_map2) { build(:review_response_map, assignment: assignment2, reviewer: participant2, reviewee: team) }&lt;br /&gt;
   let(:meta_review_response_map) { build(:meta_review_response_map, review_mapping: review_response_map, reviewee: participant)}&lt;br /&gt;
   let(:feedback_response_map){ build(:review_response_map, reviewed_object_id: 1, response:[response2], type:'FeedbackResponseMap')}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Implementation==&lt;br /&gt;
===get_title method===&lt;br /&gt;
&amp;lt;pre&amp;gt; describe '#get_title' do&lt;br /&gt;
     it 'returns the title' do&lt;br /&gt;
       expect(review_response_map.get_title).to eql(&amp;quot;Review&amp;quot;)&lt;br /&gt;
     end&lt;br /&gt;
   end&amp;lt;/pre&amp;gt;&lt;br /&gt;
===questionnaire method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#questionnaire' do&lt;br /&gt;
     it 'returns questionnaire' do&lt;br /&gt;
       allow(assignment).to receive(:review_questionnaire_id).and_return(1)&lt;br /&gt;
       allow(Questionnaire).to receive(:find_by).with(id: 1).and_return(questionnaire)&lt;br /&gt;
       expect(review_response_map.questionnaire.id).to eq(1)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===export_fields method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '.export_fields' do&lt;br /&gt;
     it 'returns list of strings &amp;quot;contributor&amp;quot; and &amp;quot;reviewed by&amp;quot;' do&lt;br /&gt;
       expect(ReviewResponseMap.export_fields &amp;quot;&amp;quot;).to eq([&amp;quot;contributor&amp;quot;, &amp;quot;reviewed by&amp;quot;])&lt;br /&gt;
     end&lt;br /&gt;
   end&amp;lt;/pre&amp;gt;&lt;br /&gt;
===delete method===&lt;br /&gt;
&amp;lt;pre&amp;gt; describe '#delete' do&lt;br /&gt;
     it 'deletes the review response map' do&lt;br /&gt;
       allow(review_response_map.response).to receive(:response_id).and_return(1)&lt;br /&gt;
	     allow(FeedbackResponseMap).to receive(:where).with(reviewed_object_id: 1).and_return([feedback_response_map])&lt;br /&gt;
	     allow(feedback_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
	     allow(MetareviewResponseMap).to receive(:where).with(reviewed_object_id: review_response_map.id).and_return([meta_review_response_map])&lt;br /&gt;
	     allow(meta_review_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
	     allow(review_response_map).to receive(:destroy).and_return(true)&lt;br /&gt;
	     expect(review_response_map.delete).to be true&lt;br /&gt;
     end&lt;br /&gt;
   end&amp;lt;/pre&amp;gt;&lt;br /&gt;
===get_responses_for_team_round method===&lt;br /&gt;
&amp;lt;pre&amp;gt; describe '.get_responses_for_team_round' do&lt;br /&gt;
    context 'when team doesnt exist' do&lt;br /&gt;
      it 'returns empty response' do&lt;br /&gt;
        team = instance_double('AssignmentTeam').as_null_object&lt;br /&gt;
        allow(team).to receive(:id).and_return(false)&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round team, 1).to eql([])&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===when_team_exists method===&lt;br /&gt;
&amp;lt;pre&amp;gt;context 'when team exists' do&lt;br /&gt;
      it 'returns the responses for particular round' do&lt;br /&gt;
        team = instance_double('AssignmentTeam', :id=&amp;gt;1)&lt;br /&gt;
        round = 1&lt;br /&gt;
        allow(ResponseMap).to receive(:where).with(reviewee_id: 1, type: &amp;quot;ReviewResponseMap&amp;quot;).and_return([response_map, response_map2])&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round(team, round).length).to eql(2)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===export method===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '.export' do&lt;br /&gt;
    it 'adds reviewer and reviewee names to array' do&lt;br /&gt;
      allow(ReviewResponseMap).to receive(:where).with(reviewed_object_id: 1).and_return([review_response_map])&lt;br /&gt;
      expect(ReviewResponseMap.export([], 1, 'test')).to eql([review_response_map])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===metareview_response_map method===&lt;br /&gt;
&amp;lt;pre&amp;gt; describe '#metareview_response_maps' do&lt;br /&gt;
    it 'returns metareview responses for which id is caller id' do&lt;br /&gt;
    allow(Response).to receive(:where).with(map_id: 1).and_return([response])&lt;br /&gt;
    allow(MetareviewResponseMap).to receive(:where).with(reviewed_object_id: 1).and_return([metareview_response_map])&lt;br /&gt;
    expect(review_response_map.metareview_response_maps).to eq([metareview_response_map])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===show_feedback method===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#show_feedback' do&lt;br /&gt;
    context 'when no response is present or response is nil' do&lt;br /&gt;
      it 'returns nil' do&lt;br /&gt;
        allow(review_response_map).to receive(:response).and_return([])     &lt;br /&gt;
        expect(review_response_map.show_feedback null_response).to be(nil)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;context 'when response is present and not nil' do&lt;br /&gt;
      it 'returns feedback' do&lt;br /&gt;
        allow(review_response_map).to receive(:response).and_return([response2, response3])&lt;br /&gt;
        allow(FeedbackResponseMap).to receive(:find_by).with(reviewed_object_id: 1).and_return(feedback_response_map)&lt;br /&gt;
        allow(response3).to receive(:display_as_html).and_return(&amp;quot;display_as_html&amp;quot;)&lt;br /&gt;
        expect(review_response_map.show_feedback response).to eql(&amp;quot;display_as_html&amp;quot;)        &lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===final_versions_from_reviewer method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '.final_versions_from_reviewer' do&lt;br /&gt;
    it 'returns final versions from reviewer' do&lt;br /&gt;
        allow(ReviewResponseMap).to receive(:where).with(reviewer_id: 1).and_return([review_response_map, review_response_map2])&lt;br /&gt;
        allow(Participant).to receive(:find).with(1).and_return(participant)&lt;br /&gt;
        allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
        allow(ReviewResponseMap).to receive(:prepare_final_review_versions).with(assignment, [review_response_map, review_response_map2]).and_return(&amp;quot;prepare_final_review_versions&amp;quot;)&lt;br /&gt;
        expect(ReviewResponseMap.final_versions_from_reviewer 1).to eql(&amp;quot;prepare_final_review_versions&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===import method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '.final_versions_from_reviewer' do&lt;br /&gt;
    it 'returns final versions from reviewer' do&lt;br /&gt;
        allow(ReviewResponseMap).to receive(:where).with(reviewer_id: 1).and_return([review_response_map, review_response_map2])&lt;br /&gt;
        allow(Participant).to receive(:find).with(1).and_return(participant)&lt;br /&gt;
        allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
        allow(ReviewResponseMap).to receive(:prepare_final_review_versions).with(assignment, [review_response_map, review_response_map2]).and_return(&amp;quot;prepare_final_review_versions&amp;quot;)&lt;br /&gt;
        expect(ReviewResponseMap.final_versions_from_reviewer 1).to eql(&amp;quot;prepare_final_review_versions&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
context 'when the reviewee is not nil' do&lt;br /&gt;
      context 'when participant is nil' do&lt;br /&gt;
        testHash = {reviewee: 'user1', reviewers: ['user2']}&lt;br /&gt;
        it &amp;quot;Raises another ArgumentError&amp;quot; do&lt;br /&gt;
          reviewee = double('User', :id =&amp;gt; 1, :name =&amp;gt; 'user1')&lt;br /&gt;
          allow(User).to receive(:find_by).with(name: 'user1').and_return(reviewee)&lt;br /&gt;
          allow(AssignmentParticipant).to receive(:find_by).and_return(nil)&lt;br /&gt;
          expect{ReviewResponseMap.import(testHash, '_session', 1)}.to raise_error(ArgumentError)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
context 'when the participant is not nil' do&lt;br /&gt;
        before(:each) do&lt;br /&gt;
          reviewee = double('User', :id =&amp;gt; 2, :name =&amp;gt; 'user1')&lt;br /&gt;
          allow(User).to receive(:find_by).with(name: 'user1').and_return(reviewee)&lt;br /&gt;
          reviewee_participant = double('AssignmentParticipant', :user_id=&amp;gt;2, :parent_id=&amp;gt;1, :id=&amp;gt;3)&lt;br /&gt;
          allow(AssignmentParticipant).to receive(:find_by).and_return(reviewee_participant)&lt;br /&gt;
          reviewer = double('User', :id=&amp;gt;4, :name=&amp;gt;'user2')&lt;br /&gt;
          allow(User).to receive(:find_by).with(name: 'user2').and_return(reviewer)&lt;br /&gt;
          reviewer_participant = double('AssignmentParticipant', :user_id=&amp;gt;4, :parent_id=&amp;gt;1, :id=&amp;gt;5)&lt;br /&gt;
          allow(AssignmentParticipant).to receive(:where).and_return(reviewer_participant)&lt;br /&gt;
        end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
context 'when reviewee has no team' do&lt;br /&gt;
          it &amp;quot;creates a team for reviewee via lazy team creation&amp;quot; do&lt;br /&gt;
            testHash = {reviewee: 'user1', reviewers: ['user2']}&lt;br /&gt;
            allow(AssignmentTeam).to receive(:team).and_return(nil)&lt;br /&gt;
            reviewee_team = double('AssignmentTeam', name: 'Team_1', parent_id: 1, id: 2)&lt;br /&gt;
            allow(AssignmentTeam).to receive(:create).and_return(reviewee_team)&lt;br /&gt;
            team_user = double('TeamUser', team_id: 2, user_id: 2, id: 10)&lt;br /&gt;
            allow(TeamsUser).to receive(:create).and_return(team_user)&lt;br /&gt;
            team_node = double('TeamNode', parent_id: 1, node_object_id: 2, id: 6)&lt;br /&gt;
            allow(TeamNode).to receive(:create).and_return(team_node)&lt;br /&gt;
            team_user_node = double('TeamUserNode', parent_id: 4, node_object_id: 10)&lt;br /&gt;
            allow(TeamUserNode).to receive(:create).and_return(team_user_node)&lt;br /&gt;
            map1 = double('ReviewResponseMap', reviewed_object_id: 1, reviewer_id: 4, reviewee_id: 2, calibrate_to: false)&lt;br /&gt;
            allow(ReviewResponseMap).to receive(:find_by).and_return(map1)&lt;br /&gt;
            expect(ReviewResponseMap.import(testHash, '_session', 1)).to eq(['user2'])&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
context 'when reviewee has a team' do&lt;br /&gt;
          it &amp;quot;creates a review response map&amp;quot; do&lt;br /&gt;
            testHash = {reviewee: 'user1', reviewers: ['user2']}&lt;br /&gt;
            reviewee_team = double('AssignmentTeam', parent_id: 1, id: 2)&lt;br /&gt;
            allow(AssignmentTeam).to receive(:team).and_return(reviewee_team)&lt;br /&gt;
            map1 = double('ReviewResponseMap', reviewed_object_id: 1, reviewer_id: 4, reviewee_id: 2, calibrate_to: false)&lt;br /&gt;
            allow(ReviewResponseMap).to receive(:find_by).and_return(map1)&lt;br /&gt;
            expect(ReviewResponseMap.import(testHash, '_session', 1)).to eq(['user2'])&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===review_response_report===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe &amp;quot;.review_response_report&amp;quot; do&lt;br /&gt;
    context &amp;quot;when the user is nil&amp;quot; do&lt;br /&gt;
      it &amp;quot;gives participants with unique IDs in a sorted order&amp;quot; do&lt;br /&gt;
        temp_id = double('id', id: 1)&lt;br /&gt;
        temp_type = double('type', type: 'type')&lt;br /&gt;
        temp_reviewers = double('reviewers')&lt;br /&gt;
        #Stubbing call to the database source: https://relishapp.com/rspec/rspec-mocks/docs/working-with-legacy-code/message-chains&lt;br /&gt;
        allow(ResponseMap).to receive_message_chain(:select, :where).and_return([response_map])&lt;br /&gt;
        allow(AssignmentParticipant).to receive(:find).and_return([temp_reviewers])&lt;br /&gt;
        allow(Participant).to receive(:sort_by_name).and_return([temp_reviewers])&lt;br /&gt;
        expect(ReviewResponseMap.review_response_report(temp_id, assignment, temp_type, nil)).to eq([temp_reviewers])&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
context &amp;quot;when the user is not nil&amp;quot; do&lt;br /&gt;
      it &amp;quot;gives reviewers users' full name&amp;quot; do&lt;br /&gt;
        temp_user = double('user', :[] =&amp;gt; '1')&lt;br /&gt;
        #Mocking user ids&lt;br /&gt;
        temp_user_ids = double('user_ids')&lt;br /&gt;
        temp_id = double('id', id: 1)&lt;br /&gt;
        temp_type = double('type', type: 'type')&lt;br /&gt;
        temp_reviewers = double('reviewers', fullname: 'testName')&lt;br /&gt;
        allow(User).to receive_message_chain(:select, :where).and_return([temp_user_ids])&lt;br /&gt;
        allow(AssignmentParticipant).to receive(:where).and_return([temp_reviewers])&lt;br /&gt;
        expect(ReviewResponseMap.review_response_report(temp_id, assignment, temp_type, temp_user)).to eq([temp_reviewers])&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===email method===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe &amp;quot;#email&amp;quot; do&lt;br /&gt;
    it &amp;quot;notifies the reviewee of the new review submitted&amp;quot; do&lt;br /&gt;
      temp_user = double('user', id: 1)&lt;br /&gt;
      defn = {body: {type: &amp;quot;test type&amp;quot;, obj_name: &amp;quot;test name&amp;quot;, first_name: &amp;quot;test name&amp;quot;, partial_name: &amp;quot;test name&amp;quot;}, to: &amp;quot;test@email.com&amp;quot;}&lt;br /&gt;
      allow(AssignmentTeam).to receive_message_chain(:find, :users).and_return([temp_user])&lt;br /&gt;
      allow(assignment).to receive(:name).and_return('')&lt;br /&gt;
      allow(User).to receive_message_chain(:find, :fullname).and_return('')&lt;br /&gt;
      allow(User).to receive_message_chain(:find, :email).and_return('')&lt;br /&gt;
      allow(Mailer).to receive_message_chain(:sync_message, :deliver_now).and_return('')&lt;br /&gt;
      expect(review_response_map.email(defn, participant, assignment)).to eq([temp_user])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===prepare_final_review_versions method===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '.prepare_final_review_versions' do&lt;br /&gt;
    context 'if the round number is greater than 1' do&lt;br /&gt;
      it &amp;quot;returns updated version of review&amp;quot; do&lt;br /&gt;
        maps = []&lt;br /&gt;
        round_num = 2&lt;br /&gt;
        allow(assignment).to receive(:rounds_of_reviews).and_return(round_num)&lt;br /&gt;
        #Mocking reviews for two rounds&lt;br /&gt;
        expect(ReviewResponseMap.prepare_final_review_versions(assignment, maps)).to eql(:&amp;quot;review round1&amp;quot; =&amp;gt; {questionnaire_id: nil, response_ids: []}, :&amp;quot;review round2&amp;quot; =&amp;gt; {questionnaire_id: nil, response_ids: []})&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'if the round number is not greater than 1' do&lt;br /&gt;
      it &amp;quot;returns latest version of review&amp;quot; do&lt;br /&gt;
        maps = []&lt;br /&gt;
        round_num = nil&lt;br /&gt;
        temp_assignment = double(:assignment, round_of_reviews: 5, review_questionnaire_id: 2)&lt;br /&gt;
        allow(temp_assignment).to receive(:rounds_of_reviews).and_return(round_num)&lt;br /&gt;
        expect(ReviewResponseMap.prepare_final_review_versions(temp_assignment, maps)).to eql(review: {questionnaire_id: 2, response_ids: []})&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== prepare_review_response method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '.prepare_review_response' do&lt;br /&gt;
    context 'if the round is nil' do&lt;br /&gt;
      it 'should return the latest response Id' do&lt;br /&gt;
        round_num = nil&lt;br /&gt;
        maps = []&lt;br /&gt;
        temp_assignment = double(:assignment, review_questionnaire_id: 1)&lt;br /&gt;
        allow(temp_assignment).to receive(:rounds_of_reviews).and_return(round_num)&lt;br /&gt;
        expect(ReviewResponseMap.prepare_final_review_versions(temp_assignment, maps)).to eql(review: {questionnaire_id: 1, response_ids: []})&lt;br /&gt;
        allow(temp_assignment).to receive(:review_questionnaire_id).and_return(1)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'if the round is not nil' do&lt;br /&gt;
      it 'should return the latest response Id' do&lt;br /&gt;
        review_final_versions = {}&lt;br /&gt;
        maps = [double(:map, id: 1)]&lt;br /&gt;
        responses = []&lt;br /&gt;
        round_num = 1&lt;br /&gt;
        allow(Response).to receive(:where).and_return([])&lt;br /&gt;
        allow(responses).to receive_message_chain(:last, :id).and_return([])&lt;br /&gt;
        expect(ReviewResponseMap.prepare_review_response(assignment, maps, review_final_versions, round_num)).to eq([])&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Files affected==&lt;br /&gt;
review_response_map.rb &amp;lt;br&amp;gt;&lt;br /&gt;
review_response_map_spec.rb&amp;lt;br&amp;gt;&lt;br /&gt;
spec_helper.rb&lt;br /&gt;
==Testing Framework==&lt;br /&gt;
We used RSpec framework to test the given file.RSpec is a 'Domain Specific Language' (DSL) testing tool written in Ruby to test Ruby code.It is a behavior-driven development (BDD) framework which is extensively used in the production applications. The basic idea behind this concept is that of Test Driven Development (TDD) where the tests are written first and the development is based on writing just enough code that will fulfill those tests followed by refactoring. It contains its own mocking framework that is fully integrated into the framework based upon JMock.The simplicity in the RSpec syntax makes it one of the popular testing tools for Ruby applications. The RSpec tool can be used by installing the rspec gem which consists of 3 other gems namely rspec-core, rspec-expectation and rspec-mock.&lt;br /&gt;
==References==&lt;br /&gt;
https://en.wikipedia.org/wiki/RSpec&lt;/div&gt;</summary>
		<author><name>Ssaluja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=119430</id>
		<title>E1850 Write unit tests for review response map</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=119430"/>
		<updated>2018-11-12T14:11:06Z</updated>

		<summary type="html">&lt;p&gt;Ssaluja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
It is an open source software created by North Carolina State University's students. It works on ruby on rails framework. This platform allows instructor to post notification about tests and assignments and also allows students to view grades, submit assignments, find teammates etc.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Review_response_map.rb file is a newly added feature in Expertiza. The ReviewResponseMap class in the file is the sub class of ResponseMap class.The file review_response_map.rb deals with mapping of review's review to the feedback that reviewee gives to that review. Since the file is new it is not tested. We have worked on the file review_response_map_spec.rb which use RSpec framework to perform unit testing on the given file.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
1.Create a new file named review_response_map_spec.rb under spec/models folder&amp;lt;br&amp;gt;&lt;br /&gt;
2.Write RSpec unit tests to make the path coverage above 90%.&amp;lt;br&amp;gt;&lt;br /&gt;
3.Coverage as many edge cases as you can.&amp;lt;br&amp;gt;&lt;br /&gt;
4.Achieve as high branch coverage as you can. We will use the mutant-rspec gem to measure test thoroughness and fault-finding capability of your tests.&amp;lt;br&amp;gt;&lt;br /&gt;
==Test Plan==&lt;br /&gt;
We created the following stubs to implement unit testing:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   let(:participant) { build(:participant, id: 1, parent_id: 1, user: build(:student, name: 'no name', fullname: 'no one')) }&lt;br /&gt;
   let(:participant2) { build(:participant, id: 2, parent_id: 1, user: build(:student, name: 'no name', fullname: 'no one')) }&lt;br /&gt;
   let(:student){ build(:participant, id: 3, parent_id: 1, user: build(:student, name: 'no name', fullname: 'first user')) }&lt;br /&gt;
   let(:student2){ build(:participant, id: 4, parent_id: 1, user: build(:student, name: 'no name', fullname: 'second one')) }&lt;br /&gt;
   let(:team) { build(:assignment_team) }&lt;br /&gt;
   let(:assignment) { build(:assignment, id: 1, name: 'Test Assgt') }&lt;br /&gt;
   let(:assignment2) { build(:assignment, id: 2, name: 'Test Assgt') }&lt;br /&gt;
   let(:response_map) { build(:review_response_map, reviewer: student, response: [response], reviewee_id: 1, type: &amp;quot;ReviewResponseMap&amp;quot;) }&lt;br /&gt;
   let(:response_map2) { build(:review_response_map, reviewer: student2, response:[response2, response3],reviewee_id: 1, type: &amp;quot;ReviewResponseMap&amp;quot;) }&lt;br /&gt;
   let(:question) { Criterion.new(id: 1, weight: 2, break_before: true) }&lt;br /&gt;
   let(:questionnaire) { ReviewQuestionnaire.new(id: 1, questions: [question], max_question_score: 5) }&lt;br /&gt;
   let(:answer) { Answer.new(answer: 1, comments: 'Answer text', question_id: 1) }&lt;br /&gt;
   let(:response) { build(:response, id: 1, round: 1, is_submitted: true,map_id: 1, scores: [answer]) }&lt;br /&gt;
   let(:response2) { build(:response, id: 2, round: 1, is_submitted: true, map_id: 1, scores: [answer]) }&lt;br /&gt;
   let(:response3) { build(:response, id: 3, round: 1, is_submitted: false, map_id: 1, scores: [answer]) }&lt;br /&gt;
   let(:review_response_map) { build(:review_response_map, reviewer_id:1, assignment: assignment, reviewer: participant, reviewee: team) }&lt;br /&gt;
   let(:review_response_map2) { build(:review_response_map, assignment: assignment2, reviewer: participant2, reviewee: team) }&lt;br /&gt;
   let(:meta_review_response_map) { build(:meta_review_response_map, review_mapping: review_response_map, reviewee: participant)}&lt;br /&gt;
   let(:feedback_response_map){ build(:review_response_map, reviewed_object_id: 1, response:[response2], type:'FeedbackResponseMap')}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Implementation==&lt;br /&gt;
===get_title method===&lt;br /&gt;
&amp;lt;pre&amp;gt; describe '#get_title' do&lt;br /&gt;
     it 'returns the title' do&lt;br /&gt;
       expect(review_response_map.get_title).to eql(&amp;quot;Review&amp;quot;)&lt;br /&gt;
     end&lt;br /&gt;
   end&amp;lt;/pre&amp;gt;&lt;br /&gt;
===questionnaire method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#questionnaire' do&lt;br /&gt;
     it 'returns questionnaire' do&lt;br /&gt;
       allow(assignment).to receive(:review_questionnaire_id).and_return(1)&lt;br /&gt;
       allow(Questionnaire).to receive(:find_by).with(id: 1).and_return(questionnaire)&lt;br /&gt;
       expect(review_response_map.questionnaire.id).to eq(1)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===export_fields method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '.export_fields' do&lt;br /&gt;
     it 'returns list of strings &amp;quot;contributor&amp;quot; and &amp;quot;reviewed by&amp;quot;' do&lt;br /&gt;
       expect(ReviewResponseMap.export_fields &amp;quot;&amp;quot;).to eq([&amp;quot;contributor&amp;quot;, &amp;quot;reviewed by&amp;quot;])&lt;br /&gt;
     end&lt;br /&gt;
   end&amp;lt;/pre&amp;gt;&lt;br /&gt;
===delete method===&lt;br /&gt;
&amp;lt;pre&amp;gt; describe '#delete' do&lt;br /&gt;
     it 'deletes the review response map' do&lt;br /&gt;
       allow(review_response_map.response).to receive(:response_id).and_return(1)&lt;br /&gt;
	     allow(FeedbackResponseMap).to receive(:where).with(reviewed_object_id: 1).and_return([feedback_response_map])&lt;br /&gt;
	     allow(feedback_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
	     allow(MetareviewResponseMap).to receive(:where).with(reviewed_object_id: review_response_map.id).and_return([meta_review_response_map])&lt;br /&gt;
	     allow(meta_review_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
	     allow(review_response_map).to receive(:destroy).and_return(true)&lt;br /&gt;
	     expect(review_response_map.delete).to be true&lt;br /&gt;
     end&lt;br /&gt;
   end&amp;lt;/pre&amp;gt;&lt;br /&gt;
===get_responses_for_team_round method===&lt;br /&gt;
&amp;lt;pre&amp;gt; describe '.get_responses_for_team_round' do&lt;br /&gt;
    context 'when team doesnt exist' do&lt;br /&gt;
      it 'returns empty response' do&lt;br /&gt;
        team = instance_double('AssignmentTeam').as_null_object&lt;br /&gt;
        allow(team).to receive(:id).and_return(false)&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round team, 1).to eql([])&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===when_team_exists method===&lt;br /&gt;
&amp;lt;pre&amp;gt;context 'when team exists' do&lt;br /&gt;
      it 'returns the responses for particular round' do&lt;br /&gt;
        team = instance_double('AssignmentTeam', :id=&amp;gt;1)&lt;br /&gt;
        round = 1&lt;br /&gt;
        allow(ResponseMap).to receive(:where).with(reviewee_id: 1, type: &amp;quot;ReviewResponseMap&amp;quot;).and_return([response_map, response_map2])&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round(team, round).length).to eql(2)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===export method===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '.export' do&lt;br /&gt;
    it 'adds reviewer and reviewee names to array' do&lt;br /&gt;
      allow(ReviewResponseMap).to receive(:where).with(reviewed_object_id: 1).and_return([review_response_map])&lt;br /&gt;
      expect(ReviewResponseMap.export([], 1, 'test')).to eql([review_response_map])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===metareview_response_map method===&lt;br /&gt;
&amp;lt;pre&amp;gt; describe '#metareview_response_maps' do&lt;br /&gt;
    it 'returns metareview responses for which id is caller id' do&lt;br /&gt;
    allow(Response).to receive(:where).with(map_id: 1).and_return([response])&lt;br /&gt;
    allow(MetareviewResponseMap).to receive(:where).with(reviewed_object_id: 1).and_return([metareview_response_map])&lt;br /&gt;
    expect(review_response_map.metareview_response_maps).to eq([metareview_response_map])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===show_feedback method===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#show_feedback' do&lt;br /&gt;
    context 'when no response is present or response is nil' do&lt;br /&gt;
      it 'returns nil' do&lt;br /&gt;
        allow(review_response_map).to receive(:response).and_return([])     &lt;br /&gt;
        expect(review_response_map.show_feedback null_response).to be(nil)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;context 'when response is present and not nil' do&lt;br /&gt;
      it 'returns feedback' do&lt;br /&gt;
        allow(review_response_map).to receive(:response).and_return([response2, response3])&lt;br /&gt;
        allow(FeedbackResponseMap).to receive(:find_by).with(reviewed_object_id: 1).and_return(feedback_response_map)&lt;br /&gt;
        allow(response3).to receive(:display_as_html).and_return(&amp;quot;display_as_html&amp;quot;)&lt;br /&gt;
        expect(review_response_map.show_feedback response).to eql(&amp;quot;display_as_html&amp;quot;)        &lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===final_versions_from_reviewer method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '.final_versions_from_reviewer' do&lt;br /&gt;
    it 'returns final versions from reviewer' do&lt;br /&gt;
        allow(ReviewResponseMap).to receive(:where).with(reviewer_id: 1).and_return([review_response_map, review_response_map2])&lt;br /&gt;
        allow(Participant).to receive(:find).with(1).and_return(participant)&lt;br /&gt;
        allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
        allow(ReviewResponseMap).to receive(:prepare_final_review_versions).with(assignment, [review_response_map, review_response_map2]).and_return(&amp;quot;prepare_final_review_versions&amp;quot;)&lt;br /&gt;
        expect(ReviewResponseMap.final_versions_from_reviewer 1).to eql(&amp;quot;prepare_final_review_versions&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===import method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '.final_versions_from_reviewer' do&lt;br /&gt;
    it 'returns final versions from reviewer' do&lt;br /&gt;
        allow(ReviewResponseMap).to receive(:where).with(reviewer_id: 1).and_return([review_response_map, review_response_map2])&lt;br /&gt;
        allow(Participant).to receive(:find).with(1).and_return(participant)&lt;br /&gt;
        allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
        allow(ReviewResponseMap).to receive(:prepare_final_review_versions).with(assignment, [review_response_map, review_response_map2]).and_return(&amp;quot;prepare_final_review_versions&amp;quot;)&lt;br /&gt;
        expect(ReviewResponseMap.final_versions_from_reviewer 1).to eql(&amp;quot;prepare_final_review_versions&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
context 'when the reviewee is not nil' do&lt;br /&gt;
      context 'when participant is nil' do&lt;br /&gt;
        testHash = {reviewee: 'user1', reviewers: ['user2']}&lt;br /&gt;
        it &amp;quot;Raises another ArgumentError&amp;quot; do&lt;br /&gt;
          reviewee = double('User', :id =&amp;gt; 1, :name =&amp;gt; 'user1')&lt;br /&gt;
          allow(User).to receive(:find_by).with(name: 'user1').and_return(reviewee)&lt;br /&gt;
          allow(AssignmentParticipant).to receive(:find_by).and_return(nil)&lt;br /&gt;
          expect{ReviewResponseMap.import(testHash, '_session', 1)}.to raise_error(ArgumentError)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
context 'when the participant is not nil' do&lt;br /&gt;
        before(:each) do&lt;br /&gt;
          reviewee = double('User', :id =&amp;gt; 2, :name =&amp;gt; 'user1')&lt;br /&gt;
          allow(User).to receive(:find_by).with(name: 'user1').and_return(reviewee)&lt;br /&gt;
          reviewee_participant = double('AssignmentParticipant', :user_id=&amp;gt;2, :parent_id=&amp;gt;1, :id=&amp;gt;3)&lt;br /&gt;
          allow(AssignmentParticipant).to receive(:find_by).and_return(reviewee_participant)&lt;br /&gt;
          reviewer = double('User', :id=&amp;gt;4, :name=&amp;gt;'user2')&lt;br /&gt;
          allow(User).to receive(:find_by).with(name: 'user2').and_return(reviewer)&lt;br /&gt;
          reviewer_participant = double('AssignmentParticipant', :user_id=&amp;gt;4, :parent_id=&amp;gt;1, :id=&amp;gt;5)&lt;br /&gt;
          allow(AssignmentParticipant).to receive(:where).and_return(reviewer_participant)&lt;br /&gt;
        end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
context 'when reviewee has no team' do&lt;br /&gt;
          it &amp;quot;creates a team for reviewee via lazy team creation&amp;quot; do&lt;br /&gt;
            testHash = {reviewee: 'user1', reviewers: ['user2']}&lt;br /&gt;
            allow(AssignmentTeam).to receive(:team).and_return(nil)&lt;br /&gt;
            reviewee_team = double('AssignmentTeam', name: 'Team_1', parent_id: 1, id: 2)&lt;br /&gt;
            allow(AssignmentTeam).to receive(:create).and_return(reviewee_team)&lt;br /&gt;
            team_user = double('TeamUser', team_id: 2, user_id: 2, id: 10)&lt;br /&gt;
            allow(TeamsUser).to receive(:create).and_return(team_user)&lt;br /&gt;
            team_node = double('TeamNode', parent_id: 1, node_object_id: 2, id: 6)&lt;br /&gt;
            allow(TeamNode).to receive(:create).and_return(team_node)&lt;br /&gt;
            team_user_node = double('TeamUserNode', parent_id: 4, node_object_id: 10)&lt;br /&gt;
            allow(TeamUserNode).to receive(:create).and_return(team_user_node)&lt;br /&gt;
            map1 = double('ReviewResponseMap', reviewed_object_id: 1, reviewer_id: 4, reviewee_id: 2, calibrate_to: false)&lt;br /&gt;
            allow(ReviewResponseMap).to receive(:find_by).and_return(map1)&lt;br /&gt;
            expect(ReviewResponseMap.import(testHash, '_session', 1)).to eq(['user2'])&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
context 'when reviewee has a team' do&lt;br /&gt;
          it &amp;quot;creates a review response map&amp;quot; do&lt;br /&gt;
            testHash = {reviewee: 'user1', reviewers: ['user2']}&lt;br /&gt;
            reviewee_team = double('AssignmentTeam', parent_id: 1, id: 2)&lt;br /&gt;
            allow(AssignmentTeam).to receive(:team).and_return(reviewee_team)&lt;br /&gt;
            map1 = double('ReviewResponseMap', reviewed_object_id: 1, reviewer_id: 4, reviewee_id: 2, calibrate_to: false)&lt;br /&gt;
            allow(ReviewResponseMap).to receive(:find_by).and_return(map1)&lt;br /&gt;
            expect(ReviewResponseMap.import(testHash, '_session', 1)).to eq(['user2'])&lt;br /&gt;
          end&lt;br /&gt;
        end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===review_response_report===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe &amp;quot;.review_response_report&amp;quot; do&lt;br /&gt;
    context &amp;quot;when the user is nil&amp;quot; do&lt;br /&gt;
      it &amp;quot;gives participants with unique IDs in a sorted order&amp;quot; do&lt;br /&gt;
        temp_id = double('id', id: 1)&lt;br /&gt;
        temp_type = double('type', type: 'type')&lt;br /&gt;
        temp_reviewers = double('reviewers')&lt;br /&gt;
        #Stubbing call to the database source: https://relishapp.com/rspec/rspec-mocks/docs/working-with-legacy-code/message-chains&lt;br /&gt;
        allow(ResponseMap).to receive_message_chain(:select, :where).and_return([response_map])&lt;br /&gt;
        allow(AssignmentParticipant).to receive(:find).and_return([temp_reviewers])&lt;br /&gt;
        allow(Participant).to receive(:sort_by_name).and_return([temp_reviewers])&lt;br /&gt;
        expect(ReviewResponseMap.review_response_report(temp_id, assignment, temp_type, nil)).to eq([temp_reviewers])&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
context &amp;quot;when the user is not nil&amp;quot; do&lt;br /&gt;
      it &amp;quot;gives reviewers users' full name&amp;quot; do&lt;br /&gt;
        temp_user = double('user', :[] =&amp;gt; '1')&lt;br /&gt;
        #Mocking user ids&lt;br /&gt;
        temp_user_ids = double('user_ids')&lt;br /&gt;
        temp_id = double('id', id: 1)&lt;br /&gt;
        temp_type = double('type', type: 'type')&lt;br /&gt;
        temp_reviewers = double('reviewers', fullname: 'testName')&lt;br /&gt;
        allow(User).to receive_message_chain(:select, :where).and_return([temp_user_ids])&lt;br /&gt;
        allow(AssignmentParticipant).to receive(:where).and_return([temp_reviewers])&lt;br /&gt;
        expect(ReviewResponseMap.review_response_report(temp_id, assignment, temp_type, temp_user)).to eq([temp_reviewers])&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===email method===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe &amp;quot;#email&amp;quot; do&lt;br /&gt;
    it &amp;quot;notifies the reviewee of the new review submitted&amp;quot; do&lt;br /&gt;
      temp_user = double('user', id: 1)&lt;br /&gt;
      defn = {body: {type: &amp;quot;test type&amp;quot;, obj_name: &amp;quot;test name&amp;quot;, first_name: &amp;quot;test name&amp;quot;, partial_name: &amp;quot;test name&amp;quot;}, to: &amp;quot;test@email.com&amp;quot;}&lt;br /&gt;
      allow(AssignmentTeam).to receive_message_chain(:find, :users).and_return([temp_user])&lt;br /&gt;
      allow(assignment).to receive(:name).and_return('')&lt;br /&gt;
      allow(User).to receive_message_chain(:find, :fullname).and_return('')&lt;br /&gt;
      allow(User).to receive_message_chain(:find, :email).and_return('')&lt;br /&gt;
      allow(Mailer).to receive_message_chain(:sync_message, :deliver_now).and_return('')&lt;br /&gt;
      expect(review_response_map.email(defn, participant, assignment)).to eq([temp_user])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===prepare_final_review_versions method===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '.prepare_final_review_versions' do&lt;br /&gt;
    context 'if the round number is greater than 1' do&lt;br /&gt;
      it &amp;quot;returns updated version of review&amp;quot; do&lt;br /&gt;
        maps = []&lt;br /&gt;
        round_num = 2&lt;br /&gt;
        allow(assignment).to receive(:rounds_of_reviews).and_return(round_num)&lt;br /&gt;
        #Mocking reviews for two rounds&lt;br /&gt;
        expect(ReviewResponseMap.prepare_final_review_versions(assignment, maps)).to eql(:&amp;quot;review round1&amp;quot; =&amp;gt; {questionnaire_id: nil, response_ids: []}, :&amp;quot;review round2&amp;quot; =&amp;gt; {questionnaire_id: nil, response_ids: []})&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    context 'if the round number is not greater than 1' do&lt;br /&gt;
      it &amp;quot;returns latest version of review&amp;quot; do&lt;br /&gt;
        maps = []&lt;br /&gt;
        round_num = nil&lt;br /&gt;
        temp_assignment = double(:assignment, round_of_reviews: 5, review_questionnaire_id: 2)&lt;br /&gt;
        allow(temp_assignment).to receive(:rounds_of_reviews).and_return(round_num)&lt;br /&gt;
        expect(ReviewResponseMap.prepare_final_review_versions(temp_assignment, maps)).to eql(review: {questionnaire_id: 2, response_ids: []})&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== prepare_review_response method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '.prepare_review_response' do&lt;br /&gt;
    context 'if the round is nil' do&lt;br /&gt;
      it 'should return the latest response Id' do&lt;br /&gt;
        round_num = nil&lt;br /&gt;
        maps = []&lt;br /&gt;
        temp_assignment = double(:assignment, review_questionnaire_id: 1)&lt;br /&gt;
        allow(temp_assignment).to receive(:rounds_of_reviews).and_return(round_num)&lt;br /&gt;
        expect(ReviewResponseMap.prepare_final_review_versions(temp_assignment, maps)).to eql(review: {questionnaire_id: 1, response_ids: []})&lt;br /&gt;
        allow(temp_assignment).to receive(:review_questionnaire_id).and_return(1)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    context 'if the round is not nil' do&lt;br /&gt;
      it 'should return the latest response Id' do&lt;br /&gt;
        review_final_versions = {}&lt;br /&gt;
        maps = [double(:map, id: 1)]&lt;br /&gt;
        responses = []&lt;br /&gt;
        round_num = 1&lt;br /&gt;
        allow(Response).to receive(:where).and_return([])&lt;br /&gt;
        allow(responses).to receive_message_chain(:last, :id).and_return([])&lt;br /&gt;
        expect(ReviewResponseMap.prepare_review_response(assignment, maps, review_final_versions, round_num)).to eq([])&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Files affected==&lt;br /&gt;
review_response_map.rb&lt;br /&gt;
review_response_map_spec.rb&lt;br /&gt;
spec_helper.rb&lt;br /&gt;
==Testing Framework==&lt;br /&gt;
We used RSpec framework to test the given file.RSpec is a 'Domain Specific Language' (DSL) testing tool written in Ruby to test Ruby code.It is a behavior-driven development (BDD) framework which is extensively used in the production applications. The basic idea behind this concept is that of Test Driven Development (TDD) where the tests are written first and the development is based on writing just enough code that will fulfill those tests followed by refactoring. It contains its own mocking framework that is fully integrated into the framework based upon JMock.The simplicity in the RSpec syntax makes it one of the popular testing tools for Ruby applications. The RSpec tool can be used by installing the rspec gem which consists of 3 other gems namely rspec-core, rspec-expectation and rspec-mock.&lt;br /&gt;
==References==&lt;br /&gt;
https://en.wikipedia.org/wiki/RSpec&lt;/div&gt;</summary>
		<author><name>Ssaluja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=119429</id>
		<title>E1850 Write unit tests for review response map</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=119429"/>
		<updated>2018-11-12T13:40:38Z</updated>

		<summary type="html">&lt;p&gt;Ssaluja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
It is an open source software created by North Carolina State University's students. It works on ruby on rails framework. This platform allows instructor to post notification about tests and assignments and also allows students to view grades, submit assignments, find teammates etc.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Review_response_map.rb file is a newly added feature in Expertiza. The ReviewResponseMap class in the file is the sub class of ResponseMap class.The file review_response_map.rb deals with mapping of review's review to the feedback that reviewee gives to that review. Since the file is new it is not tested. We have worked on the file review_response_map_spec.rb which use RSpec framework to perform unit testing on the given file.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
1.Create a new file named review_response_map_spec.rb under spec/models folder&amp;lt;br&amp;gt;&lt;br /&gt;
2.Write RSpec unit tests to make the path coverage above 90%.&amp;lt;br&amp;gt;&lt;br /&gt;
3.Coverage as many edge cases as you can.&amp;lt;br&amp;gt;&lt;br /&gt;
4.Achieve as high branch coverage as you can. We will use the mutant-rspec gem to measure test thoroughness and fault-finding capability of your tests.&amp;lt;br&amp;gt;&lt;br /&gt;
==Test Plan==&lt;br /&gt;
We created the following stubs to implement unit testing:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   let(:participant) { build(:participant, id: 1, parent_id: 1, user: build(:student, name: 'no name', fullname: 'no one')) }&lt;br /&gt;
   let(:participant2) { build(:participant, id: 2, parent_id: 1, user: build(:student, name: 'no name', fullname: 'no one')) }&lt;br /&gt;
   let(:student){ build(:participant, id: 3, parent_id: 1, user: build(:student, name: 'no name', fullname: 'first user')) }&lt;br /&gt;
   let(:student2){ build(:participant, id: 4, parent_id: 1, user: build(:student, name: 'no name', fullname: 'second one')) }&lt;br /&gt;
   let(:team) { build(:assignment_team) }&lt;br /&gt;
   let(:assignment) { build(:assignment, id: 1, name: 'Test Assgt') }&lt;br /&gt;
   let(:assignment2) { build(:assignment, id: 2, name: 'Test Assgt') }&lt;br /&gt;
   let(:response_map) { build(:review_response_map, reviewer: student, response: [response], reviewee_id: 1, type: &amp;quot;ReviewResponseMap&amp;quot;) }&lt;br /&gt;
   let(:response_map2) { build(:review_response_map, reviewer: student2, response:[response2, response3],reviewee_id: 1, type: &amp;quot;ReviewResponseMap&amp;quot;) }&lt;br /&gt;
   let(:question) { Criterion.new(id: 1, weight: 2, break_before: true) }&lt;br /&gt;
   let(:questionnaire) { ReviewQuestionnaire.new(id: 1, questions: [question], max_question_score: 5) }&lt;br /&gt;
   let(:answer) { Answer.new(answer: 1, comments: 'Answer text', question_id: 1) }&lt;br /&gt;
   let(:response) { build(:response, id: 1, round: 1, is_submitted: true,map_id: 1, scores: [answer]) }&lt;br /&gt;
   let(:response2) { build(:response, id: 2, round: 1, is_submitted: true, map_id: 1, scores: [answer]) }&lt;br /&gt;
   let(:response3) { build(:response, id: 3, round: 1, is_submitted: false, map_id: 1, scores: [answer]) }&lt;br /&gt;
   let(:review_response_map) { build(:review_response_map, reviewer_id:1, assignment: assignment, reviewer: participant, reviewee: team) }&lt;br /&gt;
   let(:review_response_map2) { build(:review_response_map, assignment: assignment2, reviewer: participant2, reviewee: team) }&lt;br /&gt;
   let(:meta_review_response_map) { build(:meta_review_response_map, review_mapping: review_response_map, reviewee: participant)}&lt;br /&gt;
   let(:feedback_response_map){ build(:review_response_map, reviewed_object_id: 1, response:[response2], type:'FeedbackResponseMap')}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===The get_title method===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#get_title' do&lt;br /&gt;
    it 'returns the title' do&lt;br /&gt;
      expect(review_response_map.get_title).to eql(&amp;quot;Review&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The questionnaire method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#questionnaire' do&lt;br /&gt;
    it 'returns questionnaire' do&lt;br /&gt;
      allow(assignment).to receive(:review_questionnaire_id).and_return(1)&lt;br /&gt;
      allow(Questionnaire).to receive(:find_by).with(id: 1).and_return(questionnaire)&lt;br /&gt;
      expect(review_response_map.questionnaire.id).to eq(1)&lt;br /&gt;
    end&lt;br /&gt;
  end &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The export_fields method===&lt;br /&gt;
&amp;lt;pre&amp;gt; describe '.export_fields' do&lt;br /&gt;
    it 'returns list of strings &amp;quot;contributor&amp;quot; and &amp;quot;reviewed by&amp;quot;' do&lt;br /&gt;
      expect(ReviewResponseMap.export_fields &amp;quot;&amp;quot;).to eq([&amp;quot;contributor&amp;quot;, &amp;quot;reviewed by&amp;quot;])&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The delete method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#delete' do&lt;br /&gt;
    it 'deletes the review response map' do&lt;br /&gt;
      allow(review_response_map.response).to receive(:response_id).and_return(1)&lt;br /&gt;
      allow(FeedbackResponseMap).to receive(:where).with(reviewed_object_id: 1).and_return([feedback_response_map])&lt;br /&gt;
      allow(feedback_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(MetareviewResponseMap).to receive(:where).with(reviewed_object_id: review_response_map.id).and_return([meta_review_response_map])&lt;br /&gt;
      allow(meta_review_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(review_response_map).to receive(:destroy).and_return(true)&lt;br /&gt;
      expect(review_response_map.delete).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;
===The get_responses_for_team_round method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '.get_responses_for_team_round' do&lt;br /&gt;
    context 'when team doesnt exist' do&lt;br /&gt;
      it 'returns empty response' do&lt;br /&gt;
        team = instance_double('AssignmentTeam').as_null_object&lt;br /&gt;
        allow(team).to receive(:id).and_return(false)&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round team, 1).to eql([])&lt;br /&gt;
      end&lt;br /&gt;
    end &lt;br /&gt;
     context 'when team exists' do&lt;br /&gt;
      it 'returns the responses for particular round' do&lt;br /&gt;
        team = instance_double('AssignmentTeam', :id=&amp;gt;1)&lt;br /&gt;
        round = 1&lt;br /&gt;
        allow(ResponseMap).to receive(:where).with(reviewee_id: 1, type: &amp;quot;ReviewResponseMap&amp;quot;).and_return([response_map, response_map2])&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round(team, round).length).to eql(2)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The show_feedback method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#show_feedback' do&lt;br /&gt;
    context 'when no response is present or response is nil' do&lt;br /&gt;
      it 'returns nil' do&lt;br /&gt;
        db1 = instance_double(&amp;quot;Response&amp;quot;).as_null_object&lt;br /&gt;
        expect(review_response_map.show_feedback db1).to be(nil)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Files affected==&lt;br /&gt;
review_response_map.rb&lt;br /&gt;
review_response_map_spec.rb&lt;br /&gt;
spec_helper.rb&lt;br /&gt;
==Testing Framework==&lt;br /&gt;
We used RSpec framework to test the given file.RSpec is a 'Domain Specific Language' (DSL) testing tool written in Ruby to test Ruby code.It is a behavior-driven development (BDD) framework which is extensively used in the production applications. The basic idea behind this concept is that of Test Driven Development (TDD) where the tests are written first and the development is based on writing just enough code that will fulfill those tests followed by refactoring. It contains its own mocking framework that is fully integrated into the framework based upon JMock.The simplicity in the RSpec syntax makes it one of the popular testing tools for Ruby applications. The RSpec tool can be used by installing the rspec gem which consists of 3 other gems namely rspec-core, rspec-expectation and rspec-mock.&lt;br /&gt;
==References==&lt;br /&gt;
https://en.wikipedia.org/wiki/RSpec&lt;/div&gt;</summary>
		<author><name>Ssaluja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=119428</id>
		<title>E1850 Write unit tests for review response map</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=119428"/>
		<updated>2018-11-12T02:15:49Z</updated>

		<summary type="html">&lt;p&gt;Ssaluja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
It is an open source software created by North Carolina State University's students. It works on ruby on rails framework. This platform allows instructor to post notification about tests and assignments and also allows students to view grades, submit assignments, find teammates etc.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
==Background==&lt;br /&gt;
Review_response_map.rb file is a newly added feature in Expertiza. The ReviewResponseMap class in the file is the sub class of ResponseMap class.The file review_response_map.rb deals with mapping of review's review to the feedback that reviewee gives to that review. Since the file is new it is not tested. We have worked on the file review_response_map_spec.rb which use RSpec framework to perform unit testing on the given file.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
1.Create a new file named review_response_map_spec.rb under spec/models folder&amp;lt;br&amp;gt;&lt;br /&gt;
2.Write RSpec unit tests to make the path coverage above 90%.&amp;lt;br&amp;gt;&lt;br /&gt;
3.Coverage as many edge cases as you can.&amp;lt;br&amp;gt;&lt;br /&gt;
4.Achieve as high branch coverage as you can. We will use the mutant-rspec gem to measure test thoroughness and fault-finding capability of your tests.&amp;lt;br&amp;gt;&lt;br /&gt;
==Test Plan==&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===The get_title method===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#get_title' do&lt;br /&gt;
    it 'returns the title' do&lt;br /&gt;
      expect(review_response_map.get_title).to eql(&amp;quot;Review&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The questionnaire method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#questionnaire' do&lt;br /&gt;
    it 'returns questionnaire' do&lt;br /&gt;
      allow(assignment).to receive(:review_questionnaire_id).and_return(1)&lt;br /&gt;
      allow(Questionnaire).to receive(:find_by).with(id: 1).and_return(questionnaire)&lt;br /&gt;
      expect(review_response_map.questionnaire.id).to eq(1)&lt;br /&gt;
    end&lt;br /&gt;
  end &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The export_fields method===&lt;br /&gt;
&amp;lt;pre&amp;gt; describe '.export_fields' do&lt;br /&gt;
    it 'returns list of strings &amp;quot;contributor&amp;quot; and &amp;quot;reviewed by&amp;quot;' do&lt;br /&gt;
      expect(ReviewResponseMap.export_fields &amp;quot;&amp;quot;).to eq([&amp;quot;contributor&amp;quot;, &amp;quot;reviewed by&amp;quot;])&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The delete method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#delete' do&lt;br /&gt;
    it 'deletes the review response map' do&lt;br /&gt;
      allow(review_response_map.response).to receive(:response_id).and_return(1)&lt;br /&gt;
      allow(FeedbackResponseMap).to receive(:where).with(reviewed_object_id: 1).and_return([feedback_response_map])&lt;br /&gt;
      allow(feedback_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(MetareviewResponseMap).to receive(:where).with(reviewed_object_id: review_response_map.id).and_return([meta_review_response_map])&lt;br /&gt;
      allow(meta_review_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(review_response_map).to receive(:destroy).and_return(true)&lt;br /&gt;
      expect(review_response_map.delete).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;
===The get_responses_for_team_round method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '.get_responses_for_team_round' do&lt;br /&gt;
    context 'when team doesnt exist' do&lt;br /&gt;
      it 'returns empty response' do&lt;br /&gt;
        team = instance_double('AssignmentTeam').as_null_object&lt;br /&gt;
        allow(team).to receive(:id).and_return(false)&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round team, 1).to eql([])&lt;br /&gt;
      end&lt;br /&gt;
    end &lt;br /&gt;
     context 'when team exists' do&lt;br /&gt;
      it 'returns the responses for particular round' do&lt;br /&gt;
        team = instance_double('AssignmentTeam', :id=&amp;gt;1)&lt;br /&gt;
        round = 1&lt;br /&gt;
        allow(ResponseMap).to receive(:where).with(reviewee_id: 1, type: &amp;quot;ReviewResponseMap&amp;quot;).and_return([response_map, response_map2])&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round(team, round).length).to eql(2)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The show_feedback method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#show_feedback' do&lt;br /&gt;
    context 'when no response is present or response is nil' do&lt;br /&gt;
      it 'returns nil' do&lt;br /&gt;
        db1 = instance_double(&amp;quot;Response&amp;quot;).as_null_object&lt;br /&gt;
        expect(review_response_map.show_feedback db1).to be(nil)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Files affected==&lt;br /&gt;
review_response_map.rb&lt;br /&gt;
review_response_map_spec.rb&lt;br /&gt;
spec_helper.rb&lt;br /&gt;
==Testing Framework==&lt;br /&gt;
We used RSpec framework to test the given file.RSpec is a 'Domain Specific Language' (DSL) testing tool written in Ruby to test Ruby code.It is a behavior-driven development (BDD) framework which is extensively used in the production applications. The basic idea behind this concept is that of Test Driven Development (TDD) where the tests are written first and the development is based on writing just enough code that will fulfill those tests followed by refactoring. It contains its own mocking framework that is fully integrated into the framework based upon JMock.The simplicity in the RSpec syntax makes it one of the popular testing tools for Ruby applications. The RSpec tool can be used by installing the rspec gem which consists of 3 other gems namely rspec-core, rspec-expectation and rspec-mock.&lt;br /&gt;
==References==&lt;br /&gt;
https://en.wikipedia.org/wiki/RSpec&lt;/div&gt;</summary>
		<author><name>Ssaluja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=119427</id>
		<title>E1850 Write unit tests for review response map</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=119427"/>
		<updated>2018-11-12T02:11:14Z</updated>

		<summary type="html">&lt;p&gt;Ssaluja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
It is an open source software created by North Carolina State University's students. It works on ruby on rails framework. This platform allows instructor to post notification about tests and assignments and also allows students to view grades, submit assignments, find teammates etc.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
1.Create a new file named review_response_map_spec.rb under spec/models folder&amp;lt;br&amp;gt;&lt;br /&gt;
2.Write RSpec unit tests to make the path coverage above 90%.&amp;lt;br&amp;gt;&lt;br /&gt;
3.Coverage as many edge cases as you can.&amp;lt;br&amp;gt;&lt;br /&gt;
4.Achieve as high branch coverage as you can. We will use the mutant-rspec gem to measure test thoroughness and fault-finding capability of your tests.&amp;lt;br&amp;gt;&lt;br /&gt;
==Test Plan==&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
===The get_title method===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#get_title' do&lt;br /&gt;
    it 'returns the title' do&lt;br /&gt;
      expect(review_response_map.get_title).to eql(&amp;quot;Review&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The questionnaire method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#questionnaire' do&lt;br /&gt;
    it 'returns questionnaire' do&lt;br /&gt;
      allow(assignment).to receive(:review_questionnaire_id).and_return(1)&lt;br /&gt;
      allow(Questionnaire).to receive(:find_by).with(id: 1).and_return(questionnaire)&lt;br /&gt;
      expect(review_response_map.questionnaire.id).to eq(1)&lt;br /&gt;
    end&lt;br /&gt;
  end &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The export_fields method===&lt;br /&gt;
&amp;lt;pre&amp;gt; describe '.export_fields' do&lt;br /&gt;
    it 'returns list of strings &amp;quot;contributor&amp;quot; and &amp;quot;reviewed by&amp;quot;' do&lt;br /&gt;
      expect(ReviewResponseMap.export_fields &amp;quot;&amp;quot;).to eq([&amp;quot;contributor&amp;quot;, &amp;quot;reviewed by&amp;quot;])&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The delete method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#delete' do&lt;br /&gt;
    it 'deletes the review response map' do&lt;br /&gt;
      allow(review_response_map.response).to receive(:response_id).and_return(1)&lt;br /&gt;
      allow(FeedbackResponseMap).to receive(:where).with(reviewed_object_id: 1).and_return([feedback_response_map])&lt;br /&gt;
      allow(feedback_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(MetareviewResponseMap).to receive(:where).with(reviewed_object_id: review_response_map.id).and_return([meta_review_response_map])&lt;br /&gt;
      allow(meta_review_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(review_response_map).to receive(:destroy).and_return(true)&lt;br /&gt;
      expect(review_response_map.delete).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;
===The get_responses_for_team_round method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '.get_responses_for_team_round' do&lt;br /&gt;
    context 'when team doesnt exist' do&lt;br /&gt;
      it 'returns empty response' do&lt;br /&gt;
        team = instance_double('AssignmentTeam').as_null_object&lt;br /&gt;
        allow(team).to receive(:id).and_return(false)&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round team, 1).to eql([])&lt;br /&gt;
      end&lt;br /&gt;
    end &lt;br /&gt;
     context 'when team exists' do&lt;br /&gt;
      it 'returns the responses for particular round' do&lt;br /&gt;
        team = instance_double('AssignmentTeam', :id=&amp;gt;1)&lt;br /&gt;
        round = 1&lt;br /&gt;
        allow(ResponseMap).to receive(:where).with(reviewee_id: 1, type: &amp;quot;ReviewResponseMap&amp;quot;).and_return([response_map, response_map2])&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round(team, round).length).to eql(2)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The show_feedback method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#show_feedback' do&lt;br /&gt;
    context 'when no response is present or response is nil' do&lt;br /&gt;
      it 'returns nil' do&lt;br /&gt;
        db1 = instance_double(&amp;quot;Response&amp;quot;).as_null_object&lt;br /&gt;
        expect(review_response_map.show_feedback db1).to be(nil)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Files affected==&lt;br /&gt;
review_response_map.rb&lt;br /&gt;
review_response_map_spec.rb&lt;br /&gt;
spec_helper.rb&lt;br /&gt;
==Testing Framework==&lt;br /&gt;
We used RSpec framework to test the given file.RSpec is a 'Domain Specific Language' (DSL) testing tool written in Ruby to test Ruby code.It is a behavior-driven development (BDD) framework which is extensively used in the production applications. The basic idea behind this concept is that of Test Driven Development (TDD) where the tests are written first and the development is based on writing just enough code that will fulfill those tests followed by refactoring. It contains its own mocking framework that is fully integrated into the framework based upon JMock.The simplicity in the RSpec syntax makes it one of the popular testing tools for Ruby applications. The RSpec tool can be used by installing the rspec gem which consists of 3 other gems namely rspec-core, rspec-expectation and rspec-mock.&lt;br /&gt;
==References==&lt;br /&gt;
https://en.wikipedia.org/wiki/RSpec&lt;/div&gt;</summary>
		<author><name>Ssaluja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=119426</id>
		<title>E1850 Write unit tests for review response map</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=119426"/>
		<updated>2018-11-12T02:10:16Z</updated>

		<summary type="html">&lt;p&gt;Ssaluja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
It is an open source software created by North Carolina State University's students. It works on ruby on rails framework. This platform allows instructor to post notification about tests and assignments and also allows students to view grades, submit assignments, find teammates etc.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
1.Create a new file named review_response_map_spec.rb under spec/models folder&amp;lt;br&amp;gt;&lt;br /&gt;
2.Write RSpec unit tests to make the path coverage above 90%.&amp;lt;br&amp;gt;&lt;br /&gt;
3.Coverage as many edge cases as you can.&amp;lt;br&amp;gt;&lt;br /&gt;
4.Achieve as high branch coverage as you can. We will use the mutant-rspec gem to measure test thoroughness and fault-finding capability of your tests.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===The get_title method===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#get_title' do&lt;br /&gt;
    it 'returns the title' do&lt;br /&gt;
      expect(review_response_map.get_title).to eql(&amp;quot;Review&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The questionnaire method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#questionnaire' do&lt;br /&gt;
    it 'returns questionnaire' do&lt;br /&gt;
      allow(assignment).to receive(:review_questionnaire_id).and_return(1)&lt;br /&gt;
      allow(Questionnaire).to receive(:find_by).with(id: 1).and_return(questionnaire)&lt;br /&gt;
      expect(review_response_map.questionnaire.id).to eq(1)&lt;br /&gt;
    end&lt;br /&gt;
  end &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The export_fields method===&lt;br /&gt;
&amp;lt;pre&amp;gt; describe '.export_fields' do&lt;br /&gt;
    it 'returns list of strings &amp;quot;contributor&amp;quot; and &amp;quot;reviewed by&amp;quot;' do&lt;br /&gt;
      expect(ReviewResponseMap.export_fields &amp;quot;&amp;quot;).to eq([&amp;quot;contributor&amp;quot;, &amp;quot;reviewed by&amp;quot;])&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The delete method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#delete' do&lt;br /&gt;
    it 'deletes the review response map' do&lt;br /&gt;
      allow(review_response_map.response).to receive(:response_id).and_return(1)&lt;br /&gt;
      allow(FeedbackResponseMap).to receive(:where).with(reviewed_object_id: 1).and_return([feedback_response_map])&lt;br /&gt;
      allow(feedback_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(MetareviewResponseMap).to receive(:where).with(reviewed_object_id: review_response_map.id).and_return([meta_review_response_map])&lt;br /&gt;
      allow(meta_review_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(review_response_map).to receive(:destroy).and_return(true)&lt;br /&gt;
      expect(review_response_map.delete).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;
===The get_responses_for_team_round method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '.get_responses_for_team_round' do&lt;br /&gt;
    context 'when team doesnt exist' do&lt;br /&gt;
      it 'returns empty response' do&lt;br /&gt;
        team = instance_double('AssignmentTeam').as_null_object&lt;br /&gt;
        allow(team).to receive(:id).and_return(false)&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round team, 1).to eql([])&lt;br /&gt;
      end&lt;br /&gt;
    end &lt;br /&gt;
     context 'when team exists' do&lt;br /&gt;
      it 'returns the responses for particular round' do&lt;br /&gt;
        team = instance_double('AssignmentTeam', :id=&amp;gt;1)&lt;br /&gt;
        round = 1&lt;br /&gt;
        allow(ResponseMap).to receive(:where).with(reviewee_id: 1, type: &amp;quot;ReviewResponseMap&amp;quot;).and_return([response_map, response_map2])&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round(team, round).length).to eql(2)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The show_feedback method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#show_feedback' do&lt;br /&gt;
    context 'when no response is present or response is nil' do&lt;br /&gt;
      it 'returns nil' do&lt;br /&gt;
        db1 = instance_double(&amp;quot;Response&amp;quot;).as_null_object&lt;br /&gt;
        expect(review_response_map.show_feedback db1).to be(nil)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Files affected==&lt;br /&gt;
review_response_map.rb&lt;br /&gt;
review_response_map_spec.rb&lt;br /&gt;
spec_helper.rb&lt;br /&gt;
==Testing Framework==&lt;br /&gt;
We used RSpec framework to test the given file.RSpec is a 'Domain Specific Language' (DSL) testing tool written in Ruby to test Ruby code.It is a behavior-driven development (BDD) framework which is extensively used in the production applications. The basic idea behind this concept is that of Test Driven Development (TDD) where the tests are written first and the development is based on writing just enough code that will fulfill those tests followed by refactoring. It contains its own mocking framework that is fully integrated into the framework based upon JMock.The simplicity in the RSpec syntax makes it one of the popular testing tools for Ruby applications. The RSpec tool can be used by installing the rspec gem which consists of 3 other gems namely rspec-core, rspec-expectation and rspec-mock.&lt;br /&gt;
==References==&lt;br /&gt;
https://en.wikipedia.org/wiki/RSpec&lt;/div&gt;</summary>
		<author><name>Ssaluja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=118959</id>
		<title>E1850 Write unit tests for review response map</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=118959"/>
		<updated>2018-11-09T02:22:36Z</updated>

		<summary type="html">&lt;p&gt;Ssaluja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
It is an open source software created by North Carolina State University's students. It works on ruby on rails framework. This platform allows instructor to post notification about tests and assignments and also allows students to view grades, submit assignments, find teammates etc.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
1.Create a new file named review_response_map_spec.rb under spec/models folder&amp;lt;br&amp;gt;&lt;br /&gt;
2.Write RSpec unit tests to make the path coverage above 90%.&amp;lt;br&amp;gt;&lt;br /&gt;
3.Coverage as many edge cases as you can.&amp;lt;br&amp;gt;&lt;br /&gt;
4.Achieve as high branch coverage as you can. We will use the mutant-rspec gem to measure test thoroughness and fault-finding capability of your tests.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
===The get_title method===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#get_title' do&lt;br /&gt;
    it 'returns the title' do&lt;br /&gt;
      expect(review_response_map.get_title).to eql(&amp;quot;Review&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The questionnaire method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#questionnaire' do&lt;br /&gt;
    it 'returns questionnaire' do&lt;br /&gt;
      allow(assignment).to receive(:review_questionnaire_id).and_return(1)&lt;br /&gt;
      allow(Questionnaire).to receive(:find_by).with(id: 1).and_return(questionnaire)&lt;br /&gt;
      expect(review_response_map.questionnaire.id).to eq(1)&lt;br /&gt;
    end&lt;br /&gt;
  end &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The export_fields method===&lt;br /&gt;
&amp;lt;pre&amp;gt; describe '.export_fields' do&lt;br /&gt;
    it 'returns list of strings &amp;quot;contributor&amp;quot; and &amp;quot;reviewed by&amp;quot;' do&lt;br /&gt;
      expect(ReviewResponseMap.export_fields &amp;quot;&amp;quot;).to eq([&amp;quot;contributor&amp;quot;, &amp;quot;reviewed by&amp;quot;])&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The delete method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#delete' do&lt;br /&gt;
    it 'deletes the review response map' do&lt;br /&gt;
      allow(review_response_map.response).to receive(:response_id).and_return(1)&lt;br /&gt;
      allow(FeedbackResponseMap).to receive(:where).with(reviewed_object_id: 1).and_return([feedback_response_map])&lt;br /&gt;
      allow(feedback_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(MetareviewResponseMap).to receive(:where).with(reviewed_object_id: review_response_map.id).and_return([meta_review_response_map])&lt;br /&gt;
      allow(meta_review_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(review_response_map).to receive(:destroy).and_return(true)&lt;br /&gt;
      expect(review_response_map.delete).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;
===The get_responses_for_team_round method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '.get_responses_for_team_round' do&lt;br /&gt;
    context 'when team doesnt exist' do&lt;br /&gt;
      it 'returns empty response' do&lt;br /&gt;
        team = instance_double('AssignmentTeam').as_null_object&lt;br /&gt;
        allow(team).to receive(:id).and_return(false)&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round team, 1).to eql([])&lt;br /&gt;
      end&lt;br /&gt;
    end &lt;br /&gt;
     context 'when team exists' do&lt;br /&gt;
      it 'returns the responses for particular round' do&lt;br /&gt;
        team = instance_double('AssignmentTeam', :id=&amp;gt;1)&lt;br /&gt;
        round = 1&lt;br /&gt;
        allow(ResponseMap).to receive(:where).with(reviewee_id: 1, type: &amp;quot;ReviewResponseMap&amp;quot;).and_return([response_map, response_map2])&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round(team, round).length).to eql(2)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===The show_feedback method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#show_feedback' do&lt;br /&gt;
    context 'when no response is present or response is nil' do&lt;br /&gt;
      it 'returns nil' do&lt;br /&gt;
        db1 = instance_double(&amp;quot;Response&amp;quot;).as_null_object&lt;br /&gt;
        expect(review_response_map.show_feedback db1).to be(nil)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssaluja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=118957</id>
		<title>E1850 Write unit tests for review response map</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=118957"/>
		<updated>2018-11-09T02:20:50Z</updated>

		<summary type="html">&lt;p&gt;Ssaluja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
It is an open source software created by North Carolina State University's students. It works on ruby on rails framework. This platform allows instructor to post notification about tests and assignments and also allows students to view grades, submit assignments, find teammates etc.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
1.Create a new file named review_response_map_spec.rb under spec/models folder&amp;lt;br&amp;gt;&lt;br /&gt;
2.Write RSpec unit tests to make the path coverage above 90%.&amp;lt;br&amp;gt;&lt;br /&gt;
3.Coverage as many edge cases as you can.&amp;lt;br&amp;gt;&lt;br /&gt;
4.Achieve as high branch coverage as you can. We will use the mutant-rspec gem to measure test thoroughness and fault-finding capability of your tests.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
The following test checks if the title is correct or not.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#get_title' do&lt;br /&gt;
    it 'returns the title' do&lt;br /&gt;
      expect(review_response_map.get_title).to eql(&amp;quot;Review&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following tests the questionnaire method&lt;br /&gt;
===The questionnaire method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#questionnaire' do&lt;br /&gt;
    it 'returns questionnaire' do&lt;br /&gt;
      allow(assignment).to receive(:review_questionnaire_id).and_return(1)&lt;br /&gt;
      allow(Questionnaire).to receive(:find_by).with(id: 1).and_return(questionnaire)&lt;br /&gt;
      expect(review_response_map.questionnaire.id).to eq(1)&lt;br /&gt;
    end&lt;br /&gt;
  end &amp;lt;/pre&amp;gt;&lt;br /&gt;
The following tests the export fields method&lt;br /&gt;
===The export_fields method===&lt;br /&gt;
&amp;lt;pre&amp;gt; describe '.export_fields' do&lt;br /&gt;
    it 'returns list of strings &amp;quot;contributor&amp;quot; and &amp;quot;reviewed by&amp;quot;' do&lt;br /&gt;
      expect(ReviewResponseMap.export_fields &amp;quot;&amp;quot;).to eq([&amp;quot;contributor&amp;quot;, &amp;quot;reviewed by&amp;quot;])&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following tests the delete method&lt;br /&gt;
===The delete method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#delete' do&lt;br /&gt;
    it 'deletes the review response map' do&lt;br /&gt;
      allow(review_response_map.response).to receive(:response_id).and_return(1)&lt;br /&gt;
      allow(FeedbackResponseMap).to receive(:where).with(reviewed_object_id: 1).and_return([feedback_response_map])&lt;br /&gt;
      allow(feedback_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(MetareviewResponseMap).to receive(:where).with(reviewed_object_id: review_response_map.id).and_return([meta_review_response_map])&lt;br /&gt;
      allow(meta_review_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(review_response_map).to receive(:destroy).and_return(true)&lt;br /&gt;
      expect(review_response_map.delete).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The folowing code tests the get responses for team round method&lt;br /&gt;
===The get_responses_for_team_round method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '.get_responses_for_team_round' do&lt;br /&gt;
    context 'when team doesnt exist' do&lt;br /&gt;
      it 'returns empty response' do&lt;br /&gt;
        team = instance_double('AssignmentTeam').as_null_object&lt;br /&gt;
        allow(team).to receive(:id).and_return(false)&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round team, 1).to eql([])&lt;br /&gt;
      end&lt;br /&gt;
    end &lt;br /&gt;
     context 'when team exists' do&lt;br /&gt;
      it 'returns the responses for particular round' do&lt;br /&gt;
        team = instance_double('AssignmentTeam', :id=&amp;gt;1)&lt;br /&gt;
        round = 1&lt;br /&gt;
        allow(ResponseMap).to receive(:where).with(reviewee_id: 1, type: &amp;quot;ReviewResponseMap&amp;quot;).and_return([response_map, response_map2])&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round(team, round).length).to eql(2)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following code tests the show feedback method&lt;br /&gt;
===The show_feedback method===&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#show_feedback' do&lt;br /&gt;
    context 'when no response is present or response is nil' do&lt;br /&gt;
      it 'returns nil' do&lt;br /&gt;
        db1 = instance_double(&amp;quot;Response&amp;quot;).as_null_object&lt;br /&gt;
        expect(review_response_map.show_feedback db1).to be(nil)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssaluja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=118955</id>
		<title>E1850 Write unit tests for review response map</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=118955"/>
		<updated>2018-11-09T02:13:54Z</updated>

		<summary type="html">&lt;p&gt;Ssaluja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
It is an open source software created by North Carolina State University's students. It works on ruby on rails framework. This platform allows instructor to post notification about tests and assignments and also allows students to view grades, submit assignments, find teammates etc.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
1.Create a new file named review_response_map_spec.rb under spec/models folder&amp;lt;br&amp;gt;&lt;br /&gt;
2.Write RSpec unit tests to make the path coverage above 90%.&amp;lt;br&amp;gt;&lt;br /&gt;
3.Coverage as many edge cases as you can.&amp;lt;br&amp;gt;&lt;br /&gt;
4.Achieve as high branch coverage as you can. We will use the mutant-rspec gem to measure test thoroughness and fault-finding capability of your tests.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
The following test checks if the title is correct or not.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#get_title' do&lt;br /&gt;
    it 'returns the title' do&lt;br /&gt;
      expect(review_response_map.get_title).to eql(&amp;quot;Review&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following tests the questionnaire method&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#questionnaire' do&lt;br /&gt;
    it 'returns questionnaire' do&lt;br /&gt;
      allow(assignment).to receive(:review_questionnaire_id).and_return(1)&lt;br /&gt;
      allow(Questionnaire).to receive(:find_by).with(id: 1).and_return(questionnaire)&lt;br /&gt;
      expect(review_response_map.questionnaire.id).to eq(1)&lt;br /&gt;
    end&lt;br /&gt;
  end &amp;lt;/pre&amp;gt;&lt;br /&gt;
The following tests the export fields method&lt;br /&gt;
&amp;lt;pre&amp;gt; describe '.export_fields' do&lt;br /&gt;
    it 'returns list of strings &amp;quot;contributor&amp;quot; and &amp;quot;reviewed by&amp;quot;' do&lt;br /&gt;
      expect(ReviewResponseMap.export_fields &amp;quot;&amp;quot;).to eq([&amp;quot;contributor&amp;quot;, &amp;quot;reviewed by&amp;quot;])&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following tests the delete method&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#delete' do&lt;br /&gt;
    it 'deletes the review response map' do&lt;br /&gt;
      allow(review_response_map.response).to receive(:response_id).and_return(1)&lt;br /&gt;
      allow(FeedbackResponseMap).to receive(:where).with(reviewed_object_id: 1).and_return([feedback_response_map])&lt;br /&gt;
      allow(feedback_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(MetareviewResponseMap).to receive(:where).with(reviewed_object_id: review_response_map.id).and_return([meta_review_response_map])&lt;br /&gt;
      allow(meta_review_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(review_response_map).to receive(:destroy).and_return(true)&lt;br /&gt;
      expect(review_response_map.delete).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The folowing code tests the get responses for team round method&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '.get_responses_for_team_round' do&lt;br /&gt;
    context 'when team doesnt exist' do&lt;br /&gt;
      it 'returns empty response' do&lt;br /&gt;
        team = instance_double('AssignmentTeam').as_null_object&lt;br /&gt;
        allow(team).to receive(:id).and_return(false)&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round team, 1).to eql([])&lt;br /&gt;
      end&lt;br /&gt;
    end &lt;br /&gt;
     context 'when team exists' do&lt;br /&gt;
      it 'returns the responses for particular round' do&lt;br /&gt;
        team = instance_double('AssignmentTeam', :id=&amp;gt;1)&lt;br /&gt;
        round = 1&lt;br /&gt;
        allow(ResponseMap).to receive(:where).with(reviewee_id: 1, type: &amp;quot;ReviewResponseMap&amp;quot;).and_return([response_map, response_map2])&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round(team, round).length).to eql(2)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following code tests the show feedback method&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#show_feedback' do&lt;br /&gt;
    context 'when no response is present or response is nil' do&lt;br /&gt;
      it 'returns nil' do&lt;br /&gt;
        db1 = instance_double(&amp;quot;Response&amp;quot;).as_null_object&lt;br /&gt;
        expect(review_response_map.show_feedback db1).to be(nil)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssaluja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=118951</id>
		<title>E1850 Write unit tests for review response map</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=118951"/>
		<updated>2018-11-09T02:06:48Z</updated>

		<summary type="html">&lt;p&gt;Ssaluja: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
It is an open source software created by North Carolina State University's students. It works on ruby on rails framework. This platform allows instructor to post notification about tests and assignments and also allows students to view grades, submit assignments, find teammates etc.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
1.Create a new file named review_response_map_spec.rb under spec/models folder&amp;lt;br&amp;gt;&lt;br /&gt;
2.Write RSpec unit tests to make the path coverage above 90%.&amp;lt;br&amp;gt;&lt;br /&gt;
3.Coverage as many edge cases as you can.&amp;lt;br&amp;gt;&lt;br /&gt;
4.Achieve as high branch coverage as you can. We will use the mutant-rspec gem to measure test thoroughness and fault-finding capability of your tests.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
The following test checks if the title is correct or not.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#get_title' do&lt;br /&gt;
    it 'returns the title' do&lt;br /&gt;
      expect(review_response_map.get_title).to eql(&amp;quot;Review&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following tests the questionnaire method&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#questionnaire' do&lt;br /&gt;
    it 'returns questionnaire' do&lt;br /&gt;
      allow(assignment).to receive(:review_questionnaire_id).and_return(1)&lt;br /&gt;
      allow(Questionnaire).to receive(:find_by).with(id: 1).and_return(questionnaire)&lt;br /&gt;
      expect(review_response_map.questionnaire.id).to eq(1)&lt;br /&gt;
    end&lt;br /&gt;
  end &amp;lt;/pre&amp;gt;&lt;br /&gt;
The following tests the export fields method&lt;br /&gt;
&amp;lt;pre&amp;gt; describe '.export_fields' do&lt;br /&gt;
    it 'returns list of strings &amp;quot;contributor&amp;quot; and &amp;quot;reviewed by&amp;quot;' do&lt;br /&gt;
      expect(ReviewResponseMap.export_fields &amp;quot;&amp;quot;).to eq([&amp;quot;contributor&amp;quot;, &amp;quot;reviewed by&amp;quot;])&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following tests the delete method&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#delete' do&lt;br /&gt;
    it 'deletes the review response map' do&lt;br /&gt;
      allow(review_response_map.response).to receive(:response_id).and_return(1)&lt;br /&gt;
      allow(FeedbackResponseMap).to receive(:where).with(reviewed_object_id: 1).and_return([feedback_response_map])&lt;br /&gt;
      allow(feedback_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(MetareviewResponseMap).to receive(:where).with(reviewed_object_id: review_response_map.id).and_return([meta_review_response_map])&lt;br /&gt;
      allow(meta_review_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(review_response_map).to receive(:destroy).and_return(true)&lt;br /&gt;
      expect(review_response_map.delete).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The folowing code tests the get responses for team round method&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '.get_responses_for_team_round' do&lt;br /&gt;
    context 'when team doesnt exist' do&lt;br /&gt;
      it 'returns empty response' do&lt;br /&gt;
        team = instance_double('AssignmentTeam').as_null_object&lt;br /&gt;
        allow(team).to receive(:id).and_return(false)&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round team, 1).to eql([])&lt;br /&gt;
      end&lt;br /&gt;
    end &lt;br /&gt;
     context 'when team exists' do&lt;br /&gt;
      it 'returns the responses for particular round' do&lt;br /&gt;
        team = instance_double('AssignmentTeam', :id=&amp;gt;1)&lt;br /&gt;
        round = 1&lt;br /&gt;
        allow(ResponseMap).to receive(:where).with(reviewee_id: 1, type: &amp;quot;ReviewResponseMap&amp;quot;).and_return([response_map, response_map2])&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round(team, round).length).to eql(2)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following code tests the show feedback method&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#show_feedback' do&lt;br /&gt;
    context 'when no response is present or response is nil' do&lt;br /&gt;
      it 'returns nil' do&lt;br /&gt;
        db1 = instance_double(&amp;quot;Response&amp;quot;).as_null_object&lt;br /&gt;
        expect(review_response_map.show_feedback db1).to be(nil)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssaluja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Talk:E1850_Write_unit_tests_for_review_response_map&amp;diff=118705</id>
		<title>Talk:E1850 Write unit tests for review response map</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Talk:E1850_Write_unit_tests_for_review_response_map&amp;diff=118705"/>
		<updated>2018-11-06T03:39:57Z</updated>

		<summary type="html">&lt;p&gt;Ssaluja: Blanked the page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ssaluja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=118704</id>
		<title>E1850 Write unit tests for review response map</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1850_Write_unit_tests_for_review_response_map&amp;diff=118704"/>
		<updated>2018-11-06T03:39:26Z</updated>

		<summary type="html">&lt;p&gt;Ssaluja: Created page with &amp;quot;&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;  ==Expertiza== It is an open source software created by North Carolina State University's students. It works on ruby on rails framework. This platform allows instructor t...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
It is an open source software created by North Carolina State University's students. It works on ruby on rails framework. This platform allows instructor to post notification about tests and assignments and also allows students to view grades, submit assignments, find teammates etc.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
1.Create a new file named review_response_map_spec.rb under spec/models folder&amp;lt;br&amp;gt;&lt;br /&gt;
2.Write RSpec unit tests to make the path coverage above 90%.&amp;lt;br&amp;gt;&lt;br /&gt;
3.Coverage as many edge cases as you can.&amp;lt;br&amp;gt;&lt;br /&gt;
4.Achieve as high branch coverage as you can. We will use the mutant-rspec gem to measure test thoroughness and fault-finding capability of your tests.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
The following test checks if the title is correct or not.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#get_title' do&lt;br /&gt;
    it 'returns the title' do&lt;br /&gt;
      expect(review_response_map.get_title).to eql(&amp;quot;Review&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following tests the questionnaire method&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#questionnaire' do&lt;br /&gt;
    it 'returns questionnaire' do&lt;br /&gt;
      allow(assignment).to receive(:review_questionnaire_id).and_return(1)&lt;br /&gt;
      allow(Questionnaire).to receive(:find_by).with(id: 1).and_return(questionnaire)&lt;br /&gt;
      expect(review_response_map.questionnaire.id).to eq(1)&lt;br /&gt;
    end&lt;br /&gt;
  end &amp;lt;/pre&amp;gt;&lt;br /&gt;
The following tests the export fields method&lt;br /&gt;
&amp;lt;pre&amp;gt; describe '.export_fields' do&lt;br /&gt;
    it 'returns list of strings &amp;quot;contributor&amp;quot; and &amp;quot;reviewed by&amp;quot;' do&lt;br /&gt;
      expect(ReviewResponseMap.export_fields &amp;quot;&amp;quot;).to eq([&amp;quot;contributor&amp;quot;, &amp;quot;reviewed by&amp;quot;])&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following tests the delete method&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#delete' do&lt;br /&gt;
    it 'deletes the review response map' do&lt;br /&gt;
      allow(review_response_map.response).to receive(:response_id).and_return(1)&lt;br /&gt;
      allow(FeedbackResponseMap).to receive(:where).with(reviewed_object_id: 1).and_return([feedback_response_map])&lt;br /&gt;
      allow(feedback_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(MetareviewResponseMap).to receive(:where).with(reviewed_object_id: review_response_map.id).and_return([meta_review_response_map])&lt;br /&gt;
      allow(meta_review_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(review_response_map).to receive(:destroy).and_return(true)&lt;br /&gt;
      expect(review_response_map.delete).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The folowing code tests the get responses for team round method&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '.get_responses_for_team_round' do&lt;br /&gt;
    context 'when team doesnt exist' do&lt;br /&gt;
      it 'returns empty response' do&lt;br /&gt;
        team = instance_double('AssignmentTeam').as_null_object&lt;br /&gt;
        allow(team).to receive(:id).and_return(false)&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round team, 1).to eql([])&lt;br /&gt;
      end&lt;br /&gt;
    end &lt;br /&gt;
     context 'when team exists' do&lt;br /&gt;
      it 'returns the responses for particular round' do&lt;br /&gt;
        team = instance_double('AssignmentTeam', :id=&amp;gt;1)&lt;br /&gt;
        round = 1&lt;br /&gt;
        allow(ResponseMap).to receive(:where).with(reviewee_id: 1, type: &amp;quot;ReviewResponseMap&amp;quot;).and_return([response_map, response_map2])&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round(team, round).length).to eql(2)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following code tests the show feedback method&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#show_feedback' do&lt;br /&gt;
    context 'when no response is present or response is nil' do&lt;br /&gt;
      it 'returns nil' do&lt;br /&gt;
        db1 = instance_double(&amp;quot;Response&amp;quot;).as_null_object&lt;br /&gt;
        expect(review_response_map.show_feedback db1).to be(nil)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssaluja</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Talk:E1850_Write_unit_tests_for_review_response_map&amp;diff=118703</id>
		<title>Talk:E1850 Write unit tests for review response map</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Talk:E1850_Write_unit_tests_for_review_response_map&amp;diff=118703"/>
		<updated>2018-11-06T03:33:49Z</updated>

		<summary type="html">&lt;p&gt;Ssaluja: Created page with &amp;quot;&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;  ==Expertiza== It is an open source software created by North Carolina State University's students. It works on ruby on rails framework. This platform allows instructor t...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Expertiza==&lt;br /&gt;
It is an open source software created by North Carolina State University's students. It works on ruby on rails framework. This platform allows instructor to post notification about tests and assignments and also allows students to view grades, submit assignments, find teammates etc.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
1.Create a new file named review_response_map_spec.rb under spec/models folder&amp;lt;br&amp;gt;&lt;br /&gt;
2.Write RSpec unit tests to make the path coverage above 90%.&amp;lt;br&amp;gt;&lt;br /&gt;
3.Coverage as many edge cases as you can.&amp;lt;br&amp;gt;&lt;br /&gt;
4.Achieve as high branch coverage as you can. We will use the mutant-rspec gem to measure test thoroughness and fault-finding capability of your tests.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Current Implementation==&lt;br /&gt;
The following test checks if the title is correct or not.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#get_title' do&lt;br /&gt;
    it 'returns the title' do&lt;br /&gt;
      expect(review_response_map.get_title).to eql(&amp;quot;Review&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following tests the questionnaire method&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#questionnaire' do&lt;br /&gt;
    it 'returns questionnaire' do&lt;br /&gt;
      allow(assignment).to receive(:review_questionnaire_id).and_return(1)&lt;br /&gt;
      allow(Questionnaire).to receive(:find_by).with(id: 1).and_return(questionnaire)&lt;br /&gt;
      expect(review_response_map.questionnaire.id).to eq(1)&lt;br /&gt;
    end&lt;br /&gt;
  end &amp;lt;/pre&amp;gt;&lt;br /&gt;
The following tests the export fields method&lt;br /&gt;
&amp;lt;pre&amp;gt; describe '.export_fields' do&lt;br /&gt;
    it 'returns list of strings &amp;quot;contributor&amp;quot; and &amp;quot;reviewed by&amp;quot;' do&lt;br /&gt;
      expect(ReviewResponseMap.export_fields &amp;quot;&amp;quot;).to eq([&amp;quot;contributor&amp;quot;, &amp;quot;reviewed by&amp;quot;])&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following tests the delete method&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#delete' do&lt;br /&gt;
    it 'deletes the review response map' do&lt;br /&gt;
      allow(review_response_map.response).to receive(:response_id).and_return(1)&lt;br /&gt;
      allow(FeedbackResponseMap).to receive(:where).with(reviewed_object_id: 1).and_return([feedback_response_map])&lt;br /&gt;
      allow(feedback_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(MetareviewResponseMap).to receive(:where).with(reviewed_object_id: review_response_map.id).and_return([meta_review_response_map])&lt;br /&gt;
      allow(meta_review_response_map).to receive(:delete).with(nil).and_return(true)&lt;br /&gt;
      allow(review_response_map).to receive(:destroy).and_return(true)&lt;br /&gt;
      expect(review_response_map.delete).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The folowing code tests the get responses for team round method&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '.get_responses_for_team_round' do&lt;br /&gt;
    context 'when team doesnt exist' do&lt;br /&gt;
      it 'returns empty response' do&lt;br /&gt;
        team = instance_double('AssignmentTeam').as_null_object&lt;br /&gt;
        allow(team).to receive(:id).and_return(false)&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round team, 1).to eql([])&lt;br /&gt;
      end&lt;br /&gt;
    end &lt;br /&gt;
     context 'when team exists' do&lt;br /&gt;
      it 'returns the responses for particular round' do&lt;br /&gt;
        team = instance_double('AssignmentTeam', :id=&amp;gt;1)&lt;br /&gt;
        round = 1&lt;br /&gt;
        allow(ResponseMap).to receive(:where).with(reviewee_id: 1, type: &amp;quot;ReviewResponseMap&amp;quot;).and_return([response_map, response_map2])&lt;br /&gt;
        expect(ReviewResponseMap.get_responses_for_team_round(team, round).length).to eql(2)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following code tests the show feedback method&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#show_feedback' do&lt;br /&gt;
    context 'when no response is present or response is nil' do&lt;br /&gt;
      it 'returns nil' do&lt;br /&gt;
        db1 = instance_double(&amp;quot;Response&amp;quot;).as_null_object&lt;br /&gt;
        expect(review_response_map.show_feedback db1).to be(nil)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ssaluja</name></author>
	</entry>
</feed>