expertiza/expertiza — pull request #142 by lnpat139 (2011-11-10 03:22:14+00:00)
Title: E203 Refactor assignment_participant (abalasu3, lpatil, dnyacha)

REFACTOR assignment_participant.rb
The following were the tasks performed as part of this project:
1) In this project we have a defined a new module called "Artifact".
The Artifact module holds all information regarding submission and retrieval of files and hyperlinks
The Artifact module is located under the lib folder.
The Artifact module contains the following methods after refactoring:
a) submit_hyperlink()
b) get_submitted_files()
c) submitted_hyperlinks=()
d) get_hyperlinks
e) get_hyperlinks_array
f) get_files()

2) Refactor the methods get_scores() to get_scores_given() and get_topic_string() to get_topic_name(), in order tomaintain the code conventions and avoid discrepnancies.

3) Modify the access of submitted_hyperlink() and submitted_file() methods to public and check if it causes any discrepnancies.
Test cases:
Since we defined a module and included this module in the assignment_participant we do not need to specify any new testcases , since thereare no new functionality is defined.
However since the methods are now called in a different way now , it is required to ensure that all the testcases are passedfrom the model.
For e.g: The model assignment_participant.rb does not contain any methods pertaining to submit_hyperlink.
However it is required that all the testcases pass, since the module Artifact is included in the model as a mixin.
This is checked.
In order to verify that the module is being mixed into the class we can remove the "include Artifact" statement from theasssignment_participant.rb class.
In this case, the following cases fail:
a) test_reject_empty_hyperlink
b) test_reject_remove_hyperlink
c) test_remove_one_hyperlink
d) test_remove_second_hyperlink
e) test_submit_first_hyperlink
f) test_submit_third_hyperlink

The rest of the testcases i.e test_import,test_publishing_rights, test_publishing_rights_negative_tests and regenerate_keys must pass.