CSC/ECE 517 Fall 2018/E1852 Unit Test for Participant Model: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 31: Line 31:
  describe '#responses' do
  describe '#responses' do
     it 'returns an array of responses of the participant' do
     it 'returns an array of responses of the participant' do
      puts participant.response_maps
       expect(participant.responses).to eql([])
       expect(participant.responses).to eql([])
     end
     end
Line 37: Line 36:
</pre>
</pre>


 
The above test will test a participant with no corresponding mapping. Hence the result of the responses provided by the participant is a nil list
 


'''Test name'''
'''Test name'''

Revision as of 21:00, 2 November 2018

Test Cases

TASKS IDENTIFIED

Test team

A Participant can be a member of a Team. When team method is called on a Participant, it should return the Team it belongs to.

describe "#team" do
  it "returns the team id for the user" do
    expect(participant.team).to eq(nil)
  end   
end

Test responses

   def responses
    response_maps.map(&:response)
   end


A Participant has many ResponseMaps that map a connection between this participant as a reviewer and as a reviewee. Each ResponseMap has many Responses associated with it. When responses method is called on a Participant, it should return an array of responses associated to this Participant.

 describe '#responses' do
     it 'returns an array of responses of the participant' do
       expect(participant.responses).to eql([])
     end
end

The above test will test a participant with no corresponding mapping. Hence the result of the responses provided by the participant is a nil list

Test name

A Participant is a User. When name method is called on a Participant, it should return the name of this User. Link title

Test fullname

A Participant is a User. When fullname method is called on a Participant, it should return the full name of this User.

Test handle

Test delete

Test force_delete

Test topic_name

Test able_to_review

When able_to_review method is called on a Participant, it should return true if it can review and false otherwise.

Test email

Test scores

When scores method is called on a Participant, it should return the total scores it received for a given number of questions.

Test get_permissions

Test get_authorization

Test sort_by_name

Participants are Users. When self.sort_by_name method is called on a Participant, it should sort a given set of participants based on their usernames.