CSC/ECE 517 Fall 2018/E1849 Write Unit Tests for vm question response.rb: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
 
(9 intermediate revisions by 2 users not shown)
Line 33: Line 33:
   
   
1) Test initialize
1) Test initialize
1.1) in the context when VMQuestionResponse is initialized with a review questionnaire
 
1.2) in the context when VMQuestionResponse is initialized with any other questionnaire type
* in the context when VMQuestionResponse is initialized with a review questionnaire
 
* in the context when VMQuestionResponse is initialized with any other questionnaire type
 
2) Test add questions
2) Test add questions
2.1) in the context when VMQuestionResponse is given a list of questions
 
* in the context when VMQuestionResponse is given a list of questions
 
3) Test  add_reviews  
3) Test  add_reviews  
3.1) in the context when VMQuestionResponse is initialized with a review questionnaire
 
3.2) in the context when VMQuestionResponse is initialized with a author feedback questionnaire
* in the context when VMQuestionResponse is initialized with a review questionnaire
3.3) in the context when VMQuestionResponse is initialized with a teammate review questionnaire
 
3.4) in the context when VMQuestionResponse is initialized with a metareview questionnaire
* in the context when VMQuestionResponse is initialized with a author feedback questionnaire
 
* in the context when VMQuestionResponse is initialized with a teammate review questionnaire
 
* in the context when VMQuestionResponse is initialized with a metareview questionnaire
 
4) Test display_team_members
4) Test display_team_members
5) Test add_team_members
5) Test add_team_members
6) Test listofteamparticipants
6) Test listofteamparticipants
7) Test max_score_for_questionnaire
7) Test max_score_for_questionnaire
8) Test add_answer
8) Test add_answer
9) Test get_number_of_comments_greater_than_10_words
9) Test get_number_of_comments_greater_than_10_words


== Testing Implementation ==
== Testing Implementation ==


*''initialize'' : This tests that the VmQuestionResponse is initialized with the appropriate round number.
<pre>
describe '#initialize' do
    context 'when intitialized with a review questionnaire' do
      let(:response) { VmQuestionResponse.new(review_questionnaire, assignment, 1) }
      it 'initializes the instance variables' do
        expect(response.round).to eq 1
        expect(response.questionnaire_type).to eq "ReviewQuestionnaire"
        expect(response.rounds).to eq 2
      end
    end
    context 'when intitialized with any other questionnaire type' do
      let(:response) { VmQuestionResponse.new(metareview_questionnaire, assignment, 1) }
      it 'initializes the instance variables' do
        expect(response.round).to eq 1
        expect(response.questionnaire_type).to eq "MetareviewQuestionnaire"
        expect(response.rounds).to eq 2
      end
    end
  end
</pre>


    it 'adds reviews' do
*''add_questions'': This tests that the VmQuestionResponse adds questions from a given review
<pre>
      allow(ReviewResponseMap).to receive_messages(:get_assessments_for => [review], :find => mapping)
  describe '#add_questions' do
    let(:response) { VmQuestionResponse.new(review_questionnaire, assignment, 1) }
      allow(Participant).to receive_messages(:find => ppnt1)
    it 'adds questions' do
       response.add_questions questions
       vm_rsp.add_reviews(ppnt0, team, false)
       expect(response.max_score).to eq 5
       expect(response.list_of_rows.size).to eq 1
       expect(vm_rsp.list_of_reviews.size).to eq 1
       expect(response.max_score_for_questionnaire()).to eq questions.size * review_questionnaire.max_question_score
       expect(vm_rsp.list_of_reviewers.size).to eq 1
       expect(vm_rsp.list_of_reviews).to eq [review]
     end
     end
  end
</pre>


This code tests that the add_reviews method works when VMQuestionResponse has been initialized with @questionnaire_type = "ReviewQuestionnaire"
*''add_reviews'' : This tests that the VmQuestionResponse adds reviews and reviewers from a given review
 
<pre>
 
  describe '#add_reviews' do
     context 'when given a team' do
     context 'when initialized with a review questionnaire' do
      let(:response) { VmQuestionResponse.new(review_questionnaire, assignment, 1) }
       it 'displays the members of the team' do
       it 'adds reviews' do
        allow(ReviewResponseMap).to receive_messages(:get_assessments_for => [review], :find => mapping)
         team = double('team')
         allow(Participant).to receive_messages(:find => participant1)
        response.add_reviews(participant0, team, false)
         ppnt2 = double('ppnt2')
        expect(response.list_of_reviews.size).to eq 1
        expect(response.list_of_reviewers.size).to eq 1
         allow(ppnt2).to receive_messages :fullname => 'R'
         expect(response.list_of_reviews).to eq [review]
      end
         team_member_names = [ppnt0, ppnt1, ppnt2]
    end
    context 'when initialized with a author feedback questionnaire' do
         allow(team).to receive_messages(:participants => team_member_names)
      let(:response) { VmQuestionResponse.new(author_feedback_questionnaire, assignment, 1) }
      it 'adds reviews' do
         out = 'Team members:'
         allow(FeedbackResponseMap).to receive_messages(:where => mapping)
        allow(Participant).to receive_messages(:find => participant1)
         vm_rsp.add_team_members(team)
        response.add_reviews(participant0, team, false)
        expect(response.list_of_reviews.size).to eq 1
         team.participants.each do |participant|
        expect(response.list_of_reviewers.size).to eq 1
         expect(response.list_of_reviews).to eq [review]
          out = out + " (" + participant.fullname + ") "
      end
    end
        end
    context 'when initialized with a teammate review questionnaire' do
      let(:response) { VmQuestionResponse.new(teammate_review_questionnaire, assignment, 1) }
         expect(vm_rsp.display_team_members).to eq out
      it 'adds reviews' do
         allow(TeammateReviewResponseMap).to receive_messages(:where => mapping)
         allow(Participant).to receive_messages(:find => participant1)
         response.add_reviews(participant0, team, false)
         expect(response.list_of_reviews.size).to eq 1
        expect(response.list_of_reviewers.size).to eq 1
         expect(response.list_of_reviews).to eq [review]
       end
       end
     end
     end
 
     context 'when initialized with a meta review type' do
This code tests that when VMQuestionResponse is initialized with a team the team members can be displayed
       let(:response) { VmQuestionResponse.new(metareview_questionnaire, assignment, 1) }
 
       it 'adds reviews' do
 
        allow(MetareviewResponseMap).to receive_messages(:where => mapping)
     context 'when given a list of valid questions' do
         allow(Participant).to receive_messages(:find => participant1)
        response.add_reviews(participant0, team, false)
       let(:qs) { qs = Array.new(1) { question2 } }
         expect(response.list_of_reviews.size).to eq 1
         expect(response.list_of_reviewers.size).to eq 1
       it 'can calculate the max score for the questionnaire' do
         expect(response.list_of_reviews).to eq [review]
         vm_rsp.add_questions qs
         expect(vm_rsp.max_score).to eq 5
         expect(vm_rsp.list_of_rows.size).to eq 1
         expect(vm_rsp.max_score_for_questionnaire()).to eq qs.size * rq.max_question_score
       end
       end
     end
     end
  end
</pre>


This code tests VMQuestionResponse knows the max score for the questionnaire.


 
*''display_team_members'' : This tests that the VmQuestionResponse can print out the appropriate team member names.
     it 'has the round value of the given questionnaire' do
<pre>
  describe '#display_team_members' do
       expect(vm_rsp.round).to eq 1
    let(:response) { VmQuestionResponse.new(review_questionnaire, assignment, 1) }
     it 'displays the members of the team' do
      team = double('team')
      participant2 = double('participant2')
      allow(participant2).to receive_messages :fullname => 'R'
      team_member_names = [participant0, participant1, participant2]
      allow(team).to receive_messages(:participants => team_member_names)
      out = 'Team members:'
      response.add_team_members(team)
      team.participants.each do |participant|
        out = out + " (" + participant.fullname + ") "
      end
       expect(response.display_team_members).to eq out
     end
     end
 
  end
This code checks that VMQuestionResponse knows the value of @round for the given questionnaire.
</pre>




  context 'is initialized with an AuthorFeedbackQuestionnaire' do
*''add_answer'' : This tests that the VmQuestionResponse adds all of the review scores from its reviews to VmQuestionResponseCells in VmQuestionResponseRows.
<pre>
    [mock setup omitted for brevity]
  describe '#add_answer' do
    let(:response) { VmQuestionResponse.new(author_feedback_questionnaire, assignment, 1 ) }
    it 'adds reviews' do
    let(:tag_dep) do
       tag_dep = double('tag_dep')
      # review = double('review1')
       allow(tag_dep).to receive_messages(:question_type => question.type,
                                        :answer_length_threshold => 4,
      # review.stub(:map_id => 1, :response_id => 1)
                                        :tag_prompt_id => 1)
       tag_dep
      # allow(review).to receive_messages(:map_id => 1)
      # ppnt0 = double('ppnt0')
      # allow(ppnt0).to receive_messages(:feedback => [review])
       # ppnt1 = double('ppnt1')
       # allow(ppnt1).to receive_messages(:fullname => 'Python')
      # mapping = double
      # allow(mapping).to receive_messages(:first => mapping, :reviewer_id => 2)
      # allow(FeedbackResponseMap).to receive_messages(:where => mapping)
      # allow(Participant).to receive_messages(:find => ppnt1)
      # vm_rsp.add_questions qs
      # vm_rsp.add_reviews(ppnt0, '', false)
      # expect(vm_rsp.list_of_reviews.size).to eq 1
      # expect(vm_rsp.list_of_reviewers.size).to eq 1
       # expect(vm_rsp.list_of_reviews).to eq [ppnt1]
     end
     end
     it 'adds an answer' do
     it 'adds answers' do
       allow(FeedbackResponseMap).to receive_messages(:where => mapping)
       allow(FeedbackResponseMap).to receive_messages(:where => mapping)
       allow(Participant).to receive_messages(:find => participant1)
       allow(Participant).to receive_messages(:find => ppnt1)
       allow(Answer).to receive_messages(:where => [answer])
       allow(Answer).to receive_messages(:where => [ans])
       allow(TagPromptDeployment).to receive_messages(:where => [tag_dep])
       allow(TagPromptDeployment).to receive_messages(:where => [tag_dep])
       allow(Question).to receive_messages(:find => question)
       allow(Question).to receive_messages(:find => question2)
       allow(TagPrompt).to receive_messages(:find => true)
       allow(TagPrompt).to receive_messages(:find => true)
       allow(VmTagPromptAnswer).to receive_messages(:new => '')
       allow(VmTagPromptAnswer).to receive_messages(:new => '')
       allow(VmQuestionResponseScoreCell).to receive_messages(:new => '')
       allow(VmQuestionResponseScoreCell).to receive_messages(:new => '')
 
       vm_rsp.add_questions qs
       response.add_questions questions
       response.add_reviews(participant0, '', false)
       vm_rsp.add_reviews(ppnt0, '', false)
     end
     end
  end
     it 'gets the number of comments greater than 10 words' do
</pre>
 
 
 
*''get_number_of_comments_greater_than_10_words'' : This tests that VmQuestionResponse only finds comments that have at least 10 words.
<pre>
  describe '#get_number_of_comments_greater_than_10_words' do
    let(:response) { VmQuestionResponse.new(author_feedback_questionnaire, assignment, 1 ) }
    let(:tag_dep) do
      tag_dep = double('tag_dep')
      allow(tag_dep).to receive_messages(:question_type => question.type,
                                        :answer_length_threshold => 4,
                                        :tag_prompt_id => 1)
      tag_dep
    end
     it 'returns number of comments greater than 10 words' do
       allow(FeedbackResponseMap).to receive_messages(:where => mapping)
       allow(FeedbackResponseMap).to receive_messages(:where => mapping)
       allow(Participant).to receive_messages(:find => participant1)
       allow(Participant).to receive_messages(:find => ppnt1)
       allow(Answer).to receive_messages(:where => [answer])
       allow(Answer).to receive_messages(:where => [ans])
       allow(TagPromptDeployment).to receive_messages(:where => [tag_dep])
       allow(TagPromptDeployment).to receive_messages(:where => [tag_dep])
       allow(Question).to receive_messages(:find => question)
       allow(Question).to receive_messages(:find => question2)
       allow(TagPrompt).to receive_messages(:find => true)
       allow(TagPrompt).to receive_messages(:find => true)
       allow(VmTagPromptAnswer).to receive_messages(:new => '')
       allow(VmTagPromptAnswer).to receive_messages(:new => '')
       allow(VmQuestionResponseScoreCell).to receive_messages(:new => '')
       allow(VmQuestionResponseScoreCell).to receive_messages(:new => '')
        
        
       row = double('row')
       row = double('row')
       allow(row).to receive_messages(:countofcomments => 7, :question_id => 2,
       allow(row).to receive_messages(:countofcomments => 7, :question_id => 2,
         :question_max_score => 5, :score_row => [3])
         :question_max_score => 5, :score_row => [3])
       allow(VmQuestionResponseRow).to receive_messages(:new => row)
       allow(VmQuestionResponseRow).to receive_messages(:new => row)
      vm_rsp.add_questions qs
      vm_rsp.add_reviews(ppnt0, '', false)
      expect(vm_rsp.list_of_rows.size).to eq 1
      vm_rsp.get_number_of_comments_greater_than_10_words
      expect(vm_rsp.list_of_rows[0].countofcomments).to eq 7
    end
  end


The above tests cover the scenario in which VMQuestionResponse is initialized with @questionnaire_type = "AuthorFeedbackQuestionnaire". We check that VMQuestionResponse can add revews, add answers, and retrieve the number of comments greater than 10 words in length. Here the test for add_reviews is commented out because it is still being developed.
       response.add_questions questions
 
       response.add_reviews(participant0, '', false)
 
       expect(response.list_of_rows.size).to eq 1
  context 'is initialized with an TeammateReviewQuestionnaire' do
       response.get_number_of_comments_greater_than_10_words
       expect(response.list_of_rows[0].countofcomments).to eq 7
    let(:tmrq) { create(:questionnaire, name: "TeammateReviewQuestionnaire",
                        type: 'TeammateReviewQuestionnaire') }
    let(:vm_rsp) { VmQuestionResponse.new( tmrq, assignment, 1 ) }
    let(:question2) { create(:question, questionnaire: tmrq, weight: 2, id: 2, type: 'good') }
    let(:qs) { qs = Array.new(1) { question2 } }
    it 'adds reviews' do
      allow(TeammateReviewResponseMap).to receive_messages(:where => mapping)
      allow(Participant).to receive_messages(:find => ppnt1)
       vm_rsp.add_questions qs
       vm_rsp.add_reviews(ppnt0, '', false)
       expect(vm_rsp.list_of_reviews.size).to eq 1
       expect(vm_rsp.list_of_reviewers.size).to eq 1
       expect(vm_rsp.list_of_reviews).to eq [review]
     end
     end
end
  end
</pre>
 
This code checks that we can add reviews when VMQuestionResponse is initialized with @questionnaire_type = "TeammateReviewQuestionnaire".
 
 
  context 'is initialized with an MetareviewQuestionnaire' do
    let(:mrq) { create(:questionnaire, name: "MetareviewQuestionnaire", type: 'MetareviewQuestionnaire') }
    let(:question2) { create(:question, questionnaire: mrq, weight: 2, id: 2, type: 'good') }
    let(:qs) { qs = Array.new(1) { question2 } }
    let(:vm_rsp) { VmQuestionResponse.new( mrq, assignment, 1 ) }
    it 'adds reviews' do
      allow(MetareviewResponseMap).to receive_messages(:where => mapping)
      allow(Participant).to receive_messages(:find => ppnt1)
      vm_rsp.add_questions qs
      vm_rsp.add_reviews(ppnt0, '', false)
      expect(vm_rsp.list_of_reviews.size).to eq 1
      expect(vm_rsp.list_of_reviewers.size).to eq 1
      expect(vm_rsp.list_of_reviews).to eq [review]
    end
  end
 
This code checks that we can add reviews when VMQuestionResponse is initialized with @questionnaire_type = "MetaReviewQuestionnaire".


== Results ==
== Results ==


We have now attained 91% coverage.
We have now attained 97.25% coverage.


== Links/Resources ==
== Links/Resources ==


[https://github.com/mfleader42/expertiza/blob/master/spec/models/vm_question_response_spec.rb spec/models/vm_question_response_spec.rb]
[https://github.com/mfleader42/expertiza/blob/master/spec/models/vm_question_response_spec.rb spec/models/vm_question_response_spec.rb]
[https://youtu.be/yDfhSqVOoOk Testing Video(YouTube)]

Latest revision as of 04:50, 10 November 2018

Introduction

VMQuestionResponse in Brief

This class acquires reviews from a given questionnaire and assignment, and creates a heat map visualization of the review scores a reviewee received from other people (reviewers) for an assignment.


Objective

There are currently no test cases for vm_question_response.rb. We seek to create unit tests to attain at least 90% coverage by line.

Team

Matt Leader (mfleader@ncsu.edu)

Jonathan Gill (jtgill@ncsu.edu)

Files Involved

app/models/vm_question_response.rb

spec/models/vm_question_response_spec.rb

Testing Plan

Testing Strategy: Unit Test

Testing VMQuestionResponse hinges upon collaboration verification, so that we know VMQuestionResponse is getting the right messages from the right classes, so that it can appropriately create its data structures.

We first went through each method of the VMQuestionResponse class and determined whether the method was a command, or query and whether the method was incoming, outgoing, or sent-to-self. For each method we will write tests for valid and invalid inputs as well as edge cases.

Here is an outline of our implementation strategy:

To describe VMQuestionResponse

1) Test initialize

  • in the context when VMQuestionResponse is initialized with a review questionnaire
  • in the context when VMQuestionResponse is initialized with any other questionnaire type

2) Test add questions

  • in the context when VMQuestionResponse is given a list of questions

3) Test add_reviews

  • in the context when VMQuestionResponse is initialized with a review questionnaire
  • in the context when VMQuestionResponse is initialized with a author feedback questionnaire
  • in the context when VMQuestionResponse is initialized with a teammate review questionnaire
  • in the context when VMQuestionResponse is initialized with a metareview questionnaire

4) Test display_team_members

5) Test add_team_members

6) Test listofteamparticipants

7) Test max_score_for_questionnaire

8) Test add_answer

9) Test get_number_of_comments_greater_than_10_words

Testing Implementation

  • initialize : This tests that the VmQuestionResponse is initialized with the appropriate round number.
 describe '#initialize' do
    context 'when intitialized with a review questionnaire' do
      let(:response) { VmQuestionResponse.new(review_questionnaire, assignment, 1) }
      it 'initializes the instance variables' do
        expect(response.round).to eq 1
        expect(response.questionnaire_type).to eq "ReviewQuestionnaire"
        expect(response.rounds).to eq 2
      end
    end
    context 'when intitialized with any other questionnaire type' do
      let(:response) { VmQuestionResponse.new(metareview_questionnaire, assignment, 1) }
      it 'initializes the instance variables' do
        expect(response.round).to eq 1
        expect(response.questionnaire_type).to eq "MetareviewQuestionnaire"
        expect(response.rounds).to eq 2
      end
    end
  end
  • add_questions: This tests that the VmQuestionResponse adds questions from a given review
  describe '#add_questions' do
    let(:response) { VmQuestionResponse.new(review_questionnaire, assignment, 1) }
    it 'adds questions' do
      response.add_questions questions
      expect(response.max_score).to eq 5
      expect(response.list_of_rows.size).to eq 1
      expect(response.max_score_for_questionnaire()).to eq questions.size * review_questionnaire.max_question_score
    end
  end
  • add_reviews : This tests that the VmQuestionResponse adds reviews and reviewers from a given review
  describe '#add_reviews' do
    context 'when initialized with a review questionnaire' do
      let(:response) { VmQuestionResponse.new(review_questionnaire, assignment, 1) }
      it 'adds reviews' do
        allow(ReviewResponseMap).to receive_messages(:get_assessments_for => [review], :find => mapping)
        allow(Participant).to receive_messages(:find => participant1)
        response.add_reviews(participant0, team, false)
        expect(response.list_of_reviews.size).to eq 1
        expect(response.list_of_reviewers.size).to eq 1
        expect(response.list_of_reviews).to eq [review]
      end
    end
    context 'when initialized with a author feedback questionnaire' do
      let(:response) { VmQuestionResponse.new(author_feedback_questionnaire, assignment, 1) }
      it 'adds reviews' do
        allow(FeedbackResponseMap).to receive_messages(:where => mapping)
        allow(Participant).to receive_messages(:find => participant1)
        response.add_reviews(participant0, team, false)
        expect(response.list_of_reviews.size).to eq 1
        expect(response.list_of_reviewers.size).to eq 1
        expect(response.list_of_reviews).to eq [review]
      end
    end
    context 'when initialized with a teammate review questionnaire' do
      let(:response) { VmQuestionResponse.new(teammate_review_questionnaire, assignment, 1) }
      it 'adds reviews' do
        allow(TeammateReviewResponseMap).to receive_messages(:where => mapping)
        allow(Participant).to receive_messages(:find => participant1)
        response.add_reviews(participant0, team, false)
        expect(response.list_of_reviews.size).to eq 1
        expect(response.list_of_reviewers.size).to eq 1
        expect(response.list_of_reviews).to eq [review]
      end
    end
    context 'when initialized with a meta review type' do
      let(:response) { VmQuestionResponse.new(metareview_questionnaire, assignment, 1) }
      it 'adds reviews' do
        allow(MetareviewResponseMap).to receive_messages(:where => mapping)
        allow(Participant).to receive_messages(:find => participant1)
        response.add_reviews(participant0, team, false)
        expect(response.list_of_reviews.size).to eq 1
        expect(response.list_of_reviewers.size).to eq 1
        expect(response.list_of_reviews).to eq [review]
      end
    end
  end


  • display_team_members : This tests that the VmQuestionResponse can print out the appropriate team member names.
  describe '#display_team_members' do
    let(:response) { VmQuestionResponse.new(review_questionnaire, assignment, 1) }
    it 'displays the members of the team' do
      team = double('team')
      participant2 = double('participant2')
      allow(participant2).to receive_messages :fullname => 'R'
      team_member_names = [participant0, participant1, participant2]
      allow(team).to receive_messages(:participants => team_member_names)
      out = 'Team members:'
      response.add_team_members(team)
      team.participants.each do |participant|
        out = out + " (" + participant.fullname + ") "
      end
      expect(response.display_team_members).to eq out
    end
  end


  • add_answer : This tests that the VmQuestionResponse adds all of the review scores from its reviews to VmQuestionResponseCells in VmQuestionResponseRows.
  describe '#add_answer' do
    let(:response) { VmQuestionResponse.new(author_feedback_questionnaire, assignment, 1 ) }
    let(:tag_dep) do
      tag_dep = double('tag_dep')
      allow(tag_dep).to receive_messages(:question_type => question.type,
                                         :answer_length_threshold => 4,
                                         :tag_prompt_id => 1)
      tag_dep
    end
    it 'adds an answer' do
      allow(FeedbackResponseMap).to receive_messages(:where => mapping)
      allow(Participant).to receive_messages(:find => participant1)
      allow(Answer).to receive_messages(:where => [answer])
      allow(TagPromptDeployment).to receive_messages(:where => [tag_dep])
      allow(Question).to receive_messages(:find => question)
      allow(TagPrompt).to receive_messages(:find => true)
      allow(VmTagPromptAnswer).to receive_messages(:new => '')
      allow(VmQuestionResponseScoreCell).to receive_messages(:new => '')

      response.add_questions questions
      response.add_reviews(participant0, '', false)
    end
  end


  • get_number_of_comments_greater_than_10_words : This tests that VmQuestionResponse only finds comments that have at least 10 words.
  describe '#get_number_of_comments_greater_than_10_words' do
    let(:response) { VmQuestionResponse.new(author_feedback_questionnaire, assignment, 1 ) }
    let(:tag_dep) do
      tag_dep = double('tag_dep')
      allow(tag_dep).to receive_messages(:question_type => question.type,
                                         :answer_length_threshold => 4,
                                         :tag_prompt_id => 1)
      tag_dep
    end
    it 'returns number of comments greater than 10 words' do
      allow(FeedbackResponseMap).to receive_messages(:where => mapping)
      allow(Participant).to receive_messages(:find => participant1)
      allow(Answer).to receive_messages(:where => [answer])
      allow(TagPromptDeployment).to receive_messages(:where => [tag_dep])
      allow(Question).to receive_messages(:find => question)
      allow(TagPrompt).to receive_messages(:find => true)
      allow(VmTagPromptAnswer).to receive_messages(:new => '')
      allow(VmQuestionResponseScoreCell).to receive_messages(:new => '')
      
      row = double('row')
      allow(row).to receive_messages(:countofcomments => 7, :question_id => 2,
        :question_max_score => 5, :score_row => [3])
      allow(VmQuestionResponseRow).to receive_messages(:new => row)

      response.add_questions questions
      response.add_reviews(participant0, '', false)
      expect(response.list_of_rows.size).to eq 1
      response.get_number_of_comments_greater_than_10_words
      expect(response.list_of_rows[0].countofcomments).to eq 7
    end
end

Results

We have now attained 97.25% coverage.

Links/Resources

spec/models/vm_question_response_spec.rb

Testing Video(YouTube)