<?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=Spotta</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=Spotta"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Spotta"/>
	<updated>2026-06-08T00:04:49Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1687_Instructor_account_creation_over_the_web&amp;diff=106540</id>
		<title>CSC/ECE 517 Fall 2016 E1687 Instructor account creation over the web</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1687_Instructor_account_creation_over_the_web&amp;diff=106540"/>
		<updated>2016-12-05T04:57:43Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Screencast */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1687. Instructor Account Creation Over the Web'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the final project of creating an instructor account over the web in Expertiza.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
In Expertiza, user and instructor accounts are currently created by existing super administrators, instructors or TAs. For new users to access the system and experiment the features offered by Expertiza, a “demo-like” feature needs to implemented. The following are the set of requirements that needs to be catered with this feature:&lt;br /&gt;
#Allow people to request instructor accounts over the web. This feature should also have security features such as Captchas to help avoid account creation by bots.&lt;br /&gt;
#When a user account is created over the web, the super-admin should get e-mail regarding the same and also the user should be notified upon approval/denial (if denied, then reason should be specified).&lt;br /&gt;
#Currently, Expertiza consists of a lot of entities that can be made publicly visible to all other users in the system. But, accounts created this way should not be able to see existing public features, until the super-admin manually gives them permission to view public courses, assignments, and questionnaires.&lt;br /&gt;
#A user who creates an account over the web should be pointed to an instruction page and/or video on how to create an assignment and register students for it, etc.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The following solutions shall be addressing the problems discussed above. &lt;br /&gt;
===Problem 1===&lt;br /&gt;
Once a user wants to register and try the features of Expertiza, upon opening the website, one can register by filling up the form and click the register button. There is a captcha that shall be shown below, to make sure that it isn't any bot that is accessing. It provides security to the application.&lt;br /&gt;
&lt;br /&gt;
===Problem 2===&lt;br /&gt;
Once the user requests for an account creation, the super admin receives a mail informing about the request with the name of the requested user. The super admin shall then, look for the details of the user in the Requests tab and can either approve/decline the request. Once the super admin approves the user request, the user gets a mail notifying the same. If the request is rejected, then the reason should be mentioned in the reason tab of the form. But there is no mail sent to the user regarding that.&lt;br /&gt;
&lt;br /&gt;
===Problem 3===&lt;br /&gt;
There shall be a flash message saying, “Login denied. Needs permission from super admin” that can be seen on the login page if an unregistered user tries to access the features of Expertiza.  This helps in removing the access to few publicly visible features as it denies access completely. &lt;br /&gt;
&lt;br /&gt;
===Problem 4===&lt;br /&gt;
Once the user account is approved by the super admin and the user tries to login upon notification, he/she shall be redirected to an “Instructions” page on successful login. &lt;br /&gt;
&lt;br /&gt;
This page shall contain the video tutorials explaining various features of Expertiza and also on how to access them.&lt;br /&gt;
&lt;br /&gt;
=='''Files changed'''==&lt;br /&gt;
The following are the list of files that were created/edited throughout the project.&lt;br /&gt;
* views/auth/_login.html.erb&lt;br /&gt;
* views/users/request_new.html.erb&lt;br /&gt;
* views/users/review.html&lt;br /&gt;
* views/instructions/home.html.erb&lt;br /&gt;
* views/users/edit.html.erb&lt;br /&gt;
* views/mailer/request_user_message.html.erb&lt;br /&gt;
* views/users/new.html.erb&lt;br /&gt;
* views/users/_password.html.erb&lt;br /&gt;
* views/users/_user.html.erb&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* routes.rb&lt;br /&gt;
* models&lt;br /&gt;
* mailer_helper.rb&lt;br /&gt;
* mailer.rb&lt;br /&gt;
* models/requested_user.rb&lt;br /&gt;
* config/initializers/recaptcha.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In '''_login.html.erb''' a new button called Request Sign Up was added for the new users to register. The register page will look as above. On clicking '''Request sign up''', a user will be redirected to a page like below: &lt;br /&gt;
&lt;br /&gt;
[[File:login_screen.png]]&lt;br /&gt;
&lt;br /&gt;
User will have to fill up all the required details and request a signup.&lt;br /&gt;
When a super administrator logins to his account he can go to '''Manage/users/review requested users''' menu as shown below&lt;br /&gt;
[[File:Approval_new2.png]]&lt;br /&gt;
&lt;br /&gt;
Super Admin can either approve/reject a user. The view for this page would be as shown below.&lt;br /&gt;
[[File:req_approval.png]]&lt;br /&gt;
&lt;br /&gt;
In addition to the above files a new file in instructions, named home.html.erb is created which will have all the videos explaining how Expertiza works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In '''users_controller.rb''' we will be having two new methods. One method (request_user_create) to the new user to request for an account in Expertiza and also mail all the super admins about the new user request. Other method (create_approved_user) is for the super admin to either approve or reject the user request and send a mail to the requested user if his/her account is created. The mail also contains a password for the user to login. &lt;br /&gt;
&lt;br /&gt;
The codes for each method are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def request_user_create&lt;br /&gt;
    @user = RequestedUser.new(user_params)&lt;br /&gt;
    @user.institution_id = params[:user][:institution_id]&lt;br /&gt;
    @user.status = 'Under Review'&lt;br /&gt;
    #The super admin receives a mail about a new user request with the user name&lt;br /&gt;
    if verify_recaptcha(model: @user) &amp;amp;&amp;amp; @user.save&lt;br /&gt;
      @super_users = User.joins(:role).where('roles.name' =&amp;gt;'Super-Administrator');&lt;br /&gt;
      @super_users.each do |super_user|&lt;br /&gt;
        prepared_mail = MailerHelper.send_mail_to_all_super_users(super_user,@user, &amp;quot;New account Request&amp;quot;)&lt;br /&gt;
        prepared_mail.deliver&lt;br /&gt;
      end&lt;br /&gt;
      flash[:success] = &amp;quot;User signup for \&amp;quot;#{@user.name}\&amp;quot; has been successfully requested. &amp;quot;&lt;br /&gt;
      redirect_to '/instructions/home'&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = &amp;quot;Error requesting sign up &amp;quot;&lt;br /&gt;
      redirect_to :controller =&amp;gt; 'users', :action =&amp;gt; 'request_new', :role=&amp;gt;&amp;quot;Student&amp;quot;   &lt;br /&gt;
    end&lt;br /&gt;
  end  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    @user = RequestedUser.find params[:id]&lt;br /&gt;
    @user.status=params[:status]&lt;br /&gt;
    @user.reason=params[:reason]&lt;br /&gt;
    if @user.status.nil?&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
    elsif @user.update_attributes(params[:user])&lt;br /&gt;
      flash[:success] = &amp;quot;The user \&amp;quot;#{@user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    if @user.status==&amp;quot;Approved&amp;quot;&lt;br /&gt;
      check = User.find_by_name(@user.name)&lt;br /&gt;
      @usernew = User.new()&lt;br /&gt;
      @usernew.name = @user.name&lt;br /&gt;
      @usernew.role_id = @user.role_id&lt;br /&gt;
      @usernew.institution_id = @user.institution_id&lt;br /&gt;
      @usernew.fullname = @user.fullname&lt;br /&gt;
      @usernew.email = @user.email&lt;br /&gt;
      # record the person who created this new user&lt;br /&gt;
      @usernew.parent_id = session[:user].id&lt;br /&gt;
      # set the user's timezone to its parent's&lt;br /&gt;
      @usernew.timezonepref = User.find(@usernew.parent_id).timezonepref&lt;br /&gt;
&lt;br /&gt;
      if @usernew.save&lt;br /&gt;
        password = @usernew.reset_password # the password is reset&lt;br /&gt;
        # Mail is sent to the user with a new password&lt;br /&gt;
        prepared_mail = MailerHelper.send_mail_to_user(@usernew, &amp;quot;Your Expertiza account and password &lt;br /&gt;
                                                            have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
        prepared_mail.deliver&lt;br /&gt;
        flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
        if @usernew.role.name == &amp;quot;Instructor&amp;quot; or @usernew.role.name == &amp;quot;Administrator&amp;quot;&lt;br /&gt;
          AssignmentQuestionnaire.create(user_id: @user.id)&lt;br /&gt;
        end&lt;br /&gt;
        undo_link(&amp;quot;The user \&amp;quot;#{@user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
      else&lt;br /&gt;
        foreign&lt;br /&gt;
      end&lt;br /&gt;
    else &lt;br /&gt;
      if @user.status==&amp;quot;Rejected&amp;quot;    &lt;br /&gt;
        #If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if @user.update_columns(reason: params[:reason], status: params[:status])&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{@user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          redirect_to action: 'review'&lt;br /&gt;
          return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'review'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Database Changes'''==&lt;br /&gt;
&lt;br /&gt;
We have created a new table called '''requested_users''' with table description that is similar to '''users'''. The status column, which isn't present in the users tables indicates the approval/rejection of the request of the user. The description of the table is as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Requested_user_db.png‎ ]]&lt;br /&gt;
&lt;br /&gt;
=='''Screencast'''==&lt;br /&gt;
&lt;br /&gt;
Screencast [https://youtu.be/Ro8YVQgdgIg link] to our demonstration&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
We will be testing each of the functionality separately.&lt;br /&gt;
&lt;br /&gt;
1. Test all views - will be testing if '''_login.html.erb''' and '''Request_new.html.erb''' are rendered properly.&lt;br /&gt;
&lt;br /&gt;
2. Test all controller methods. New test cases will be included for each case: &lt;br /&gt;
* Does '''create_approved_user''' actually create a new user&lt;br /&gt;
* Does '''request_user_create''' actually not create a new user request&lt;br /&gt;
&lt;br /&gt;
3. Test the model '''requested_user''' so that no invalid entries (blank email ID, blank name etc.) are accepted. &lt;br /&gt;
&lt;br /&gt;
4. Test the mailer to verify if the body, subject, the mail id sent to/from are correctly functioning.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1687_Instructor_account_creation_over_the_web&amp;diff=106502</id>
		<title>CSC/ECE 517 Fall 2016 E1687 Instructor account creation over the web</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1687_Instructor_account_creation_over_the_web&amp;diff=106502"/>
		<updated>2016-12-04T23:54:41Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Files changed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1687. Instructor Account Creation Over the Web'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the final project of creating an instructor account over the web in Expertiza.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
In Expertiza, user and instructor accounts are currently created by existing super administrators, instructors or TAs. For new users to access the system and experiment the features offered by Expertiza, a “demo-like” feature needs to implemented. The following are the set of requirements that needs to be catered with this feature:&lt;br /&gt;
#Allow people to request instructor accounts over the web. This feature should also have security features such as Captchas to help avoid account creation by bots.&lt;br /&gt;
#When a user account is created over the web, the super-admin should get e-mail regarding the same and also the user should be notified upon approval/denial (if denied, then reason should be specified).&lt;br /&gt;
#Currently, Expertiza consists of a lot of entities that can be made publicly visible to all other users in the system. But, accounts created this way should not be able to see existing public features, until the super-admin manually gives them permission to view public courses, assignments, and questionnaires.&lt;br /&gt;
#A user who creates an account over the web should be pointed to an instruction page and/or video on how to create an assignment and register students for it, etc.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The following solutions shall be addressing the problems discussed above. &lt;br /&gt;
===Problem 1===&lt;br /&gt;
Once a user wants to register and try the features of Expertiza, upon opening the website, one can register by filling up the form and click the register button. There is a captcha that shall be shown below, to make sure that it isn't any bot that is accessing. It provides security to the application.&lt;br /&gt;
&lt;br /&gt;
===Problem 2===&lt;br /&gt;
Once the user requests for an account creation, the super admin receives a mail informing about the request with the name of the requested user. The super admin shall then, look for the details of the user in the Requests tab and can either approve/decline the request. Once the super admin approves the user request, the user gets a mail notifying the same. If the request is rejected, then the reason should be mentioned in the reason tab of the form. But there is no mail sent to the user regarding that.&lt;br /&gt;
&lt;br /&gt;
===Problem 3===&lt;br /&gt;
There shall be a flash message saying, “Login denied. Needs permission from super admin” that can be seen on the login page if an unregistered user tries to access the features of Expertiza.  This helps in removing the access to few publicly visible features as it denies access completely. &lt;br /&gt;
&lt;br /&gt;
===Problem 4===&lt;br /&gt;
Once the user account is approved by the super admin and the user tries to login upon notification, he/she shall be redirected to an “Instructions” page on successful login. &lt;br /&gt;
&lt;br /&gt;
This page shall contain the video tutorials explaining various features of Expertiza and also on how to access them.&lt;br /&gt;
&lt;br /&gt;
=='''Files changed'''==&lt;br /&gt;
The following are the list of files that were created/edited throughout the project.&lt;br /&gt;
* views/auth/_login.html.erb&lt;br /&gt;
* views/users/request_new.html.erb&lt;br /&gt;
* views/users/review.html&lt;br /&gt;
* views/instructions/home.html.erb&lt;br /&gt;
* views/users/edit.html.erb&lt;br /&gt;
* views/mailer/request_user_message.html.erb&lt;br /&gt;
* views/users/new.html.erb&lt;br /&gt;
* views/users/_password.html.erb&lt;br /&gt;
* views/users/_user.html.erb&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* routes.rb&lt;br /&gt;
* models&lt;br /&gt;
* mailer_helper.rb&lt;br /&gt;
* mailer.rb&lt;br /&gt;
* models/requested_user.rb&lt;br /&gt;
* config/initializers/recaptcha.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In '''_login.html.erb''' a new button called Request Sign Up was added for the new users to register. The register page will look as above. On clicking '''Request sign up''', a user will be redirected to a page like below: &lt;br /&gt;
&lt;br /&gt;
[[File:login_screen.png]]&lt;br /&gt;
&lt;br /&gt;
User will have to fill up all the required details and request a signup.&lt;br /&gt;
When a super administrator logins to his account he can go to '''Manage/users/review requested users''' menu as shown below&lt;br /&gt;
[[File:Approval_new2.png]]&lt;br /&gt;
&lt;br /&gt;
Super Admin can either approve/reject a user. The view for this page would be as shown below.&lt;br /&gt;
[[File:req_approval.png]]&lt;br /&gt;
&lt;br /&gt;
In addition to the above files a new file in instructions, named home.html.erb is created which will have all the videos explaining how Expertiza works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In '''users_controller.rb''' we will be having two new methods. One method (request_user_create) to the new user to request for an account in Expertiza and also mail all the super admins about the new user request. Other method (create_approved_user) is for the super admin to either approve or reject the user request and send a mail to the requested user if his/her account is created. The mail also contains a password for the user to login. &lt;br /&gt;
&lt;br /&gt;
The codes for each method are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def request_user_create&lt;br /&gt;
    @user = RequestedUser.new(user_params)&lt;br /&gt;
    @user.institution_id = params[:user][:institution_id]&lt;br /&gt;
    @user.status = 'Under Review'&lt;br /&gt;
    #The super admin receives a mail about a new user request with the user name&lt;br /&gt;
    if verify_recaptcha(model: @user) &amp;amp;&amp;amp; @user.save&lt;br /&gt;
      @super_users = User.joins(:role).where('roles.name' =&amp;gt;'Super-Administrator');&lt;br /&gt;
      @super_users.each do |super_user|&lt;br /&gt;
        prepared_mail = MailerHelper.send_mail_to_all_super_users(super_user,@user, &amp;quot;New account Request&amp;quot;)&lt;br /&gt;
        prepared_mail.deliver&lt;br /&gt;
      end&lt;br /&gt;
      flash[:success] = &amp;quot;User signup for \&amp;quot;#{@user.name}\&amp;quot; has been successfully requested. &amp;quot;&lt;br /&gt;
      redirect_to '/instructions/home'&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = &amp;quot;Error requesting sign up &amp;quot;&lt;br /&gt;
      redirect_to :controller =&amp;gt; 'users', :action =&amp;gt; 'request_new', :role=&amp;gt;&amp;quot;Student&amp;quot;   &lt;br /&gt;
    end&lt;br /&gt;
  end  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    @user = RequestedUser.find params[:id]&lt;br /&gt;
    @user.status=params[:status]&lt;br /&gt;
    @user.reason=params[:reason]&lt;br /&gt;
    if @user.status.nil?&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
    elsif @user.update_attributes(params[:user])&lt;br /&gt;
      flash[:success] = &amp;quot;The user \&amp;quot;#{@user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    if @user.status==&amp;quot;Approved&amp;quot;&lt;br /&gt;
      check = User.find_by_name(@user.name)&lt;br /&gt;
      @usernew = User.new()&lt;br /&gt;
      @usernew.name = @user.name&lt;br /&gt;
      @usernew.role_id = @user.role_id&lt;br /&gt;
      @usernew.institution_id = @user.institution_id&lt;br /&gt;
      @usernew.fullname = @user.fullname&lt;br /&gt;
      @usernew.email = @user.email&lt;br /&gt;
      # record the person who created this new user&lt;br /&gt;
      @usernew.parent_id = session[:user].id&lt;br /&gt;
      # set the user's timezone to its parent's&lt;br /&gt;
      @usernew.timezonepref = User.find(@usernew.parent_id).timezonepref&lt;br /&gt;
&lt;br /&gt;
      if @usernew.save&lt;br /&gt;
        password = @usernew.reset_password # the password is reset&lt;br /&gt;
        # Mail is sent to the user with a new password&lt;br /&gt;
        prepared_mail = MailerHelper.send_mail_to_user(@usernew, &amp;quot;Your Expertiza account and password &lt;br /&gt;
                                                            have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
        prepared_mail.deliver&lt;br /&gt;
        flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
        if @usernew.role.name == &amp;quot;Instructor&amp;quot; or @usernew.role.name == &amp;quot;Administrator&amp;quot;&lt;br /&gt;
          AssignmentQuestionnaire.create(user_id: @user.id)&lt;br /&gt;
        end&lt;br /&gt;
        undo_link(&amp;quot;The user \&amp;quot;#{@user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
      else&lt;br /&gt;
        foreign&lt;br /&gt;
      end&lt;br /&gt;
    else &lt;br /&gt;
      if @user.status==&amp;quot;Rejected&amp;quot;    &lt;br /&gt;
        #If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if @user.update_columns(reason: params[:reason], status: params[:status])&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{@user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          redirect_to action: 'review'&lt;br /&gt;
          return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'review'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Database Changes'''==&lt;br /&gt;
&lt;br /&gt;
We have created a new table called '''requested_users''' with table description that is similar to '''users'''. The status column, which isn't present in the users tables indicates the approval/rejection of the request of the user. The description of the table is as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Requested_user_db.png‎ ]]&lt;br /&gt;
&lt;br /&gt;
=='''Screencast'''==&lt;br /&gt;
&lt;br /&gt;
Screencast [https://youtu.be/4HAs8jhbkw4 link] to our demonstration&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
We will be testing each of the functionality separately.&lt;br /&gt;
&lt;br /&gt;
1. Test all views - will be testing if '''_login.html.erb''' and '''Request_new.html.erb''' are rendered properly.&lt;br /&gt;
&lt;br /&gt;
2. Test all controller methods. New test cases will be included for each case: &lt;br /&gt;
* Does '''create_approved_user''' actually create a new user&lt;br /&gt;
* Does '''request_user_create''' actually not create a new user request&lt;br /&gt;
&lt;br /&gt;
3. Test the model '''requested_user''' so that no invalid entries (blank email ID, blank name etc.) are accepted. &lt;br /&gt;
&lt;br /&gt;
4. Test the mailer to verify if the body, subject, the mail id sent to/from are correctly functioning.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Req_approval.png&amp;diff=106501</id>
		<title>File:Req approval.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Req_approval.png&amp;diff=106501"/>
		<updated>2016-12-04T23:54:13Z</updated>

		<summary type="html">&lt;p&gt;Spotta: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1687_Instructor_account_creation_over_the_web&amp;diff=106500</id>
		<title>CSC/ECE 517 Fall 2016 E1687 Instructor account creation over the web</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016_E1687_Instructor_account_creation_over_the_web&amp;diff=106500"/>
		<updated>2016-12-04T23:12:03Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Files changed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1687. Instructor Account Creation Over the Web'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the final project of creating an instructor account over the web in Expertiza.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
In Expertiza, user and instructor accounts are currently created by existing super administrators, instructors or TAs. For new users to access the system and experiment the features offered by Expertiza, a “demo-like” feature needs to implemented. The following are the set of requirements that needs to be catered with this feature:&lt;br /&gt;
#Allow people to request instructor accounts over the web. This feature should also have security features such as Captchas to help avoid account creation by bots.&lt;br /&gt;
#When a user account is created over the web, the super-admin should get e-mail regarding the same and also the user should be notified upon approval/denial (if denied, then reason should be specified).&lt;br /&gt;
#Currently, Expertiza consists of a lot of entities that can be made publicly visible to all other users in the system. But, accounts created this way should not be able to see existing public features, until the super-admin manually gives them permission to view public courses, assignments, and questionnaires.&lt;br /&gt;
#A user who creates an account over the web should be pointed to an instruction page and/or video on how to create an assignment and register students for it, etc.&lt;br /&gt;
&lt;br /&gt;
=='''Implementation'''==&lt;br /&gt;
The following solutions shall be addressing the problems discussed above. &lt;br /&gt;
===Problem 1===&lt;br /&gt;
Once a user wants to register and try the features of Expertiza, upon opening the website, one can register by filling up the form and click the register button. There is a captcha that shall be shown below, to make sure that it isn't any bot that is accessing. It provides security to the application.&lt;br /&gt;
&lt;br /&gt;
===Problem 2===&lt;br /&gt;
Once the user requests for an account creation, the super admin receives a mail informing about the request with the name of the requested user. The super admin shall then, look for the details of the user in the Requests tab and can either approve/decline the request. Once the super admin approves the user request, the user gets a mail notifying the same. If the request is rejected, then the reason should be mentioned in the reason tab of the form. But there is no mail sent to the user regarding that.&lt;br /&gt;
&lt;br /&gt;
===Problem 3===&lt;br /&gt;
There shall be a flash message saying, “Login denied. Needs permission from super admin” that can be seen on the login page if an unregistered user tries to access the features of Expertiza.  This helps in removing the access to few publicly visible features as it denies access completely. &lt;br /&gt;
&lt;br /&gt;
===Problem 4===&lt;br /&gt;
Once the user account is approved by the super admin and the user tries to login upon notification, he/she shall be redirected to an “Instructions” page on successful login. &lt;br /&gt;
&lt;br /&gt;
This page shall contain the video tutorials explaining various features of Expertiza and also on how to access them.&lt;br /&gt;
&lt;br /&gt;
=='''Files changed'''==&lt;br /&gt;
The following are the list of files that were created/edited throughout the project.&lt;br /&gt;
* views/auth/_login.html.erb&lt;br /&gt;
* views/users/request_new.html.erb&lt;br /&gt;
* views/users/review.html&lt;br /&gt;
* views/instructions/home.html.erb&lt;br /&gt;
* views/users/edit.html.erb&lt;br /&gt;
* views/mailer/request_user_message.html.erb&lt;br /&gt;
* views/users/new.html.erb&lt;br /&gt;
* views/users/_password.html.erb&lt;br /&gt;
* views/users/_user.html.erb&lt;br /&gt;
* users_controller.rb&lt;br /&gt;
* routes.rb&lt;br /&gt;
* models&lt;br /&gt;
* mailer_helper.rb&lt;br /&gt;
* mailer.rb&lt;br /&gt;
* models/requested_user.rb&lt;br /&gt;
* config/initializers/recaptcha.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In '''_login.html.erb''' a new button called Request Sign Up was added for the new users to register. The register page will look as above. On clicking '''Request sign up''', a user will be redirected to a page like below: &lt;br /&gt;
&lt;br /&gt;
[[File:login_screen.png]]&lt;br /&gt;
&lt;br /&gt;
User will have to fill up all the required details and request a signup.&lt;br /&gt;
When a super administrator logins to his account he can go to '''Manage/users/review requested users''' menu as shown below&lt;br /&gt;
[[File:Approval_new2.png]]&lt;br /&gt;
&lt;br /&gt;
Super Admin can either approve/reject a user. The view for this page would be as shown below.&lt;br /&gt;
[[File:req_approval_table.png]]&lt;br /&gt;
&lt;br /&gt;
In addition to the above files a new file in instructions, named home.html.erb is created which will have all the videos explaining how Expertiza works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In '''users_controller.rb''' we will be having two new methods. One method (request_user_create) to the new user to request for an account in Expertiza and also mail all the super admins about the new user request. Other method (create_approved_user) is for the super admin to either approve or reject the user request and send a mail to the requested user if his/her account is created. The mail also contains a password for the user to login. &lt;br /&gt;
&lt;br /&gt;
The codes for each method are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def request_user_create&lt;br /&gt;
    @user = RequestedUser.new(user_params)&lt;br /&gt;
    @user.institution_id = params[:user][:institution_id]&lt;br /&gt;
    @user.status = 'Under Review'&lt;br /&gt;
    #The super admin receives a mail about a new user request with the user name&lt;br /&gt;
    if verify_recaptcha(model: @user) &amp;amp;&amp;amp; @user.save&lt;br /&gt;
      @super_users = User.joins(:role).where('roles.name' =&amp;gt;'Super-Administrator');&lt;br /&gt;
      @super_users.each do |super_user|&lt;br /&gt;
        prepared_mail = MailerHelper.send_mail_to_all_super_users(super_user,@user, &amp;quot;New account Request&amp;quot;)&lt;br /&gt;
        prepared_mail.deliver&lt;br /&gt;
      end&lt;br /&gt;
      flash[:success] = &amp;quot;User signup for \&amp;quot;#{@user.name}\&amp;quot; has been successfully requested. &amp;quot;&lt;br /&gt;
      redirect_to '/instructions/home'&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = &amp;quot;Error requesting sign up &amp;quot;&lt;br /&gt;
      redirect_to :controller =&amp;gt; 'users', :action =&amp;gt; 'request_new', :role=&amp;gt;&amp;quot;Student&amp;quot;   &lt;br /&gt;
    end&lt;br /&gt;
  end  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_approved_user&lt;br /&gt;
    @user = RequestedUser.find params[:id]&lt;br /&gt;
    @user.status=params[:status]&lt;br /&gt;
    @user.reason=params[:reason]&lt;br /&gt;
    if @user.status.nil?&lt;br /&gt;
      flash[:error] = &amp;quot;Please Approve or Reject before submitting&amp;quot;&lt;br /&gt;
    elsif @user.update_attributes(params[:user])&lt;br /&gt;
      flash[:success] = &amp;quot;The user \&amp;quot;#{@user.name}\&amp;quot; has been successfully updated.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    if @user.status==&amp;quot;Approved&amp;quot;&lt;br /&gt;
      check = User.find_by_name(@user.name)&lt;br /&gt;
      @usernew = User.new()&lt;br /&gt;
      @usernew.name = @user.name&lt;br /&gt;
      @usernew.role_id = @user.role_id&lt;br /&gt;
      @usernew.institution_id = @user.institution_id&lt;br /&gt;
      @usernew.fullname = @user.fullname&lt;br /&gt;
      @usernew.email = @user.email&lt;br /&gt;
      # record the person who created this new user&lt;br /&gt;
      @usernew.parent_id = session[:user].id&lt;br /&gt;
      # set the user's timezone to its parent's&lt;br /&gt;
      @usernew.timezonepref = User.find(@usernew.parent_id).timezonepref&lt;br /&gt;
&lt;br /&gt;
      if @usernew.save&lt;br /&gt;
        password = @usernew.reset_password # the password is reset&lt;br /&gt;
        # Mail is sent to the user with a new password&lt;br /&gt;
        prepared_mail = MailerHelper.send_mail_to_user(@usernew, &amp;quot;Your Expertiza account and password &lt;br /&gt;
                                                            have been created.&amp;quot;, &amp;quot;user_welcome&amp;quot;, password)&lt;br /&gt;
        prepared_mail.deliver&lt;br /&gt;
        flash[:success] = &amp;quot;A new password has been sent to new user's e-mail address.&amp;quot;&lt;br /&gt;
        if @usernew.role.name == &amp;quot;Instructor&amp;quot; or @usernew.role.name == &amp;quot;Administrator&amp;quot;&lt;br /&gt;
          AssignmentQuestionnaire.create(user_id: @user.id)&lt;br /&gt;
        end&lt;br /&gt;
        undo_link(&amp;quot;The user \&amp;quot;#{@user.name}\&amp;quot; has been successfully created. &amp;quot;)&lt;br /&gt;
      else&lt;br /&gt;
        foreign&lt;br /&gt;
      end&lt;br /&gt;
    else &lt;br /&gt;
      if @user.status==&amp;quot;Rejected&amp;quot;    &lt;br /&gt;
        #If the user request has been rejected, a flash message is shown and redirected to review page&lt;br /&gt;
        if @user.update_columns(reason: params[:reason], status: params[:status])&lt;br /&gt;
          flash[:success] = &amp;quot;The user \&amp;quot;#{@user.name}\&amp;quot; has been Rejected.&amp;quot;&lt;br /&gt;
          redirect_to action: 'review'&lt;br /&gt;
          return&lt;br /&gt;
        else&lt;br /&gt;
          flash[:error] = &amp;quot;Error processing request.&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'review'&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=='''Database Changes'''==&lt;br /&gt;
&lt;br /&gt;
We have created a new table called '''requested_users''' with table description that is similar to '''users'''. The status column, which isn't present in the users tables indicates the approval/rejection of the request of the user. The description of the table is as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:Requested_user_db.png‎ ]]&lt;br /&gt;
&lt;br /&gt;
=='''Screencast'''==&lt;br /&gt;
&lt;br /&gt;
Screencast [https://youtu.be/4HAs8jhbkw4 link] to our demonstration&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
We will be testing each of the functionality separately.&lt;br /&gt;
&lt;br /&gt;
1. Test all views - will be testing if '''_login.html.erb''' and '''Request_new.html.erb''' are rendered properly.&lt;br /&gt;
&lt;br /&gt;
2. Test all controller methods. New test cases will be included for each case: &lt;br /&gt;
* Does '''create_approved_user''' actually create a new user&lt;br /&gt;
* Does '''request_user_create''' actually not create a new user request&lt;br /&gt;
&lt;br /&gt;
3. Test the model '''requested_user''' so that no invalid entries (blank email ID, blank name etc.) are accepted. &lt;br /&gt;
&lt;br /&gt;
4. Test the mailer to verify if the body, subject, the mail id sent to/from are correctly functioning.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104587</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104587"/>
		<updated>2016-11-05T01:54:48Z</updated>

		<summary type="html">&lt;p&gt;Spotta: UI&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: &lt;br /&gt;
* app/views/mailer/suggested_topic_approved_message.html.erb&lt;br /&gt;
* spec/features/topic_suggestion2_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
The Docker has been setup on a Windows PC and steps are given below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start Docker on Windows&lt;br /&gt;
&lt;br /&gt;
docker run --expose 3000 -p 3000:3000 -v //c//Users//Srikar//Expertiza://c//Users//Srikar//Expertiza -it winbobob/expertiza-fall2016&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/mysql start   &lt;br /&gt;
mysql -uroot -p           &lt;br /&gt;
show databases;  &lt;br /&gt;
quit&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/srikarpotta/expertiza.git&lt;br /&gt;
cd expertiza&lt;br /&gt;
cp config/database.yml.example config/database.yml&lt;br /&gt;
cp config/secrets.yml.example config/secrets.yml&lt;br /&gt;
&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:migrate&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
npm install -g bower&lt;br /&gt;
&lt;br /&gt;
sudo rm /usr/bin/node&lt;br /&gt;
sudo ln –s /usr/bin/nodejs /usr/bin/node&lt;br /&gt;
bower install --allow-root&lt;br /&gt;
thin start&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Fork the git repository mentioned above&lt;br /&gt;
&lt;br /&gt;
#Clone the repository to your local machine&lt;br /&gt;
Install [http://brew.sh/ Homebrew]&lt;br /&gt;
&lt;br /&gt;
#Install RBENV&lt;br /&gt;
brew update&lt;br /&gt;
brew install rbenv&lt;br /&gt;
brew install ruby-build&lt;br /&gt;
&lt;br /&gt;
#Install dependencies&lt;br /&gt;
brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
&lt;br /&gt;
#Install gems&lt;br /&gt;
export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
#Change yml files&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
&lt;br /&gt;
#Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
&lt;br /&gt;
#Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
&lt;br /&gt;
#Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
mysql -uroot -p&lt;br /&gt;
&lt;br /&gt;
#Create expertiza user&lt;br /&gt;
create user expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Create the databases&lt;br /&gt;
create database pg_development;&lt;br /&gt;
create database pg_test;&lt;br /&gt;
&lt;br /&gt;
#Set privileges for expertiza user&lt;br /&gt;
grant all on pg_development.to expertiza@localhost;&lt;br /&gt;
grant all on pg_test.to expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Install javascript libraries&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
sudo npm install bower&lt;br /&gt;
bower install&lt;br /&gt;
&lt;br /&gt;
#Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
&lt;br /&gt;
#Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:migrate&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:test:prepare&lt;br /&gt;
&lt;br /&gt;
#Run rails s&lt;br /&gt;
&lt;br /&gt;
#Open browser and test localhost:3000&lt;br /&gt;
&lt;br /&gt;
#Login credentials&lt;br /&gt;
Username - instructor6&lt;br /&gt;
Password - password&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There is a partial coverage of suggstion_controller using feature test and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
==='''Refactoring''' ===&lt;br /&gt;
There were lot of trailing spaces in the code, which are removed. Few lines were too long and one had to scroll right to go through that line. This was taken care of. We have also edited the messages, making them more readable and logical. Also, the unused methods in the code were removed. &lt;br /&gt;
&lt;br /&gt;
The comments were added for future readability.&lt;br /&gt;
&lt;br /&gt;
=== '''Email functionality''' ===&lt;br /&gt;
The email functionality which wasn't working before has been fixed. These are the cases considered:&lt;br /&gt;
Instructor starts a new assignment with some topics&lt;br /&gt;
* Student signs up for one topic, suggests a new one but doesn't want to work on it. Then the student receives a mail once the instructor approves.&lt;br /&gt;
* Student doesn't sign up for a topic and suggests a new one. If the student opts to work on it, then on approval, a mail is sent. If the student doesn't want to work on it, then no mail is sent even on approval. &lt;br /&gt;
* It is a team project - if there is already a team and they come up with a new topic and want to work on it, then a mail is sent on approval. If there isn't a team and a student suggests a new topic, a topic is assigned on approval and also a team of students who choose that topic. In this case, there is no email notification.&lt;br /&gt;
* A team project - there is a team and they suggest a topic but choose not to work on it and also they haven't signed up for a topic. In this case, upon the acceptance of topic by the instructor, there is no email sent and they are supposed to sign up for a topic from the given set.&lt;br /&gt;
&lt;br /&gt;
Irrespective of teams and topic, if someone suggests a topic anonymously, there won't be any email notification on approval of the topic. The key point here is there should be a signup preference that should be set for the notification. &lt;br /&gt;
&lt;br /&gt;
We have used the following accounts for testing:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
* Login ID - instructor6                Password - password&lt;br /&gt;
* Student1 ID - student5432             Password - password&lt;br /&gt;
* Student2 Id - student5404             Password - password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The implementation can be seen in the video, where we covered few cases mentioned above.&lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
==== Scenario 6 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfill the following criteria:&lt;br /&gt;
*Test the integration of core functionalities of suggestion controller&lt;br /&gt;
*Have maximum code coverage&lt;br /&gt;
*Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''''' We have submitted two links to show the working of email functionality and the other one to show the tests. As suggested by the professor, this is done as an alternative to deployment. ''''''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Working in UI ===&lt;br /&gt;
The steps are given as follows:&lt;br /&gt;
# Sign in Expertiza using the instructor account (login credentials mentioned above)&lt;br /&gt;
# Go to Manage tab, then click Assignments, and click New Public Assignment&lt;br /&gt;
# Give all the necessary details (Name of assignment, rubrics, due dates etc..) '''Do not forget to click on Allow students to suggest topic'''&lt;br /&gt;
# Go to Manage assignments tab, and in the assignment you just created, click on add participants and select copy from course &lt;br /&gt;
# Login from student credentials (mentioned earlier) and go to the assignment that was created&lt;br /&gt;
# Either sign up for the topic or suggest a new one directly&lt;br /&gt;
# Now to instructor account and view suggestions against the assignment created&lt;br /&gt;
# The instructor can approve or decline&lt;br /&gt;
# Open the gmail account (id: expertiza.development@gmail.com, password: qwer@1234) and look for mail if approved&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“'''Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.'''” - Edsger Dijkstra&lt;br /&gt;
&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104585</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104585"/>
		<updated>2016-11-05T01:13:42Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Why these scenarios? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: &lt;br /&gt;
* app/views/mailer/suggested_topic_approved_message.html.erb&lt;br /&gt;
* spec/features/topic_suggestion2_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
The Docker has been setup on a Windows PC and steps are given below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start Docker on Windows&lt;br /&gt;
&lt;br /&gt;
docker run --expose 3000 -p 3000:3000 -v //c//Users//Srikar//Expertiza://c//Users//Srikar//Expertiza -it winbobob/expertiza-fall2016&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/mysql start   &lt;br /&gt;
mysql -uroot -p           &lt;br /&gt;
show databases;  &lt;br /&gt;
quit&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/srikarpotta/expertiza.git&lt;br /&gt;
cd expertiza&lt;br /&gt;
cp config/database.yml.example config/database.yml&lt;br /&gt;
cp config/secrets.yml.example config/secrets.yml&lt;br /&gt;
&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:migrate&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
npm install -g bower&lt;br /&gt;
&lt;br /&gt;
sudo rm /usr/bin/node&lt;br /&gt;
sudo ln –s /usr/bin/nodejs /usr/bin/node&lt;br /&gt;
bower install --allow-root&lt;br /&gt;
thin start&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Fork the git repository mentioned above&lt;br /&gt;
&lt;br /&gt;
#Clone the repository to your local machine&lt;br /&gt;
Install [http://brew.sh/ Homebrew]&lt;br /&gt;
&lt;br /&gt;
#Install RBENV&lt;br /&gt;
brew update&lt;br /&gt;
brew install rbenv&lt;br /&gt;
brew install ruby-build&lt;br /&gt;
&lt;br /&gt;
#Install dependencies&lt;br /&gt;
brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
&lt;br /&gt;
#Install gems&lt;br /&gt;
export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
#Change yml files&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
&lt;br /&gt;
#Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
&lt;br /&gt;
#Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
&lt;br /&gt;
#Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
mysql -uroot -p&lt;br /&gt;
&lt;br /&gt;
#Create expertiza user&lt;br /&gt;
create user expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Create the databases&lt;br /&gt;
create database pg_development;&lt;br /&gt;
create database pg_test;&lt;br /&gt;
&lt;br /&gt;
#Set privileges for expertiza user&lt;br /&gt;
grant all on pg_development.to expertiza@localhost;&lt;br /&gt;
grant all on pg_test.to expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Install javascript libraries&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
sudo npm install bower&lt;br /&gt;
bower install&lt;br /&gt;
&lt;br /&gt;
#Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
&lt;br /&gt;
#Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:migrate&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:test:prepare&lt;br /&gt;
&lt;br /&gt;
#Run rails s&lt;br /&gt;
&lt;br /&gt;
#Open browser and test localhost:3000&lt;br /&gt;
&lt;br /&gt;
#Login credentials&lt;br /&gt;
Username - instructor6&lt;br /&gt;
Password - password&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There is a partial coverage of suggstion_controller using feature test and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
==='''Refactoring''' ===&lt;br /&gt;
There were lot of trailing spaces in the code, which are removed. Few lines were too long and one had to scroll right to go through that line. This was taken care of. We have also edited the messages, making them more readable and logical. Also, the unused methods in the code were removed. &lt;br /&gt;
&lt;br /&gt;
The comments were added for future readability.&lt;br /&gt;
&lt;br /&gt;
=== '''Email functionality''' ===&lt;br /&gt;
The email functionality which wasn't working before has been fixed. These are the cases considered:&lt;br /&gt;
Instructor starts a new assignment with some topics&lt;br /&gt;
* Student signs up for one topic, suggests a new one but doesn't want to work on it. Then the student receives a mail once the instructor approves.&lt;br /&gt;
* Student doesn't sign up for a topic and suggests a new one. If the student opts to work on it, then on approval, a mail is sent. If the student doesn't want to work on it, then no mail is sent even on approval. &lt;br /&gt;
* It is a team project - if there is already a team and they come up with a new topic and want to work on it, then a mail is sent on approval. If there isn't a team and a student suggests a new topic, a topic is assigned on approval and also a team of students who choose that topic. In this case, there is no email notification.&lt;br /&gt;
* A team project - there is a team and they suggest a topic but choose not to work on it and also they haven't signed up for a topic. In this case, upon the acceptance of topic by the instructor, there is no email sent and they are supposed to sign up for a topic from the given set.&lt;br /&gt;
&lt;br /&gt;
Irrespective of teams and topic, if someone suggests a topic anonymously, there won't be any email notification on approval of the topic. The key point here is there should be a signup preference that should be set for the notification. &lt;br /&gt;
&lt;br /&gt;
We have used the following accounts for testing:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
* Login ID - instructor6                Password - password&lt;br /&gt;
* Student1 ID - student5432             Password - password&lt;br /&gt;
* Student2 Id - student5404             Password - password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The implementation can be seen in the video, where we covered few cases mentioned above.&lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
==== Scenario 6 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
*Test the integration of core functionalities of suggestion controller&lt;br /&gt;
*Have maximum code coverage&lt;br /&gt;
*Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''''' We have submitted two links to show the working of email functionality and the other one to show the tests. As suggested by the professor, this is done as an alternative to deployment. ''''''&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“'''Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.'''” - Edsger Dijkstra&lt;br /&gt;
&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104584</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104584"/>
		<updated>2016-11-05T01:13:03Z</updated>

		<summary type="html">&lt;p&gt;Spotta: Videos&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: &lt;br /&gt;
* app/views/mailer/suggested_topic_approved_message.html.erb&lt;br /&gt;
* spec/features/topic_suggestion2_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
The Docker has been setup on a Windows PC and steps are given below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start Docker on Windows&lt;br /&gt;
&lt;br /&gt;
docker run --expose 3000 -p 3000:3000 -v //c//Users//Srikar//Expertiza://c//Users//Srikar//Expertiza -it winbobob/expertiza-fall2016&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/mysql start   &lt;br /&gt;
mysql -uroot -p           &lt;br /&gt;
show databases;  &lt;br /&gt;
quit&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/srikarpotta/expertiza.git&lt;br /&gt;
cd expertiza&lt;br /&gt;
cp config/database.yml.example config/database.yml&lt;br /&gt;
cp config/secrets.yml.example config/secrets.yml&lt;br /&gt;
&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:migrate&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
npm install -g bower&lt;br /&gt;
&lt;br /&gt;
sudo rm /usr/bin/node&lt;br /&gt;
sudo ln –s /usr/bin/nodejs /usr/bin/node&lt;br /&gt;
bower install --allow-root&lt;br /&gt;
thin start&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Fork the git repository mentioned above&lt;br /&gt;
&lt;br /&gt;
#Clone the repository to your local machine&lt;br /&gt;
Install [http://brew.sh/ Homebrew]&lt;br /&gt;
&lt;br /&gt;
#Install RBENV&lt;br /&gt;
brew update&lt;br /&gt;
brew install rbenv&lt;br /&gt;
brew install ruby-build&lt;br /&gt;
&lt;br /&gt;
#Install dependencies&lt;br /&gt;
brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
&lt;br /&gt;
#Install gems&lt;br /&gt;
export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
#Change yml files&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
&lt;br /&gt;
#Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
&lt;br /&gt;
#Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
&lt;br /&gt;
#Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
mysql -uroot -p&lt;br /&gt;
&lt;br /&gt;
#Create expertiza user&lt;br /&gt;
create user expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Create the databases&lt;br /&gt;
create database pg_development;&lt;br /&gt;
create database pg_test;&lt;br /&gt;
&lt;br /&gt;
#Set privileges for expertiza user&lt;br /&gt;
grant all on pg_development.to expertiza@localhost;&lt;br /&gt;
grant all on pg_test.to expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Install javascript libraries&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
sudo npm install bower&lt;br /&gt;
bower install&lt;br /&gt;
&lt;br /&gt;
#Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
&lt;br /&gt;
#Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:migrate&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:test:prepare&lt;br /&gt;
&lt;br /&gt;
#Run rails s&lt;br /&gt;
&lt;br /&gt;
#Open browser and test localhost:3000&lt;br /&gt;
&lt;br /&gt;
#Login credentials&lt;br /&gt;
Username - instructor6&lt;br /&gt;
Password - password&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There is a partial coverage of suggstion_controller using feature test and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
==='''Refactoring''' ===&lt;br /&gt;
There were lot of trailing spaces in the code, which are removed. Few lines were too long and one had to scroll right to go through that line. This was taken care of. We have also edited the messages, making them more readable and logical. Also, the unused methods in the code were removed. &lt;br /&gt;
&lt;br /&gt;
The comments were added for future readability.&lt;br /&gt;
&lt;br /&gt;
=== '''Email functionality''' ===&lt;br /&gt;
The email functionality which wasn't working before has been fixed. These are the cases considered:&lt;br /&gt;
Instructor starts a new assignment with some topics&lt;br /&gt;
* Student signs up for one topic, suggests a new one but doesn't want to work on it. Then the student receives a mail once the instructor approves.&lt;br /&gt;
* Student doesn't sign up for a topic and suggests a new one. If the student opts to work on it, then on approval, a mail is sent. If the student doesn't want to work on it, then no mail is sent even on approval. &lt;br /&gt;
* It is a team project - if there is already a team and they come up with a new topic and want to work on it, then a mail is sent on approval. If there isn't a team and a student suggests a new topic, a topic is assigned on approval and also a team of students who choose that topic. In this case, there is no email notification.&lt;br /&gt;
* A team project - there is a team and they suggest a topic but choose not to work on it and also they haven't signed up for a topic. In this case, upon the acceptance of topic by the instructor, there is no email sent and they are supposed to sign up for a topic from the given set.&lt;br /&gt;
&lt;br /&gt;
Irrespective of teams and topic, if someone suggests a topic anonymously, there won't be any email notification on approval of the topic. The key point here is there should be a signup preference that should be set for the notification. &lt;br /&gt;
&lt;br /&gt;
We have used the following accounts for testing:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
* Login ID - instructor6                Password - password&lt;br /&gt;
* Student1 ID - student5432             Password - password&lt;br /&gt;
* Student2 Id - student5404             Password - password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The implementation can be seen in the video, where we covered few cases mentioned above.&lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
==== Scenario 6 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
*Test the integration of core functionalities of suggestion controller&lt;br /&gt;
*Have maximum code coverage&lt;br /&gt;
*Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ''' We have submitted two links to show the working of email functionality and the other one to show the tests. As suggested by the professor, this is done as an alternative to deployment. '''&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“'''Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.'''” - Edsger Dijkstra&lt;br /&gt;
&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104583</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104583"/>
		<updated>2016-11-05T01:12:41Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Why these scenarios? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: &lt;br /&gt;
* app/views/mailer/suggested_topic_approved_message.html.erb&lt;br /&gt;
* spec/features/topic_suggestion2_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
The Docker has been setup on a Windows PC and steps are given below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start Docker on Windows&lt;br /&gt;
&lt;br /&gt;
docker run --expose 3000 -p 3000:3000 -v //c//Users//Srikar//Expertiza://c//Users//Srikar//Expertiza -it winbobob/expertiza-fall2016&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/mysql start   &lt;br /&gt;
mysql -uroot -p           &lt;br /&gt;
show databases;  &lt;br /&gt;
quit&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/srikarpotta/expertiza.git&lt;br /&gt;
cd expertiza&lt;br /&gt;
cp config/database.yml.example config/database.yml&lt;br /&gt;
cp config/secrets.yml.example config/secrets.yml&lt;br /&gt;
&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:migrate&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
npm install -g bower&lt;br /&gt;
&lt;br /&gt;
sudo rm /usr/bin/node&lt;br /&gt;
sudo ln –s /usr/bin/nodejs /usr/bin/node&lt;br /&gt;
bower install --allow-root&lt;br /&gt;
thin start&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Fork the git repository mentioned above&lt;br /&gt;
&lt;br /&gt;
#Clone the repository to your local machine&lt;br /&gt;
Install [http://brew.sh/ Homebrew]&lt;br /&gt;
&lt;br /&gt;
#Install RBENV&lt;br /&gt;
brew update&lt;br /&gt;
brew install rbenv&lt;br /&gt;
brew install ruby-build&lt;br /&gt;
&lt;br /&gt;
#Install dependencies&lt;br /&gt;
brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
&lt;br /&gt;
#Install gems&lt;br /&gt;
export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
#Change yml files&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
&lt;br /&gt;
#Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
&lt;br /&gt;
#Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
&lt;br /&gt;
#Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
mysql -uroot -p&lt;br /&gt;
&lt;br /&gt;
#Create expertiza user&lt;br /&gt;
create user expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Create the databases&lt;br /&gt;
create database pg_development;&lt;br /&gt;
create database pg_test;&lt;br /&gt;
&lt;br /&gt;
#Set privileges for expertiza user&lt;br /&gt;
grant all on pg_development.to expertiza@localhost;&lt;br /&gt;
grant all on pg_test.to expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Install javascript libraries&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
sudo npm install bower&lt;br /&gt;
bower install&lt;br /&gt;
&lt;br /&gt;
#Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
&lt;br /&gt;
#Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:migrate&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:test:prepare&lt;br /&gt;
&lt;br /&gt;
#Run rails s&lt;br /&gt;
&lt;br /&gt;
#Open browser and test localhost:3000&lt;br /&gt;
&lt;br /&gt;
#Login credentials&lt;br /&gt;
Username - instructor6&lt;br /&gt;
Password - password&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There is a partial coverage of suggstion_controller using feature test and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
==='''Refactoring''' ===&lt;br /&gt;
There were lot of trailing spaces in the code, which are removed. Few lines were too long and one had to scroll right to go through that line. This was taken care of. We have also edited the messages, making them more readable and logical. Also, the unused methods in the code were removed. &lt;br /&gt;
&lt;br /&gt;
The comments were added for future readability.&lt;br /&gt;
&lt;br /&gt;
=== '''Email functionality''' ===&lt;br /&gt;
The email functionality which wasn't working before has been fixed. These are the cases considered:&lt;br /&gt;
Instructor starts a new assignment with some topics&lt;br /&gt;
* Student signs up for one topic, suggests a new one but doesn't want to work on it. Then the student receives a mail once the instructor approves.&lt;br /&gt;
* Student doesn't sign up for a topic and suggests a new one. If the student opts to work on it, then on approval, a mail is sent. If the student doesn't want to work on it, then no mail is sent even on approval. &lt;br /&gt;
* It is a team project - if there is already a team and they come up with a new topic and want to work on it, then a mail is sent on approval. If there isn't a team and a student suggests a new topic, a topic is assigned on approval and also a team of students who choose that topic. In this case, there is no email notification.&lt;br /&gt;
* A team project - there is a team and they suggest a topic but choose not to work on it and also they haven't signed up for a topic. In this case, upon the acceptance of topic by the instructor, there is no email sent and they are supposed to sign up for a topic from the given set.&lt;br /&gt;
&lt;br /&gt;
Irrespective of teams and topic, if someone suggests a topic anonymously, there won't be any email notification on approval of the topic. The key point here is there should be a signup preference that should be set for the notification. &lt;br /&gt;
&lt;br /&gt;
We have used the following accounts for testing:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
* Login ID - instructor6                Password - password&lt;br /&gt;
* Student1 ID - student5432             Password - password&lt;br /&gt;
* Student2 Id - student5404             Password - password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The implementation can be seen in the video, where we covered few cases mentioned above.&lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
==== Scenario 6 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
*Test the integration of core functionalities of suggestion controller&lt;br /&gt;
*Have maximum code coverage&lt;br /&gt;
*Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ''' We have submitted two links to show the working of email functionality and the other one to show the tests. As suggested by the professor, this is done as an alternative to deployment. '''&lt;br /&gt;
 ==&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“'''Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.'''” - Edsger Dijkstra&lt;br /&gt;
&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104582</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104582"/>
		<updated>2016-11-05T01:12:15Z</updated>

		<summary type="html">&lt;p&gt;Spotta: Videos&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: &lt;br /&gt;
* app/views/mailer/suggested_topic_approved_message.html.erb&lt;br /&gt;
* spec/features/topic_suggestion2_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
The Docker has been setup on a Windows PC and steps are given below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start Docker on Windows&lt;br /&gt;
&lt;br /&gt;
docker run --expose 3000 -p 3000:3000 -v //c//Users//Srikar//Expertiza://c//Users//Srikar//Expertiza -it winbobob/expertiza-fall2016&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/mysql start   &lt;br /&gt;
mysql -uroot -p           &lt;br /&gt;
show databases;  &lt;br /&gt;
quit&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/srikarpotta/expertiza.git&lt;br /&gt;
cd expertiza&lt;br /&gt;
cp config/database.yml.example config/database.yml&lt;br /&gt;
cp config/secrets.yml.example config/secrets.yml&lt;br /&gt;
&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:migrate&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
npm install -g bower&lt;br /&gt;
&lt;br /&gt;
sudo rm /usr/bin/node&lt;br /&gt;
sudo ln –s /usr/bin/nodejs /usr/bin/node&lt;br /&gt;
bower install --allow-root&lt;br /&gt;
thin start&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Fork the git repository mentioned above&lt;br /&gt;
&lt;br /&gt;
#Clone the repository to your local machine&lt;br /&gt;
Install [http://brew.sh/ Homebrew]&lt;br /&gt;
&lt;br /&gt;
#Install RBENV&lt;br /&gt;
brew update&lt;br /&gt;
brew install rbenv&lt;br /&gt;
brew install ruby-build&lt;br /&gt;
&lt;br /&gt;
#Install dependencies&lt;br /&gt;
brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
&lt;br /&gt;
#Install gems&lt;br /&gt;
export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
#Change yml files&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
&lt;br /&gt;
#Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
&lt;br /&gt;
#Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
&lt;br /&gt;
#Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
mysql -uroot -p&lt;br /&gt;
&lt;br /&gt;
#Create expertiza user&lt;br /&gt;
create user expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Create the databases&lt;br /&gt;
create database pg_development;&lt;br /&gt;
create database pg_test;&lt;br /&gt;
&lt;br /&gt;
#Set privileges for expertiza user&lt;br /&gt;
grant all on pg_development.to expertiza@localhost;&lt;br /&gt;
grant all on pg_test.to expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Install javascript libraries&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
sudo npm install bower&lt;br /&gt;
bower install&lt;br /&gt;
&lt;br /&gt;
#Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
&lt;br /&gt;
#Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:migrate&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:test:prepare&lt;br /&gt;
&lt;br /&gt;
#Run rails s&lt;br /&gt;
&lt;br /&gt;
#Open browser and test localhost:3000&lt;br /&gt;
&lt;br /&gt;
#Login credentials&lt;br /&gt;
Username - instructor6&lt;br /&gt;
Password - password&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There is a partial coverage of suggstion_controller using feature test and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
==='''Refactoring''' ===&lt;br /&gt;
There were lot of trailing spaces in the code, which are removed. Few lines were too long and one had to scroll right to go through that line. This was taken care of. We have also edited the messages, making them more readable and logical. Also, the unused methods in the code were removed. &lt;br /&gt;
&lt;br /&gt;
The comments were added for future readability.&lt;br /&gt;
&lt;br /&gt;
=== '''Email functionality''' ===&lt;br /&gt;
The email functionality which wasn't working before has been fixed. These are the cases considered:&lt;br /&gt;
Instructor starts a new assignment with some topics&lt;br /&gt;
* Student signs up for one topic, suggests a new one but doesn't want to work on it. Then the student receives a mail once the instructor approves.&lt;br /&gt;
* Student doesn't sign up for a topic and suggests a new one. If the student opts to work on it, then on approval, a mail is sent. If the student doesn't want to work on it, then no mail is sent even on approval. &lt;br /&gt;
* It is a team project - if there is already a team and they come up with a new topic and want to work on it, then a mail is sent on approval. If there isn't a team and a student suggests a new topic, a topic is assigned on approval and also a team of students who choose that topic. In this case, there is no email notification.&lt;br /&gt;
* A team project - there is a team and they suggest a topic but choose not to work on it and also they haven't signed up for a topic. In this case, upon the acceptance of topic by the instructor, there is no email sent and they are supposed to sign up for a topic from the given set.&lt;br /&gt;
&lt;br /&gt;
Irrespective of teams and topic, if someone suggests a topic anonymously, there won't be any email notification on approval of the topic. The key point here is there should be a signup preference that should be set for the notification. &lt;br /&gt;
&lt;br /&gt;
We have used the following accounts for testing:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
* Login ID - instructor6                Password - password&lt;br /&gt;
* Student1 ID - student5432             Password - password&lt;br /&gt;
* Student2 Id - student5404             Password - password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The implementation can be seen in the video, where we covered few cases mentioned above.&lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
==== Scenario 6 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
*Test the integration of core functionalities of suggestion controller&lt;br /&gt;
*Have maximum code coverage&lt;br /&gt;
*Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
''' We have submitted two links to show the working of email functionality and the other one to show the tests. As suggested by the professor, this is done as an alternative to deployment. '''&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“'''Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.'''” - Edsger Dijkstra&lt;br /&gt;
&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104344</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104344"/>
		<updated>2016-11-04T16:57:30Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Email functionality */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: &lt;br /&gt;
* app/views/mailer/suggested_topic_approved_message.html.erb&lt;br /&gt;
* spec/features/topic_suggestion2_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
The Docker has been setup on a Windows PC and steps are given below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start Docker on Windows&lt;br /&gt;
&lt;br /&gt;
docker run --expose 3000 -p 3000:3000 -v //c//Users//Srikar//Expertiza://c//Users//Srikar//Expertiza -it winbobob/expertiza-fall2016&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/mysql start   &lt;br /&gt;
mysql -uroot -p           &lt;br /&gt;
show databases;  &lt;br /&gt;
quit&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/srikarpotta/expertiza.git&lt;br /&gt;
cd expertiza&lt;br /&gt;
cp config/database.yml.example config/database.yml&lt;br /&gt;
cp config/secrets.yml.example config/secrets.yml&lt;br /&gt;
&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:migrate&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
npm install -g bower&lt;br /&gt;
&lt;br /&gt;
sudo rm /usr/bin/node&lt;br /&gt;
sudo ln –s /usr/bin/nodejs /usr/bin/node&lt;br /&gt;
bower install --allow-root&lt;br /&gt;
thin start&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Fork the git repository mentioned above&lt;br /&gt;
&lt;br /&gt;
#Clone the repository to your local machine&lt;br /&gt;
Install [http://brew.sh/ Homebrew]&lt;br /&gt;
&lt;br /&gt;
#Install RBENV&lt;br /&gt;
brew update&lt;br /&gt;
brew install rbenv&lt;br /&gt;
brew install ruby-build&lt;br /&gt;
&lt;br /&gt;
#Install dependencies&lt;br /&gt;
brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
&lt;br /&gt;
#Install gems&lt;br /&gt;
export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
#Change yml files&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
&lt;br /&gt;
#Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
&lt;br /&gt;
#Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
&lt;br /&gt;
#Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
mysql -uroot -p&lt;br /&gt;
&lt;br /&gt;
#Create expertiza user&lt;br /&gt;
create user expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Create the databases&lt;br /&gt;
create database pg_development;&lt;br /&gt;
create database pg_test;&lt;br /&gt;
&lt;br /&gt;
#Set privileges for expertiza user&lt;br /&gt;
grant all on pg_development.to expertiza@localhost;&lt;br /&gt;
grant all on pg_test.to expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Install javascript libraries&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
sudo npm install bower&lt;br /&gt;
bower install&lt;br /&gt;
&lt;br /&gt;
#Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
&lt;br /&gt;
#Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:migrate&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:test:prepare&lt;br /&gt;
&lt;br /&gt;
#Run rails s&lt;br /&gt;
&lt;br /&gt;
#Open browser and test localhost:3000&lt;br /&gt;
&lt;br /&gt;
#Login credentials&lt;br /&gt;
Username - instructor6&lt;br /&gt;
Password - password&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There is a partial coverage of suggstion_controller using feature test and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
==='''Refactoring''' ===&lt;br /&gt;
There were lot of trailing spaces in the code, which are removed. Few lines were too long and one had to scroll right to go through that line. This was taken care of. We have also edited the messages, making them more readable and logical. Also, the unused methods in the code were removed. &lt;br /&gt;
&lt;br /&gt;
The comments were added for future readability.&lt;br /&gt;
&lt;br /&gt;
=== '''Email functionality''' ===&lt;br /&gt;
The email functionality which wasn't working before has been fixed. These are the cases considered:&lt;br /&gt;
Instructor starts a new assignment with some topics&lt;br /&gt;
* Student signs up for one topic, suggests a new one but doesn't want to work on it. Then the student receives a mail once the instructor approves.&lt;br /&gt;
* Student doesn't sign up for a topic and suggests a new one. If the student opts to work on it, then on approval, a mail is sent. If the student doesn't want to work on it, then no mail is sent even on approval. &lt;br /&gt;
* It is a team project - if there is already a team and they come up with a new topic and want to work on it, then a mail is sent on approval. If there isn't a team and a student suggests a new topic, a topic is assigned on approval and also a team of students who choose that topic. In this case, there is no email notification.&lt;br /&gt;
* A team project - there is a team and they suggest a topic but choose not to work on it and also they haven't signed up for a topic. In this case, upon the acceptance of topic by the instructor, there is no email sent and they are supposed to sign up for a topic from the given set.&lt;br /&gt;
&lt;br /&gt;
Irrespective of teams and topic, if someone suggests a topic anonymously, there won't be any email notification on approval of the topic. The key point here is there should be a signup preference that should be set for the notification. &lt;br /&gt;
&lt;br /&gt;
We have used the following accounts for testing:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
* Login ID - instructor6                Password - password&lt;br /&gt;
* Student1 ID - student5432             Password - password&lt;br /&gt;
* Student2 Id - student5404             Password - password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The implementation can be seen in the video, where we covered few cases mentioned above.&lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
==== Scenario 6 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
*Test the integration of core functionalities of suggestion controller&lt;br /&gt;
*Have maximum code coverage&lt;br /&gt;
*Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“'''Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.'''” - Edsger Dijkstra&lt;br /&gt;
&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104343</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104343"/>
		<updated>2016-11-04T16:56:25Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Email functionality */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: &lt;br /&gt;
* app/views/mailer/suggested_topic_approved_message.html.erb&lt;br /&gt;
* spec/features/topic_suggestion2_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
The Docker has been setup on a Windows PC and steps are given below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start Docker on Windows&lt;br /&gt;
&lt;br /&gt;
docker run --expose 3000 -p 3000:3000 -v //c//Users//Srikar//Expertiza://c//Users//Srikar//Expertiza -it winbobob/expertiza-fall2016&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/mysql start   &lt;br /&gt;
mysql -uroot -p           &lt;br /&gt;
show databases;  &lt;br /&gt;
quit&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/srikarpotta/expertiza.git&lt;br /&gt;
cd expertiza&lt;br /&gt;
cp config/database.yml.example config/database.yml&lt;br /&gt;
cp config/secrets.yml.example config/secrets.yml&lt;br /&gt;
&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:migrate&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
npm install -g bower&lt;br /&gt;
&lt;br /&gt;
sudo rm /usr/bin/node&lt;br /&gt;
sudo ln –s /usr/bin/nodejs /usr/bin/node&lt;br /&gt;
bower install --allow-root&lt;br /&gt;
thin start&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Fork the git repository mentioned above&lt;br /&gt;
&lt;br /&gt;
#Clone the repository to your local machine&lt;br /&gt;
Install [http://brew.sh/ Homebrew]&lt;br /&gt;
&lt;br /&gt;
#Install RBENV&lt;br /&gt;
brew update&lt;br /&gt;
brew install rbenv&lt;br /&gt;
brew install ruby-build&lt;br /&gt;
&lt;br /&gt;
#Install dependencies&lt;br /&gt;
brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
&lt;br /&gt;
#Install gems&lt;br /&gt;
export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
#Change yml files&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
&lt;br /&gt;
#Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
&lt;br /&gt;
#Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
&lt;br /&gt;
#Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
mysql -uroot -p&lt;br /&gt;
&lt;br /&gt;
#Create expertiza user&lt;br /&gt;
create user expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Create the databases&lt;br /&gt;
create database pg_development;&lt;br /&gt;
create database pg_test;&lt;br /&gt;
&lt;br /&gt;
#Set privileges for expertiza user&lt;br /&gt;
grant all on pg_development.to expertiza@localhost;&lt;br /&gt;
grant all on pg_test.to expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Install javascript libraries&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
sudo npm install bower&lt;br /&gt;
bower install&lt;br /&gt;
&lt;br /&gt;
#Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
&lt;br /&gt;
#Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:migrate&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:test:prepare&lt;br /&gt;
&lt;br /&gt;
#Run rails s&lt;br /&gt;
&lt;br /&gt;
#Open browser and test localhost:3000&lt;br /&gt;
&lt;br /&gt;
#Login credentials&lt;br /&gt;
Username - instructor6&lt;br /&gt;
Password - password&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There is a partial coverage of suggstion_controller using feature test and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
==='''Refactoring''' ===&lt;br /&gt;
There were lot of trailing spaces in the code, which are removed. Few lines were too long and one had to scroll right to go through that line. This was taken care of. We have also edited the messages, making them more readable and logical. Also, the unused methods in the code were removed. &lt;br /&gt;
&lt;br /&gt;
The comments were added for future readability.&lt;br /&gt;
&lt;br /&gt;
=== '''Email functionality''' ===&lt;br /&gt;
The email functionality which wasn't working before has been fixed. These are the cases considered:&lt;br /&gt;
Instructor starts a new assignment with some topics&lt;br /&gt;
* Student signs up for one topic, suggests a new one but doesn't want to work on it. Then the student receives a mail once the instructor approves.&lt;br /&gt;
* Student doesn't sign up for a topic and suggests a new one. If the student opts to work on it, then on approval, a mail is sent. If the student doesn't want to work on it, then no mail is sent even on approval. &lt;br /&gt;
* It is a team project - if there is already a team and they come up with a new topic and want to work on it, then a mail is sent on approval. If there isn't a team and a student suggests a new topic, a topic is assigned on approval and also a team of students who choose that topic. In this case, there is no email notification.&lt;br /&gt;
* A team project - there is a team and they suggest a topic but choose not to work on it and also they haven't signed up for a topic. In this case, upon the acceptance of topic by the instructor, there is no email sent and they are supposed to sign up for a topic from the given set.&lt;br /&gt;
&lt;br /&gt;
Irrespective of teams and topic, if someone suggests a topic anonymously, there won't be any email notification on approval of the topic. The key point here is there should be a signup preference that should be set for the notification. &lt;br /&gt;
&lt;br /&gt;
We have used the following accounts for testing:&lt;br /&gt;
* Login ID - instructor6                Password - password&lt;br /&gt;
* Student1 ID - student5432             Password - password&lt;br /&gt;
* Student2 Id - student5404             Password - password&lt;br /&gt;
&lt;br /&gt;
The implementation can be seen in the video, where we covered few cases mentioned above.&lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
==== Scenario 6 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
*Test the integration of core functionalities of suggestion controller&lt;br /&gt;
*Have maximum code coverage&lt;br /&gt;
*Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“'''Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.'''” - Edsger Dijkstra&lt;br /&gt;
&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104342</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104342"/>
		<updated>2016-11-04T16:56:03Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Email functionality */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: &lt;br /&gt;
* app/views/mailer/suggested_topic_approved_message.html.erb&lt;br /&gt;
* spec/features/topic_suggestion2_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
The Docker has been setup on a Windows PC and steps are given below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start Docker on Windows&lt;br /&gt;
&lt;br /&gt;
docker run --expose 3000 -p 3000:3000 -v //c//Users//Srikar//Expertiza://c//Users//Srikar//Expertiza -it winbobob/expertiza-fall2016&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/mysql start   &lt;br /&gt;
mysql -uroot -p           &lt;br /&gt;
show databases;  &lt;br /&gt;
quit&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/srikarpotta/expertiza.git&lt;br /&gt;
cd expertiza&lt;br /&gt;
cp config/database.yml.example config/database.yml&lt;br /&gt;
cp config/secrets.yml.example config/secrets.yml&lt;br /&gt;
&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:migrate&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
npm install -g bower&lt;br /&gt;
&lt;br /&gt;
sudo rm /usr/bin/node&lt;br /&gt;
sudo ln –s /usr/bin/nodejs /usr/bin/node&lt;br /&gt;
bower install --allow-root&lt;br /&gt;
thin start&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Fork the git repository mentioned above&lt;br /&gt;
&lt;br /&gt;
#Clone the repository to your local machine&lt;br /&gt;
Install [http://brew.sh/ Homebrew]&lt;br /&gt;
&lt;br /&gt;
#Install RBENV&lt;br /&gt;
brew update&lt;br /&gt;
brew install rbenv&lt;br /&gt;
brew install ruby-build&lt;br /&gt;
&lt;br /&gt;
#Install dependencies&lt;br /&gt;
brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
&lt;br /&gt;
#Install gems&lt;br /&gt;
export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
#Change yml files&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
&lt;br /&gt;
#Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
&lt;br /&gt;
#Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
&lt;br /&gt;
#Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
mysql -uroot -p&lt;br /&gt;
&lt;br /&gt;
#Create expertiza user&lt;br /&gt;
create user expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Create the databases&lt;br /&gt;
create database pg_development;&lt;br /&gt;
create database pg_test;&lt;br /&gt;
&lt;br /&gt;
#Set privileges for expertiza user&lt;br /&gt;
grant all on pg_development.to expertiza@localhost;&lt;br /&gt;
grant all on pg_test.to expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Install javascript libraries&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
sudo npm install bower&lt;br /&gt;
bower install&lt;br /&gt;
&lt;br /&gt;
#Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
&lt;br /&gt;
#Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:migrate&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:test:prepare&lt;br /&gt;
&lt;br /&gt;
#Run rails s&lt;br /&gt;
&lt;br /&gt;
#Open browser and test localhost:3000&lt;br /&gt;
&lt;br /&gt;
#Login credentials&lt;br /&gt;
Username - instructor6&lt;br /&gt;
Password - password&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There is a partial coverage of suggstion_controller using feature test and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
==='''Refactoring''' ===&lt;br /&gt;
There were lot of trailing spaces in the code, which are removed. Few lines were too long and one had to scroll right to go through that line. This was taken care of. We have also edited the messages, making them more readable and logical. Also, the unused methods in the code were removed. &lt;br /&gt;
&lt;br /&gt;
The comments were added for future readability.&lt;br /&gt;
&lt;br /&gt;
=== '''Email functionality''' ===&lt;br /&gt;
The email functionality which wasn't working before has been fixed. These are the cases considered:&lt;br /&gt;
Instructor starts a new assignment with some topics&lt;br /&gt;
* Student signs up for one topic, suggests a new one but doesn't want to work on it. Then the student receives a mail once the instructor approves.&lt;br /&gt;
* Student doesn't sign up for a topic and suggests a new one. If the student opts to work on it, then on approval, a mail is sent. If the student doesn't want to work on it, then no mail is sent even on approval. &lt;br /&gt;
* It is a team project - if there is already a team and they come up with a new topic and want to work on it, then a mail is sent on approval. If there isn't a team and a student suggests a new topic, a topic is assigned on approval and also a team of students who choose that topic. In this case, there is no email notification.&lt;br /&gt;
* A team project - there is a team and they suggest a topic but choose not to work on it and also they haven't signed up for a topic. In this case, upon the acceptance of topic by the instructor, there is no email sent and they are supposed to sign up for a topic from the given set.&lt;br /&gt;
&lt;br /&gt;
Irrespective of teams and topic, if someone suggests a topic anonymously, there won't be any email notification on approval of the topic. The key point here is there should be a signup preference that should be set for the notification. &lt;br /&gt;
&lt;br /&gt;
We have used the following accounts for testing:&lt;br /&gt;
* Login ID - instructor6       Password - password&lt;br /&gt;
* Student1 ID - student5432    Password - password&lt;br /&gt;
* Student2 Id - student5404    Password - password&lt;br /&gt;
&lt;br /&gt;
The implementation can be seen in the video, where we covered few cases mentioned above.&lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
==== Scenario 6 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
*Test the integration of core functionalities of suggestion controller&lt;br /&gt;
*Have maximum code coverage&lt;br /&gt;
*Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“'''Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.'''” - Edsger Dijkstra&lt;br /&gt;
&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104341</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104341"/>
		<updated>2016-11-04T16:55:29Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Email functionality */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: &lt;br /&gt;
* app/views/mailer/suggested_topic_approved_message.html.erb&lt;br /&gt;
* spec/features/topic_suggestion2_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
The Docker has been setup on a Windows PC and steps are given below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start Docker on Windows&lt;br /&gt;
&lt;br /&gt;
docker run --expose 3000 -p 3000:3000 -v //c//Users//Srikar//Expertiza://c//Users//Srikar//Expertiza -it winbobob/expertiza-fall2016&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/mysql start   &lt;br /&gt;
mysql -uroot -p           &lt;br /&gt;
show databases;  &lt;br /&gt;
quit&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/srikarpotta/expertiza.git&lt;br /&gt;
cd expertiza&lt;br /&gt;
cp config/database.yml.example config/database.yml&lt;br /&gt;
cp config/secrets.yml.example config/secrets.yml&lt;br /&gt;
&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:migrate&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
npm install -g bower&lt;br /&gt;
&lt;br /&gt;
sudo rm /usr/bin/node&lt;br /&gt;
sudo ln –s /usr/bin/nodejs /usr/bin/node&lt;br /&gt;
bower install --allow-root&lt;br /&gt;
thin start&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Fork the git repository mentioned above&lt;br /&gt;
&lt;br /&gt;
#Clone the repository to your local machine&lt;br /&gt;
Install [http://brew.sh/ Homebrew]&lt;br /&gt;
&lt;br /&gt;
#Install RBENV&lt;br /&gt;
brew update&lt;br /&gt;
brew install rbenv&lt;br /&gt;
brew install ruby-build&lt;br /&gt;
&lt;br /&gt;
#Install dependencies&lt;br /&gt;
brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
&lt;br /&gt;
#Install gems&lt;br /&gt;
export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
#Change yml files&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
&lt;br /&gt;
#Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
&lt;br /&gt;
#Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
&lt;br /&gt;
#Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
mysql -uroot -p&lt;br /&gt;
&lt;br /&gt;
#Create expertiza user&lt;br /&gt;
create user expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Create the databases&lt;br /&gt;
create database pg_development;&lt;br /&gt;
create database pg_test;&lt;br /&gt;
&lt;br /&gt;
#Set privileges for expertiza user&lt;br /&gt;
grant all on pg_development.to expertiza@localhost;&lt;br /&gt;
grant all on pg_test.to expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Install javascript libraries&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
sudo npm install bower&lt;br /&gt;
bower install&lt;br /&gt;
&lt;br /&gt;
#Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
&lt;br /&gt;
#Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:migrate&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:test:prepare&lt;br /&gt;
&lt;br /&gt;
#Run rails s&lt;br /&gt;
&lt;br /&gt;
#Open browser and test localhost:3000&lt;br /&gt;
&lt;br /&gt;
#Login credentials&lt;br /&gt;
Username - instructor6&lt;br /&gt;
Password - password&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There is a partial coverage of suggstion_controller using feature test and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
==='''Refactoring''' ===&lt;br /&gt;
There were lot of trailing spaces in the code, which are removed. Few lines were too long and one had to scroll right to go through that line. This was taken care of. We have also edited the messages, making them more readable and logical. Also, the unused methods in the code were removed. &lt;br /&gt;
&lt;br /&gt;
The comments were added for future readability.&lt;br /&gt;
&lt;br /&gt;
=== '''Email functionality''' ===&lt;br /&gt;
The email functionality which wasn't working before has been fixed. These are the cases considered:&lt;br /&gt;
Instructor starts a new assignment with some topics&lt;br /&gt;
* Student signs up for one topic, suggests a new one but doesn't want to work on it. Then the student receives a mail once the instructor approves.&lt;br /&gt;
* Student doesn't sign up for a topic and suggests a new one. If the student opts to work on it, then on approval, a mail is sent. If the student doesn't want to work on it, then no mail is sent even on approval. &lt;br /&gt;
* It is a team project - if there is already a team and they come up with a new topic and want to work on it, then a mail is sent on approval. If there isn't a team and a student suggests a new topic, a topic is assigned on approval and also a team of students who choose that topic. In this case, there is no email notification.&lt;br /&gt;
* A team project - there is a team and they suggest a topic but choose not to work on it and also they haven't signed up for a topic. In this case, upon the acceptance of topic by the instructor, there is no email sent and they are supposed to sign up for a topic from the given set.&lt;br /&gt;
&lt;br /&gt;
Irrespective of teams and topic, if someone suggests a topic anonymously, there won't be any email notification on approval of the topic. The key point here is there should be a signup preference that should be set for the notification. &lt;br /&gt;
&lt;br /&gt;
We have used the following accounts for testing:&lt;br /&gt;
* Login ID - instructor6&lt;br /&gt;
  Password - password&lt;br /&gt;
* Student1 ID - student5432&lt;br /&gt;
  Password - password&lt;br /&gt;
* Student2 Id - student5404&lt;br /&gt;
  Password - password&lt;br /&gt;
&lt;br /&gt;
The implementation can be seen in the video, where we covered few cases mentioned above.&lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
==== Scenario 6 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
*Test the integration of core functionalities of suggestion controller&lt;br /&gt;
*Have maximum code coverage&lt;br /&gt;
*Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“'''Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.'''” - Edsger Dijkstra&lt;br /&gt;
&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104340</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104340"/>
		<updated>2016-11-04T16:53:34Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Email functionality */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: &lt;br /&gt;
* app/views/mailer/suggested_topic_approved_message.html.erb&lt;br /&gt;
* spec/features/topic_suggestion2_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
The Docker has been setup on a Windows PC and steps are given below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start Docker on Windows&lt;br /&gt;
&lt;br /&gt;
docker run --expose 3000 -p 3000:3000 -v //c//Users//Srikar//Expertiza://c//Users//Srikar//Expertiza -it winbobob/expertiza-fall2016&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/mysql start   &lt;br /&gt;
mysql -uroot -p           &lt;br /&gt;
show databases;  &lt;br /&gt;
quit&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/srikarpotta/expertiza.git&lt;br /&gt;
cd expertiza&lt;br /&gt;
cp config/database.yml.example config/database.yml&lt;br /&gt;
cp config/secrets.yml.example config/secrets.yml&lt;br /&gt;
&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:migrate&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
npm install -g bower&lt;br /&gt;
&lt;br /&gt;
sudo rm /usr/bin/node&lt;br /&gt;
sudo ln –s /usr/bin/nodejs /usr/bin/node&lt;br /&gt;
bower install --allow-root&lt;br /&gt;
thin start&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Fork the git repository mentioned above&lt;br /&gt;
&lt;br /&gt;
#Clone the repository to your local machine&lt;br /&gt;
Install [http://brew.sh/ Homebrew]&lt;br /&gt;
&lt;br /&gt;
#Install RBENV&lt;br /&gt;
brew update&lt;br /&gt;
brew install rbenv&lt;br /&gt;
brew install ruby-build&lt;br /&gt;
&lt;br /&gt;
#Install dependencies&lt;br /&gt;
brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
&lt;br /&gt;
#Install gems&lt;br /&gt;
export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
#Change yml files&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
&lt;br /&gt;
#Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
&lt;br /&gt;
#Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
&lt;br /&gt;
#Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
mysql -uroot -p&lt;br /&gt;
&lt;br /&gt;
#Create expertiza user&lt;br /&gt;
create user expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Create the databases&lt;br /&gt;
create database pg_development;&lt;br /&gt;
create database pg_test;&lt;br /&gt;
&lt;br /&gt;
#Set privileges for expertiza user&lt;br /&gt;
grant all on pg_development.to expertiza@localhost;&lt;br /&gt;
grant all on pg_test.to expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Install javascript libraries&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
sudo npm install bower&lt;br /&gt;
bower install&lt;br /&gt;
&lt;br /&gt;
#Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
&lt;br /&gt;
#Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:migrate&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:test:prepare&lt;br /&gt;
&lt;br /&gt;
#Run rails s&lt;br /&gt;
&lt;br /&gt;
#Open browser and test localhost:3000&lt;br /&gt;
&lt;br /&gt;
#Login credentials&lt;br /&gt;
Username - instructor6&lt;br /&gt;
Password - password&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There is a partial coverage of suggstion_controller using feature test and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
==='''Refactoring''' ===&lt;br /&gt;
There were lot of trailing spaces in the code, which are removed. Few lines were too long and one had to scroll right to go through that line. This was taken care of. We have also edited the messages, making them more readable and logical. Also, the unused methods in the code were removed. &lt;br /&gt;
&lt;br /&gt;
The comments were added for future readability.&lt;br /&gt;
&lt;br /&gt;
=== '''Email functionality''' ===&lt;br /&gt;
The email functionality which wasn't working before has been fixed. These are the cases considered:&lt;br /&gt;
Instructor starts a new assignment with some topics&lt;br /&gt;
* Student signs up for one topic, suggests a new one but doesn't want to work on it. Then the student receives a mail once the instructor approves.&lt;br /&gt;
* Student doesn't sign up for a topic and suggests a new one. If the student opts to work on it, then on approval, a mail is sent. If the student doesn't want to work on it, then no mail is sent even on approval. &lt;br /&gt;
* It is a team project - if there is already a team and they come up with a new topic and want to work on it, then a mail is sent on approval. If there isn't a team and a student suggests a new topic, a topic is assigned on approval and also a team of students who choose that topic. In this case, there is no email notification.&lt;br /&gt;
* A team project - there is a team and they suggest a topic but choose not to work on it and also they haven't signed up for a topic. In this case, upon the acceptance of topic by the instructor, there is no email sent and they are supposed to sign up for a topic from the given set.&lt;br /&gt;
&lt;br /&gt;
Irrespective of teams and topic, if someone suggests a topic anonymously, there won't be any email notification on approval of the topic. The key point here is there should be a signup preference that should be set for the notification. &lt;br /&gt;
&lt;br /&gt;
We have used the following accounts for testing:&lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
==== Scenario 6 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
*Test the integration of core functionalities of suggestion controller&lt;br /&gt;
*Have maximum code coverage&lt;br /&gt;
*Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“'''Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.'''” - Edsger Dijkstra&lt;br /&gt;
&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104336</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104336"/>
		<updated>2016-11-04T16:42:28Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Email functionality */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: &lt;br /&gt;
* app/views/mailer/suggested_topic_approved_message.html.erb&lt;br /&gt;
* spec/features/topic_suggestion2_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
The Docker has been setup on a Windows PC and steps are given below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start Docker on Windows&lt;br /&gt;
&lt;br /&gt;
docker run --expose 3000 -p 3000:3000 -v //c//Users//Srikar//Expertiza://c//Users//Srikar//Expertiza -it winbobob/expertiza-fall2016&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/mysql start   &lt;br /&gt;
mysql -uroot -p           &lt;br /&gt;
show databases;  &lt;br /&gt;
quit&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/srikarpotta/expertiza.git&lt;br /&gt;
cd expertiza&lt;br /&gt;
cp config/database.yml.example config/database.yml&lt;br /&gt;
cp config/secrets.yml.example config/secrets.yml&lt;br /&gt;
&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:migrate&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
npm install -g bower&lt;br /&gt;
&lt;br /&gt;
sudo rm /usr/bin/node&lt;br /&gt;
sudo ln –s /usr/bin/nodejs /usr/bin/node&lt;br /&gt;
bower install --allow-root&lt;br /&gt;
thin start&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Fork the git repository mentioned above&lt;br /&gt;
&lt;br /&gt;
#Clone the repository to your local machine&lt;br /&gt;
Install [http://brew.sh/ Homebrew]&lt;br /&gt;
&lt;br /&gt;
#Install RBENV&lt;br /&gt;
brew update&lt;br /&gt;
brew install rbenv&lt;br /&gt;
brew install ruby-build&lt;br /&gt;
&lt;br /&gt;
#Install dependencies&lt;br /&gt;
brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
&lt;br /&gt;
#Install gems&lt;br /&gt;
export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
#Change yml files&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
&lt;br /&gt;
#Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
&lt;br /&gt;
#Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
&lt;br /&gt;
#Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
mysql -uroot -p&lt;br /&gt;
&lt;br /&gt;
#Create expertiza user&lt;br /&gt;
create user expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Create the databases&lt;br /&gt;
create database pg_development;&lt;br /&gt;
create database pg_test;&lt;br /&gt;
&lt;br /&gt;
#Set privileges for expertiza user&lt;br /&gt;
grant all on pg_development.to expertiza@localhost;&lt;br /&gt;
grant all on pg_test.to expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Install javascript libraries&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
sudo npm install bower&lt;br /&gt;
bower install&lt;br /&gt;
&lt;br /&gt;
#Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
&lt;br /&gt;
#Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:migrate&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:test:prepare&lt;br /&gt;
&lt;br /&gt;
#Run rails s&lt;br /&gt;
&lt;br /&gt;
#Open browser and test localhost:3000&lt;br /&gt;
&lt;br /&gt;
#Login credentials&lt;br /&gt;
Username - instructor6&lt;br /&gt;
Password - password&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There is a partial coverage of suggstion_controller using feature test and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
==='''Refactoring''' ===&lt;br /&gt;
There were lot of trailing spaces in the code, which are removed. Few lines were too long and one had to scroll right to go through that line. This was taken care of. We have also edited the messages, making them more readable and logical. Also, the unused methods in the code were removed. &lt;br /&gt;
&lt;br /&gt;
The comments were added for future readability.&lt;br /&gt;
&lt;br /&gt;
=== '''Email functionality''' ===&lt;br /&gt;
The email functionality which wasn't working before has been fixed. These are the cases considered:&lt;br /&gt;
Instructor starts a new assignment with some topics&lt;br /&gt;
* Student signs up for one topic, suggests a new one but doesn't want to work on it. Then the student receives a mail once the instructor approves.&lt;br /&gt;
* Student doesn't sign up for a topic and suggests a new one. If the student opts to work on it, then on approval, a mail is sent. If the student doesn't want to work on it, then no mail is sent even on approval. &lt;br /&gt;
* It is a team project - if there is already a team and they come up with a new topic and want to work on it, then a mail is sent on approval. If there isn't a team and a student suggests a new topic, a topic is assigned on approval and also a team of students who choose that topic. In this case, there is no email notification.&lt;br /&gt;
* A team project - there is a team and they suggest a topic but choose not to work on it and also they haven't signed up for a topic. In this case, upon the acceptance of topic by the instructor, there is no email sent and they are supposed to sign up for a topic from the given set.&lt;br /&gt;
&lt;br /&gt;
Irrespective of teams and topic, if someone suggests a topic anonymously, there won't be any email notification on approval of the topic.&lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
==== Scenario 6 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
*Test the integration of core functionalities of suggestion controller&lt;br /&gt;
*Have maximum code coverage&lt;br /&gt;
*Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“'''Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.'''” - Edsger Dijkstra&lt;br /&gt;
&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104335</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=104335"/>
		<updated>2016-11-04T16:35:32Z</updated>

		<summary type="html">&lt;p&gt;Spotta: email&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: &lt;br /&gt;
* app/views/mailer/suggested_topic_approved_message.html.erb&lt;br /&gt;
* spec/features/topic_suggestion2_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
The Docker has been setup on a Windows PC and steps are given below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start Docker on Windows&lt;br /&gt;
&lt;br /&gt;
docker run --expose 3000 -p 3000:3000 -v //c//Users//Srikar//Expertiza://c//Users//Srikar//Expertiza -it winbobob/expertiza-fall2016&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/mysql start   &lt;br /&gt;
mysql -uroot -p           &lt;br /&gt;
show databases;  &lt;br /&gt;
quit&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/srikarpotta/expertiza.git&lt;br /&gt;
cd expertiza&lt;br /&gt;
cp config/database.yml.example config/database.yml&lt;br /&gt;
cp config/secrets.yml.example config/secrets.yml&lt;br /&gt;
&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:migrate&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
npm install -g bower&lt;br /&gt;
&lt;br /&gt;
sudo rm /usr/bin/node&lt;br /&gt;
sudo ln –s /usr/bin/nodejs /usr/bin/node&lt;br /&gt;
bower install --allow-root&lt;br /&gt;
thin start&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Fork the git repository mentioned above&lt;br /&gt;
&lt;br /&gt;
#Clone the repository to your local machine&lt;br /&gt;
Install [http://brew.sh/ Homebrew]&lt;br /&gt;
&lt;br /&gt;
#Install RBENV&lt;br /&gt;
brew update&lt;br /&gt;
brew install rbenv&lt;br /&gt;
brew install ruby-build&lt;br /&gt;
&lt;br /&gt;
#Install dependencies&lt;br /&gt;
brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
&lt;br /&gt;
#Install gems&lt;br /&gt;
export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
#Change yml files&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
&lt;br /&gt;
#Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
&lt;br /&gt;
#Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
&lt;br /&gt;
#Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
mysql -uroot -p&lt;br /&gt;
&lt;br /&gt;
#Create expertiza user&lt;br /&gt;
create user expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Create the databases&lt;br /&gt;
create database pg_development;&lt;br /&gt;
create database pg_test;&lt;br /&gt;
&lt;br /&gt;
#Set privileges for expertiza user&lt;br /&gt;
grant all on pg_development.to expertiza@localhost;&lt;br /&gt;
grant all on pg_test.to expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Install javascript libraries&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
sudo npm install bower&lt;br /&gt;
bower install&lt;br /&gt;
&lt;br /&gt;
#Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
&lt;br /&gt;
#Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:migrate&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:test:prepare&lt;br /&gt;
&lt;br /&gt;
#Run rails s&lt;br /&gt;
&lt;br /&gt;
#Open browser and test localhost:3000&lt;br /&gt;
&lt;br /&gt;
#Login credentials&lt;br /&gt;
Username - instructor6&lt;br /&gt;
Password - password&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There is a partial coverage of suggstion_controller using feature test and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
==='''Refactoring''' ===&lt;br /&gt;
There were lot of trailing spaces in the code, which are removed. Few lines were too long and one had to scroll right to go through that line. This was taken care of. We have also edited the messages, making them more readable and logical. Also, the unused methods in the code were removed. &lt;br /&gt;
&lt;br /&gt;
The comments were added for future readability.&lt;br /&gt;
&lt;br /&gt;
=== '''Email functionality''' ===&lt;br /&gt;
The email functionality which wasn't working before has been fixed. These are the cases considered:&lt;br /&gt;
* Instructor starts a new assignment with some topics -&amp;gt; Student signs up for one topic, suggests a new one but doesn't want to work on it. &lt;br /&gt;
Then the student receives a mail once the instructor approves.&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
==== Scenario 6 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
*Test the integration of core functionalities of suggestion controller&lt;br /&gt;
*Have maximum code coverage&lt;br /&gt;
*Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“'''Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.'''” - Edsger Dijkstra&lt;br /&gt;
&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103566</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103566"/>
		<updated>2016-10-29T01:25:36Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* On a Local Machine */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: app/views/mailer/suggested_topic_approved_message.html.erb, suggestion_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
The Docker has been setup on a Windows PC and steps are given below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start Docker on Windows&lt;br /&gt;
&lt;br /&gt;
docker run --expose 3000 -p 3000:3000 -v //c//Users//Srikar//Expertiza://c//Users//Srikar//Expertiza -it winbobob/expertiza-fall2016&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/mysql start   &lt;br /&gt;
mysql -uroot -p           &lt;br /&gt;
show databases;  &lt;br /&gt;
quit&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/srikarpotta/expertiza.git&lt;br /&gt;
cd expertiza&lt;br /&gt;
cp config/database.yml.example config/database.yml&lt;br /&gt;
cp config/secrets.yml.example config/secrets.yml&lt;br /&gt;
&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:migrate&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
npm install -g bower&lt;br /&gt;
&lt;br /&gt;
sudo rm /usr/bin/node&lt;br /&gt;
sudo ln –s /usr/bin/nodejs /usr/bin/node&lt;br /&gt;
bower install --allow-root&lt;br /&gt;
thin start&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Fork the git repository mentioned above&lt;br /&gt;
&lt;br /&gt;
#Clone the repository to your local machine&lt;br /&gt;
Install [http://brew.sh/ Homebrew]&lt;br /&gt;
&lt;br /&gt;
#Install RBENV&lt;br /&gt;
brew update&lt;br /&gt;
brew install rbenv&lt;br /&gt;
brew install ruby-build&lt;br /&gt;
&lt;br /&gt;
#Install dependencies&lt;br /&gt;
brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
&lt;br /&gt;
#Install gems&lt;br /&gt;
export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
bundle install&lt;br /&gt;
&lt;br /&gt;
#Change yml files&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
&lt;br /&gt;
#Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
&lt;br /&gt;
#Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
&lt;br /&gt;
#Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
&lt;br /&gt;
#Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
mysql -uroot -p&lt;br /&gt;
&lt;br /&gt;
#Create expertiza user&lt;br /&gt;
create user expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Create the databases&lt;br /&gt;
create database pg_development;&lt;br /&gt;
create database pg_test;&lt;br /&gt;
&lt;br /&gt;
#Set privileges for expertiza user&lt;br /&gt;
grant all on pg_development.to expertiza@localhost;&lt;br /&gt;
grant all on pg_test.to expertiza@localhost;&lt;br /&gt;
&lt;br /&gt;
#Install javascript libraries&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
sudo npm install bower&lt;br /&gt;
bower install&lt;br /&gt;
&lt;br /&gt;
#Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
&lt;br /&gt;
#Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:migrate&lt;br /&gt;
&lt;br /&gt;
#Run bundle exec rake db:test:prepare&lt;br /&gt;
&lt;br /&gt;
#Run rails s&lt;br /&gt;
&lt;br /&gt;
#Open browser and test localhost:3000&lt;br /&gt;
&lt;br /&gt;
#Login credentials&lt;br /&gt;
Username - instructor6&lt;br /&gt;
Password - password&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There weren't any test cases before and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
==== Scenario 6 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
Test the integration of core functionalities of suggestion controller&lt;br /&gt;
Have maximum code coverage&lt;br /&gt;
Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.” - Edsger Dijkstra&lt;br /&gt;
&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103561</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103561"/>
		<updated>2016-10-29T01:24:34Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* On a Local Machine */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: app/views/mailer/suggested_topic_approved_message.html.erb, suggestion_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
The Docker has been setup on a Windows PC and steps are given below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start Docker on Windows&lt;br /&gt;
&lt;br /&gt;
docker run --expose 3000 -p 3000:3000 -v //c//Users//Srikar//Expertiza://c//Users//Srikar//Expertiza -it winbobob/expertiza-fall2016&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/mysql start   &lt;br /&gt;
mysql -uroot -p           &lt;br /&gt;
show databases;  &lt;br /&gt;
quit&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/srikarpotta/expertiza.git&lt;br /&gt;
cd expertiza&lt;br /&gt;
cp config/database.yml.example config/database.yml&lt;br /&gt;
cp config/secrets.yml.example config/secrets.yml&lt;br /&gt;
&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:migrate&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
npm install -g bower&lt;br /&gt;
&lt;br /&gt;
sudo rm /usr/bin/node&lt;br /&gt;
sudo ln –s /usr/bin/nodejs /usr/bin/node&lt;br /&gt;
bower install --allow-root&lt;br /&gt;
thin start&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Fork the git repository mentioned above&lt;br /&gt;
#Clone the repository to your local machine&lt;br /&gt;
Install [http://brew.sh/ Homebrew]&lt;br /&gt;
#Install RBENV&lt;br /&gt;
brew update&lt;br /&gt;
brew install rbenv&lt;br /&gt;
brew install ruby-build&lt;br /&gt;
#Install dependencies&lt;br /&gt;
brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
#Install gems&lt;br /&gt;
export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
bundle install&lt;br /&gt;
#Change yml files&lt;br /&gt;
#Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
#Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
#Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
#Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
#Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
mysql -uroot -p&lt;br /&gt;
#Create expertiza user&lt;br /&gt;
create user expertiza@localhost;&lt;br /&gt;
#Create the databases&lt;br /&gt;
create database pg_development;&lt;br /&gt;
create database pg_test;&lt;br /&gt;
#Set privileges for expertiza user&lt;br /&gt;
grant all on pg_development.to expertiza@localhost;&lt;br /&gt;
grant all on pg_test.to expertiza@localhost;&lt;br /&gt;
#Install javascript libraries&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
sudo npm install bower&lt;br /&gt;
bower install&lt;br /&gt;
#Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
#Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
#Run bundle exec rake db:migrate&lt;br /&gt;
#Run bundle exec rake db:test:prepare&lt;br /&gt;
#Run rails s&lt;br /&gt;
#Open browser and test localhost:3000&lt;br /&gt;
#Login credentials&lt;br /&gt;
	Username - instructor6&lt;br /&gt;
	Password - password&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There weren't any test cases before and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
==== Scenario 6 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
Test the integration of core functionalities of suggestion controller&lt;br /&gt;
Have maximum code coverage&lt;br /&gt;
Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.” - Edsger Dijkstra&lt;br /&gt;
&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103556</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103556"/>
		<updated>2016-10-29T01:21:44Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* On a Local Machine */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: app/views/mailer/suggested_topic_approved_message.html.erb, suggestion_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
The Docker has been setup on a Windows PC and steps are given below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start Docker on Windows&lt;br /&gt;
&lt;br /&gt;
docker run --expose 3000 -p 3000:3000 -v //c//Users//Srikar//Expertiza://c//Users//Srikar//Expertiza -it winbobob/expertiza-fall2016&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/mysql start   &lt;br /&gt;
mysql -uroot -p           &lt;br /&gt;
show databases;  &lt;br /&gt;
quit&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/srikarpotta/expertiza.git&lt;br /&gt;
cd expertiza&lt;br /&gt;
cp config/database.yml.example config/database.yml&lt;br /&gt;
cp config/secrets.yml.example config/secrets.yml&lt;br /&gt;
&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:migrate&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
npm install -g bower&lt;br /&gt;
&lt;br /&gt;
sudo rm /usr/bin/node&lt;br /&gt;
sudo ln –s /usr/bin/nodejs /usr/bin/node&lt;br /&gt;
bower install --allow-root&lt;br /&gt;
thin start&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fork the git repository mentioned above&lt;br /&gt;
Clone the repository to your local machine&lt;br /&gt;
Install [http://brew.sh/ Homebrew]&lt;br /&gt;
Install RBENV&lt;br /&gt;
brew update&lt;br /&gt;
brew install rbenv&lt;br /&gt;
brew install ruby-build&lt;br /&gt;
Install dependencies&lt;br /&gt;
brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
Install gems&lt;br /&gt;
export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
bundle install&lt;br /&gt;
Change yml files&lt;br /&gt;
Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
mysql -uroot -p&lt;br /&gt;
Create expertiza user&lt;br /&gt;
create user expertiza@localhost;&lt;br /&gt;
Create the databases&lt;br /&gt;
create database pg_development;&lt;br /&gt;
create database pg_test;&lt;br /&gt;
Set privileges for expertiza user&lt;br /&gt;
grant all on pg_development.to expertiza@localhost;&lt;br /&gt;
grant all on pg_test.to expertiza@localhost;&lt;br /&gt;
Install javascript libraries&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
sudo npm install bower&lt;br /&gt;
bower install&lt;br /&gt;
Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
Run bundle exec rake db:migrate&lt;br /&gt;
Run bundle exec rake db:test:prepare&lt;br /&gt;
Run rails s&lt;br /&gt;
Open browser and test localhost:3000&lt;br /&gt;
Login credentials&lt;br /&gt;
Username - instructor6&lt;br /&gt;
Password - password&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There weren't any test cases before and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
==== Scenario 6 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
Test the integration of core functionalities of suggestion controller&lt;br /&gt;
Have maximum code coverage&lt;br /&gt;
Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.” - Edsger Dijkstra&lt;br /&gt;
&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103554</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103554"/>
		<updated>2016-10-29T01:20:23Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Docker */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: app/views/mailer/suggested_topic_approved_message.html.erb, suggestion_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
The Docker has been setup on a Windows PC and steps are given below&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Start Docker on Windows&lt;br /&gt;
&lt;br /&gt;
docker run --expose 3000 -p 3000:3000 -v //c//Users//Srikar//Expertiza://c//Users//Srikar//Expertiza -it winbobob/expertiza-fall2016&lt;br /&gt;
&lt;br /&gt;
/etc/init.d/mysql start   &lt;br /&gt;
mysql -uroot -p           &lt;br /&gt;
show databases;  &lt;br /&gt;
quit&lt;br /&gt;
&lt;br /&gt;
git clone https://github.com/srikarpotta/expertiza.git&lt;br /&gt;
cd expertiza&lt;br /&gt;
cp config/database.yml.example config/database.yml&lt;br /&gt;
cp config/secrets.yml.example config/secrets.yml&lt;br /&gt;
&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:migrate&lt;br /&gt;
sudo apt-get install npm&lt;br /&gt;
npm install -g bower&lt;br /&gt;
&lt;br /&gt;
sudo rm /usr/bin/node&lt;br /&gt;
sudo ln –s /usr/bin/nodejs /usr/bin/node&lt;br /&gt;
bower install --allow-root&lt;br /&gt;
thin start&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
* Fork the git repository mentioned above&lt;br /&gt;
* Clone the repository to your local machine&lt;br /&gt;
* Install [http://brew.sh/ Homebrew]&lt;br /&gt;
* Install RBENV&lt;br /&gt;
** brew update&lt;br /&gt;
** brew install rbenv&lt;br /&gt;
** brew install ruby-build&lt;br /&gt;
* Install dependencies&lt;br /&gt;
** brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
* Install gems&lt;br /&gt;
** export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
** bundle install&lt;br /&gt;
* Change yml files&lt;br /&gt;
** Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
** Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
** Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
* Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
* Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
** mysql -uroot -p&lt;br /&gt;
* Create expertiza user&lt;br /&gt;
** create user expertiza@localhost;&lt;br /&gt;
* Create the databases&lt;br /&gt;
** create database pg_development;&lt;br /&gt;
** create database pg_test;&lt;br /&gt;
* Set privileges for expertiza user&lt;br /&gt;
** grant all on pg_development.* to expertiza@localhost;&lt;br /&gt;
** grant all on pg_test.* to expertiza@localhost;&lt;br /&gt;
* Install javascript libraries&lt;br /&gt;
** sudo apt-get install npm&lt;br /&gt;
** sudo npm install bower&lt;br /&gt;
** bower install&lt;br /&gt;
* Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
* Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
* Run bundle exec rake db:migrate&lt;br /&gt;
* Run bundle exec rake db:test:prepare&lt;br /&gt;
* Run rails s&lt;br /&gt;
* Open browser and test localhost:3000&lt;br /&gt;
* Login credentials&lt;br /&gt;
** Username - instructor6&lt;br /&gt;
** Password - password&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There weren't any test cases before and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
==== Scenario 6 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
Test the integration of core functionalities of suggestion controller&lt;br /&gt;
Have maximum code coverage&lt;br /&gt;
Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.” - Edsger Dijkstra&lt;br /&gt;
&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103552</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103552"/>
		<updated>2016-10-29T01:19:08Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* What’s next? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: app/views/mailer/suggested_topic_approved_message.html.erb, suggestion_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
* Fork the git repository mentioned above&lt;br /&gt;
* Clone the repository to your local machine&lt;br /&gt;
* Install [http://brew.sh/ Homebrew]&lt;br /&gt;
* Install RBENV&lt;br /&gt;
** brew update&lt;br /&gt;
** brew install rbenv&lt;br /&gt;
** brew install ruby-build&lt;br /&gt;
* Install dependencies&lt;br /&gt;
** brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
* Install gems&lt;br /&gt;
** export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
** bundle install&lt;br /&gt;
* Change yml files&lt;br /&gt;
** Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
** Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
** Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
* Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
* Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
** mysql -uroot -p&lt;br /&gt;
* Create expertiza user&lt;br /&gt;
** create user expertiza@localhost;&lt;br /&gt;
* Create the databases&lt;br /&gt;
** create database pg_development;&lt;br /&gt;
** create database pg_test;&lt;br /&gt;
* Set privileges for expertiza user&lt;br /&gt;
** grant all on pg_development.* to expertiza@localhost;&lt;br /&gt;
** grant all on pg_test.* to expertiza@localhost;&lt;br /&gt;
* Install javascript libraries&lt;br /&gt;
** sudo apt-get install npm&lt;br /&gt;
** sudo npm install bower&lt;br /&gt;
** bower install&lt;br /&gt;
* Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
* Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
* Run bundle exec rake db:migrate&lt;br /&gt;
* Run bundle exec rake db:test:prepare&lt;br /&gt;
* Run rails s&lt;br /&gt;
* Open browser and test localhost:3000&lt;br /&gt;
* Login credentials&lt;br /&gt;
** Username - instructor6&lt;br /&gt;
** Password - password&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There weren't any test cases before and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
==== Scenario 6 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
Test the integration of core functionalities of suggestion controller&lt;br /&gt;
Have maximum code coverage&lt;br /&gt;
Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.” - Edsger Dijkstra&lt;br /&gt;
&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103551</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103551"/>
		<updated>2016-10-29T01:18:43Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Scenario 6 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: app/views/mailer/suggested_topic_approved_message.html.erb, suggestion_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
* Fork the git repository mentioned above&lt;br /&gt;
* Clone the repository to your local machine&lt;br /&gt;
* Install [http://brew.sh/ Homebrew]&lt;br /&gt;
* Install RBENV&lt;br /&gt;
** brew update&lt;br /&gt;
** brew install rbenv&lt;br /&gt;
** brew install ruby-build&lt;br /&gt;
* Install dependencies&lt;br /&gt;
** brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
* Install gems&lt;br /&gt;
** export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
** bundle install&lt;br /&gt;
* Change yml files&lt;br /&gt;
** Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
** Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
** Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
* Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
* Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
** mysql -uroot -p&lt;br /&gt;
* Create expertiza user&lt;br /&gt;
** create user expertiza@localhost;&lt;br /&gt;
* Create the databases&lt;br /&gt;
** create database pg_development;&lt;br /&gt;
** create database pg_test;&lt;br /&gt;
* Set privileges for expertiza user&lt;br /&gt;
** grant all on pg_development.* to expertiza@localhost;&lt;br /&gt;
** grant all on pg_test.* to expertiza@localhost;&lt;br /&gt;
* Install javascript libraries&lt;br /&gt;
** sudo apt-get install npm&lt;br /&gt;
** sudo npm install bower&lt;br /&gt;
** bower install&lt;br /&gt;
* Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
* Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
* Run bundle exec rake db:migrate&lt;br /&gt;
* Run bundle exec rake db:test:prepare&lt;br /&gt;
* Run rails s&lt;br /&gt;
* Open browser and test localhost:3000&lt;br /&gt;
* Login credentials&lt;br /&gt;
** Username - instructor6&lt;br /&gt;
** Password - password&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There weren't any test cases before and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
==== Scenario 6 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
Test the integration of core functionalities of suggestion controller&lt;br /&gt;
Have maximum code coverage&lt;br /&gt;
Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.” - Edsger Dijkstra&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103549</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103549"/>
		<updated>2016-10-29T01:18:29Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Scenario 5 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: app/views/mailer/suggested_topic_approved_message.html.erb, suggestion_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
* Fork the git repository mentioned above&lt;br /&gt;
* Clone the repository to your local machine&lt;br /&gt;
* Install [http://brew.sh/ Homebrew]&lt;br /&gt;
* Install RBENV&lt;br /&gt;
** brew update&lt;br /&gt;
** brew install rbenv&lt;br /&gt;
** brew install ruby-build&lt;br /&gt;
* Install dependencies&lt;br /&gt;
** brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
* Install gems&lt;br /&gt;
** export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
** bundle install&lt;br /&gt;
* Change yml files&lt;br /&gt;
** Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
** Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
** Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
* Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
* Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
** mysql -uroot -p&lt;br /&gt;
* Create expertiza user&lt;br /&gt;
** create user expertiza@localhost;&lt;br /&gt;
* Create the databases&lt;br /&gt;
** create database pg_development;&lt;br /&gt;
** create database pg_test;&lt;br /&gt;
* Set privileges for expertiza user&lt;br /&gt;
** grant all on pg_development.* to expertiza@localhost;&lt;br /&gt;
** grant all on pg_test.* to expertiza@localhost;&lt;br /&gt;
* Install javascript libraries&lt;br /&gt;
** sudo apt-get install npm&lt;br /&gt;
** sudo npm install bower&lt;br /&gt;
** bower install&lt;br /&gt;
* Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
* Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
* Run bundle exec rake db:migrate&lt;br /&gt;
* Run bundle exec rake db:test:prepare&lt;br /&gt;
* Run rails s&lt;br /&gt;
* Open browser and test localhost:3000&lt;br /&gt;
* Login credentials&lt;br /&gt;
** Username - instructor6&lt;br /&gt;
** Password - password&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There weren't any test cases before and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
==== Scenario 5 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
=== Scenario 6 ===&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
Test the integration of core functionalities of suggestion controller&lt;br /&gt;
Have maximum code coverage&lt;br /&gt;
Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.” - Edsger Dijkstra&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103548</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103548"/>
		<updated>2016-10-29T01:18:15Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Scenario 4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: app/views/mailer/suggested_topic_approved_message.html.erb, suggestion_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
* Fork the git repository mentioned above&lt;br /&gt;
* Clone the repository to your local machine&lt;br /&gt;
* Install [http://brew.sh/ Homebrew]&lt;br /&gt;
* Install RBENV&lt;br /&gt;
** brew update&lt;br /&gt;
** brew install rbenv&lt;br /&gt;
** brew install ruby-build&lt;br /&gt;
* Install dependencies&lt;br /&gt;
** brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
* Install gems&lt;br /&gt;
** export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
** bundle install&lt;br /&gt;
* Change yml files&lt;br /&gt;
** Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
** Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
** Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
* Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
* Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
** mysql -uroot -p&lt;br /&gt;
* Create expertiza user&lt;br /&gt;
** create user expertiza@localhost;&lt;br /&gt;
* Create the databases&lt;br /&gt;
** create database pg_development;&lt;br /&gt;
** create database pg_test;&lt;br /&gt;
* Set privileges for expertiza user&lt;br /&gt;
** grant all on pg_development.* to expertiza@localhost;&lt;br /&gt;
** grant all on pg_test.* to expertiza@localhost;&lt;br /&gt;
* Install javascript libraries&lt;br /&gt;
** sudo apt-get install npm&lt;br /&gt;
** sudo npm install bower&lt;br /&gt;
** bower install&lt;br /&gt;
* Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
* Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
* Run bundle exec rake db:migrate&lt;br /&gt;
* Run bundle exec rake db:test:prepare&lt;br /&gt;
* Run rails s&lt;br /&gt;
* Open browser and test localhost:3000&lt;br /&gt;
* Login credentials&lt;br /&gt;
** Username - instructor6&lt;br /&gt;
** Password - password&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There weren't any test cases before and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
=== Scenario 5 ===&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
=== Scenario 6 ===&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
Test the integration of core functionalities of suggestion controller&lt;br /&gt;
Have maximum code coverage&lt;br /&gt;
Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.” - Edsger Dijkstra&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103545</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103545"/>
		<updated>2016-10-29T01:17:40Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Scenario 3 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: app/views/mailer/suggested_topic_approved_message.html.erb, suggestion_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
* Fork the git repository mentioned above&lt;br /&gt;
* Clone the repository to your local machine&lt;br /&gt;
* Install [http://brew.sh/ Homebrew]&lt;br /&gt;
* Install RBENV&lt;br /&gt;
** brew update&lt;br /&gt;
** brew install rbenv&lt;br /&gt;
** brew install ruby-build&lt;br /&gt;
* Install dependencies&lt;br /&gt;
** brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
* Install gems&lt;br /&gt;
** export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
** bundle install&lt;br /&gt;
* Change yml files&lt;br /&gt;
** Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
** Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
** Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
* Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
* Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
** mysql -uroot -p&lt;br /&gt;
* Create expertiza user&lt;br /&gt;
** create user expertiza@localhost;&lt;br /&gt;
* Create the databases&lt;br /&gt;
** create database pg_development;&lt;br /&gt;
** create database pg_test;&lt;br /&gt;
* Set privileges for expertiza user&lt;br /&gt;
** grant all on pg_development.* to expertiza@localhost;&lt;br /&gt;
** grant all on pg_test.* to expertiza@localhost;&lt;br /&gt;
* Install javascript libraries&lt;br /&gt;
** sudo apt-get install npm&lt;br /&gt;
** sudo npm install bower&lt;br /&gt;
** bower install&lt;br /&gt;
* Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
* Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
* Run bundle exec rake db:migrate&lt;br /&gt;
* Run bundle exec rake db:test:prepare&lt;br /&gt;
* Run rails s&lt;br /&gt;
* Open browser and test localhost:3000&lt;br /&gt;
* Login credentials&lt;br /&gt;
** Username - instructor6&lt;br /&gt;
** Password - password&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There weren't any test cases before and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 ====&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
=== Scenario 4 ===&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
=== Scenario 5 ===&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
=== Scenario 6 ===&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
Test the integration of core functionalities of suggestion controller&lt;br /&gt;
Have maximum code coverage&lt;br /&gt;
Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.” - Edsger Dijkstra&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103544</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103544"/>
		<updated>2016-10-29T01:17:08Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Scenario 6 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: app/views/mailer/suggested_topic_approved_message.html.erb, suggestion_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
* Fork the git repository mentioned above&lt;br /&gt;
* Clone the repository to your local machine&lt;br /&gt;
* Install [http://brew.sh/ Homebrew]&lt;br /&gt;
* Install RBENV&lt;br /&gt;
** brew update&lt;br /&gt;
** brew install rbenv&lt;br /&gt;
** brew install ruby-build&lt;br /&gt;
* Install dependencies&lt;br /&gt;
** brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
* Install gems&lt;br /&gt;
** export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
** bundle install&lt;br /&gt;
* Change yml files&lt;br /&gt;
** Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
** Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
** Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
* Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
* Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
** mysql -uroot -p&lt;br /&gt;
* Create expertiza user&lt;br /&gt;
** create user expertiza@localhost;&lt;br /&gt;
* Create the databases&lt;br /&gt;
** create database pg_development;&lt;br /&gt;
** create database pg_test;&lt;br /&gt;
* Set privileges for expertiza user&lt;br /&gt;
** grant all on pg_development.* to expertiza@localhost;&lt;br /&gt;
** grant all on pg_test.* to expertiza@localhost;&lt;br /&gt;
* Install javascript libraries&lt;br /&gt;
** sudo apt-get install npm&lt;br /&gt;
** sudo npm install bower&lt;br /&gt;
** bower install&lt;br /&gt;
* Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
* Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
* Run bundle exec rake db:migrate&lt;br /&gt;
* Run bundle exec rake db:test:prepare&lt;br /&gt;
* Run rails s&lt;br /&gt;
* Open browser and test localhost:3000&lt;br /&gt;
* Login credentials&lt;br /&gt;
** Username - instructor6&lt;br /&gt;
** Password - password&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There weren't any test cases before and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
=== Scenario 3 ===&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
=== Scenario 4 ===&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
=== Scenario 5 ===&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
=== Scenario 6 ===&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;br /&gt;
&lt;br /&gt;
=== Why these scenarios? ===&lt;br /&gt;
&lt;br /&gt;
The scenarios are carefully designed to fulfil the following criteria:&lt;br /&gt;
Test the integration of core functionalities of suggestion controller&lt;br /&gt;
Have maximum code coverage&lt;br /&gt;
Not to repeat scenarios developed by another contributor in topic_suggestion_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
=== What we learnt ===&lt;br /&gt;
* How to read existing codebases&lt;br /&gt;
* Understand other people’s code before contributing&lt;br /&gt;
* Refactor existing code without breaking existing functionalities&lt;br /&gt;
* Write integration test cases &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== What’s next? ===&lt;br /&gt;
&lt;br /&gt;
“Program testing can be a very effective way to show the presence of bugs, but is hopelessly inadequate for showing their absence.” - Edsger Dijkstra&lt;br /&gt;
Thus, the best way to uncover bugs lurking in our code is to come up with more scenarios and implement them. We have tested the most business critical scenarios and few edge cases were covered by creators of topic_suggestion_spec.rb. They only show the absence of bugs in the routes we are following to reach from point A to point B. However, many such scenarios exists which are not yet covered. We hope to extend our work further in future to cover many such scenarios.&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103540</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103540"/>
		<updated>2016-10-29T01:13:06Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Scenario 3 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: app/views/mailer/suggested_topic_approved_message.html.erb, suggestion_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
* Fork the git repository mentioned above&lt;br /&gt;
* Clone the repository to your local machine&lt;br /&gt;
* Install [http://brew.sh/ Homebrew]&lt;br /&gt;
* Install RBENV&lt;br /&gt;
** brew update&lt;br /&gt;
** brew install rbenv&lt;br /&gt;
** brew install ruby-build&lt;br /&gt;
* Install dependencies&lt;br /&gt;
** brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
* Install gems&lt;br /&gt;
** export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
** bundle install&lt;br /&gt;
* Change yml files&lt;br /&gt;
** Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
** Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
** Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
* Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
* Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
** mysql -uroot -p&lt;br /&gt;
* Create expertiza user&lt;br /&gt;
** create user expertiza@localhost;&lt;br /&gt;
* Create the databases&lt;br /&gt;
** create database pg_development;&lt;br /&gt;
** create database pg_test;&lt;br /&gt;
* Set privileges for expertiza user&lt;br /&gt;
** grant all on pg_development.* to expertiza@localhost;&lt;br /&gt;
** grant all on pg_test.* to expertiza@localhost;&lt;br /&gt;
* Install javascript libraries&lt;br /&gt;
** sudo apt-get install npm&lt;br /&gt;
** sudo npm install bower&lt;br /&gt;
** bower install&lt;br /&gt;
* Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
* Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
* Run bundle exec rake db:migrate&lt;br /&gt;
* Run bundle exec rake db:test:prepare&lt;br /&gt;
* Run rails s&lt;br /&gt;
* Open browser and test localhost:3000&lt;br /&gt;
* Login credentials&lt;br /&gt;
** Username - instructor6&lt;br /&gt;
** Password - password&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There weren't any test cases before and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
=== Scenario 3 ===&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;br /&gt;
&lt;br /&gt;
=== Scenario 4 ===&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 rejects the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks suggestion “Computer Vision” is rejected&lt;br /&gt;
&lt;br /&gt;
=== Scenario 5 ===&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt;Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064  -&amp;gt; Instructor votes for the suggestion  -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; Checks Instructor6 has voted for the suggestion&lt;br /&gt;
&lt;br /&gt;
=== Scenario 6 ===&lt;br /&gt;
Student2064 logs in and visits Assignment 1 -&amp;gt; Suggests “Computer Vision” -&amp;gt; Select “No” for suggestion signup preference -&amp;gt; Submits suggestion -&amp;gt; Instructor6 logs in and visits Assignment 1 suggestions -&amp;gt; Approves suggestion “Computer Vision” -&amp;gt; Checks suggestion approved successfully&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103530</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103530"/>
		<updated>2016-10-29T01:08:25Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Scenario 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: app/views/mailer/suggested_topic_approved_message.html.erb, suggestion_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
* Fork the git repository mentioned above&lt;br /&gt;
* Clone the repository to your local machine&lt;br /&gt;
* Install [http://brew.sh/ Homebrew]&lt;br /&gt;
* Install RBENV&lt;br /&gt;
** brew update&lt;br /&gt;
** brew install rbenv&lt;br /&gt;
** brew install ruby-build&lt;br /&gt;
* Install dependencies&lt;br /&gt;
** brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
* Install gems&lt;br /&gt;
** export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
** bundle install&lt;br /&gt;
* Change yml files&lt;br /&gt;
** Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
** Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
** Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
* Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
* Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
** mysql -uroot -p&lt;br /&gt;
* Create expertiza user&lt;br /&gt;
** create user expertiza@localhost;&lt;br /&gt;
* Create the databases&lt;br /&gt;
** create database pg_development;&lt;br /&gt;
** create database pg_test;&lt;br /&gt;
* Set privileges for expertiza user&lt;br /&gt;
** grant all on pg_development.* to expertiza@localhost;&lt;br /&gt;
** grant all on pg_test.* to expertiza@localhost;&lt;br /&gt;
* Install javascript libraries&lt;br /&gt;
** sudo apt-get install npm&lt;br /&gt;
** sudo npm install bower&lt;br /&gt;
** bower install&lt;br /&gt;
* Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
* Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
* Run bundle exec rake db:migrate&lt;br /&gt;
* Run bundle exec rake db:test:prepare&lt;br /&gt;
* Run rails s&lt;br /&gt;
* Open browser and test localhost:3000&lt;br /&gt;
* Login credentials&lt;br /&gt;
** Username - instructor6&lt;br /&gt;
** Password - password&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There weren't any test cases before and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
=== Scenario 3 ===&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103527</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103527"/>
		<updated>2016-10-29T01:07:45Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Scenario 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: app/views/mailer/suggested_topic_approved_message.html.erb, suggestion_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
* Fork the git repository mentioned above&lt;br /&gt;
* Clone the repository to your local machine&lt;br /&gt;
* Install [http://brew.sh/ Homebrew]&lt;br /&gt;
* Install RBENV&lt;br /&gt;
** brew update&lt;br /&gt;
** brew install rbenv&lt;br /&gt;
** brew install ruby-build&lt;br /&gt;
* Install dependencies&lt;br /&gt;
** brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
* Install gems&lt;br /&gt;
** export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
** bundle install&lt;br /&gt;
* Change yml files&lt;br /&gt;
** Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
** Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
** Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
* Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
* Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
** mysql -uroot -p&lt;br /&gt;
* Create expertiza user&lt;br /&gt;
** create user expertiza@localhost;&lt;br /&gt;
* Create the databases&lt;br /&gt;
** create database pg_development;&lt;br /&gt;
** create database pg_test;&lt;br /&gt;
* Set privileges for expertiza user&lt;br /&gt;
** grant all on pg_development.* to expertiza@localhost;&lt;br /&gt;
** grant all on pg_test.* to expertiza@localhost;&lt;br /&gt;
* Install javascript libraries&lt;br /&gt;
** sudo apt-get install npm&lt;br /&gt;
** sudo npm install bower&lt;br /&gt;
** bower install&lt;br /&gt;
* Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
* Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
* Run bundle exec rake db:migrate&lt;br /&gt;
* Run bundle exec rake db:test:prepare&lt;br /&gt;
* Run rails s&lt;br /&gt;
* Open browser and test localhost:3000&lt;br /&gt;
* Login credentials&lt;br /&gt;
** Username - instructor6&lt;br /&gt;
** Password - password&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There weren't any test cases before and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Other scenarios that were tested are given below&lt;br /&gt;
&lt;br /&gt;
=== Scenario 3 ===&lt;br /&gt;
Student2064 logs in and suggests a topic (Computer Vision) under Assignment 1 -&amp;gt; Instructor6 logs in and checks on Assignment 1 -&amp;gt; Checks that “Computer Vision” is submitted by student2064 -&amp;gt; Checks comment by student2064 -&amp;gt; Instructor6 approves the suggestion -&amp;gt; Student2064 logs in -&amp;gt; Visits Assignment 1 -&amp;gt; &lt;br /&gt;
Checks suggestion “Computer Vision” is accepted&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103511</id>
		<title>CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1643._Refactor_Suggestion_controller&amp;diff=103511"/>
		<updated>2016-10-29T01:04:17Z</updated>

		<summary type="html">&lt;p&gt;Spotta: /* Scenario 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''E1643. Refactor and Test Suggestion Controller'''&lt;br /&gt;
&lt;br /&gt;
This page gives a detail of the OSS project of refactoring and testing the suggestion controller of Expertiza.&lt;br /&gt;
&lt;br /&gt;
== '''Introduction''' ==&lt;br /&gt;
Expertiza is a Ruby on Rails based open source project. The main motive of this project is to make learning more effective through peer review. This website is a result of combined effort of both students and faculty at NC State, and is used not just by this university but also in many other universities. The website allows students to form teams and work on various projects listed by the instructor and also suggest new topics that seem interesting, though they can opt not to work on them. It also makes it easy for the instructor to add a new topic to an assignment/project, create a new project and add students to it. The time spent by TAs and instructor is greatly reduced. The key feature is peer review, where the students can review the work of others and provide feedback. This helps in improving the existing work and also provides a new way to learn. There isn’t any restriction on the format of submission as it accepts any form of submission varying from URL to wiki pages, which isn’t a common feature in other websites. &lt;br /&gt;
&lt;br /&gt;
== '''Motivation''' ==&lt;br /&gt;
This provides a great opportunity for the students to learn through collaboration. It provides a chance to contribute to an open source project. One would take back experience of working on Rails, and testing environments like RSpec. Being one of the primary user of Expertiza, students would enhance the functionalities according to their experiences using it and can view their changes implemented real-time.&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Our files to be modified are: app/views/mailer/suggested_topic_approved_message.html.erb, suggestion_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
The current folder of suggestion_controller.rb provides a chance to suggest a new topic to work on for a project. There is also an option for the student to not work on it. One can also submit the suggestion anonymously. Once a student submits the topic, the instructor can check that in the view suggestions tab, and can either approve or reject. Once the instructor approves, the student gets a mail regarding the approval. This mail is sent only if the student doesn’t submit the topic anonymously. In the process of assigning the given suggestion as a project topic to the student, it automatically gets assigned to the whole team if the student is part of a team. &lt;br /&gt;
&lt;br /&gt;
Our problem statement includes:&lt;br /&gt;
&lt;br /&gt;
1. Modifying the code in accordance to rails 4 syntax&lt;br /&gt;
&lt;br /&gt;
2. Send email code which was duplicated needs to be replaced by a single method&lt;br /&gt;
&lt;br /&gt;
3. Fix and test the working of email functionality (an email is sent to the student who suggested the topic once the instructor approves, unless he/she sends it anonymously)&lt;br /&gt;
&lt;br /&gt;
4. Write integration tests for each method in suggestion_controller.rb (including some edge cases)&lt;br /&gt;
&lt;br /&gt;
== '''Setup''' ==&lt;br /&gt;
Before starting off with working on the Expertiza project, we need to fork the existing code from [https://github.com/expertiza/expertiza expertiza/master branch]. We are provided with 3 methods of setting up Expertiza: Docker, setting it up locally and using Expertiza image. We are describing the first two methods (the ones we used) below.&lt;br /&gt;
&lt;br /&gt;
=== Docker ===&lt;br /&gt;
&lt;br /&gt;
=== On a Local Machine ===&lt;br /&gt;
We have used MacOS, so the following steps are in regard to MacOS.&lt;br /&gt;
The following steps will help you setup Expertiza project in your local machine. The steps are comprehensive amalgamation of steps mentioned in [http://wiki.expertiza.ncsu.edu/index.php/Development:Setup:OSX Development Setup], the [https://docs.google.com/document/d/1TFC0G3zW-xkJYuloh_BmvWnj3dGZB23GOIYuikNRf_I/edit?pli=1 document]provided and also few steps that were missed in both. The order we followed:&lt;br /&gt;
&lt;br /&gt;
* Fork the git repository mentioned above&lt;br /&gt;
* Clone the repository to your local machine&lt;br /&gt;
* Install [http://brew.sh/ Homebrew]&lt;br /&gt;
* Install RBENV&lt;br /&gt;
** brew update&lt;br /&gt;
** brew install rbenv&lt;br /&gt;
** brew install ruby-build&lt;br /&gt;
* Install dependencies&lt;br /&gt;
** brew install aspell gcc47 libxml2 libxslt graphviz&lt;br /&gt;
* Install gems&lt;br /&gt;
** export JAVA_HOME=/etc/alternatives/java_sdk&lt;br /&gt;
** bundle install&lt;br /&gt;
* Change yml files&lt;br /&gt;
** Go to expertiza/config and rename secrets.yml.example to secrets.yml&lt;br /&gt;
** Go to expertiza/config and rename database.yml.example to database.yml&lt;br /&gt;
** Edit database.yml to include the root password for your local MySQL in the “password” field&lt;br /&gt;
* Install mysql (https://gist.github.com/nrollr/a8d156206fa1e53c6cd6) &lt;br /&gt;
* Log into MySql as root (mysql is generally present in /usr/local/mysql/bin/)&lt;br /&gt;
** mysql -uroot -p&lt;br /&gt;
* Create expertiza user&lt;br /&gt;
** create user expertiza@localhost;&lt;br /&gt;
* Create the databases&lt;br /&gt;
** create database pg_development;&lt;br /&gt;
** create database pg_test;&lt;br /&gt;
* Set privileges for expertiza user&lt;br /&gt;
** grant all on pg_development.* to expertiza@localhost;&lt;br /&gt;
** grant all on pg_test.* to expertiza@localhost;&lt;br /&gt;
* Install javascript libraries&lt;br /&gt;
** sudo apt-get install npm&lt;br /&gt;
** sudo npm install bower&lt;br /&gt;
** bower install&lt;br /&gt;
* Download the expertiza scrubbed library (https://drive.google.com/file/d/0B2vDvVjH76uEMDJhNjZVOUFTWmM/view) &lt;br /&gt;
* Load this sql file into pg_development database created using the method mentioned here.&lt;br /&gt;
* Run bundle exec rake db:migrate&lt;br /&gt;
* Run bundle exec rake db:test:prepare&lt;br /&gt;
* Run rails s&lt;br /&gt;
* Open browser and test localhost:3000&lt;br /&gt;
* Login credentials&lt;br /&gt;
** Username - instructor6&lt;br /&gt;
** Password - password&lt;br /&gt;
&lt;br /&gt;
== '''Our Implementation''' ==&lt;br /&gt;
There weren't any test cases before and also the email functionality wasn't working. We have fixed the email functionality and also refactored parts of the code. As per our knowledge we couldn't find any code in accordance to Ruby 2 syntax. &lt;br /&gt;
&lt;br /&gt;
=== '''Testing''' ===&lt;br /&gt;
We were tasked with writing integration test cases for suggestion_controller. We came up with 6 end-to-end test cases to test “integration” of suggestion controller with other models, controllers and views. The test script can be found [https://github.com/anubhabMajumdar/expertiza/blob/amajumd/spec/features/topic_suggestion2_spec.rb here].&lt;br /&gt;
&lt;br /&gt;
==== Prerequisite ====&lt;br /&gt;
All the scenarios uses the following:&lt;br /&gt;
* Instructor6&lt;br /&gt;
* Student2064&lt;br /&gt;
* Assignment 1&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 ====&lt;br /&gt;
Instructor6 logs in and visits assignment 1 to check suggested topics (currently empty)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
scenario &amp;quot;allow instructor to log in and view suggestions (suggestions should be empty) for Assignment 1&amp;quot; do	&lt;br /&gt;
   user = User.find_by_name('instructor6')&lt;br /&gt;
   stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
   visit '/suggestion/list?id=1&amp;amp;type=Assignment'&lt;br /&gt;
   expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot; &lt;br /&gt;
   expect(page).to have_no_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 ====&lt;br /&gt;
&lt;br /&gt;
Student2064 logs in -&amp;gt; Visits on Assignment 1 -&amp;gt; Clicks on new suggestion -&amp;gt; Submits new topic called “Computer Vision” -&amp;gt; Checks submission is successful -&amp;gt; Adds comment -&amp;gt; Submits comment -&amp;gt; Checks successful submission of comment -&amp;gt; Tries submitting blank comment -&amp;gt; Checks unsuccessful submission of blank comment -&amp;gt; Tries editing suggestion title and suggestion description -&amp;gt; Checks edit is successful -&amp;gt; Logs out successfully&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Create new suggestion (Computer Vision)&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion'&lt;br /&gt;
select &amp;quot;N&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Thank you for your suggestion!&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision&amp;quot;	&lt;br /&gt;
expect(page).to have_content &amp;quot;Initiated&amp;quot;	&lt;br /&gt;
		&lt;br /&gt;
# View the suggestion&lt;br /&gt;
find_link('View').click&lt;br /&gt;
expect(page).to have_content &amp;quot;View Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add comment&lt;br /&gt;
fill_in 'suggestion_comment_comments', with: 'Student2064 commenting on Computer Vision'&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;Your comment has been successfully added.&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Student2064 commenting on Computer Vision&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Try adding blank comment&lt;br /&gt;
click_button 'Submit comment'&lt;br /&gt;
expect(page).to have_content &amp;quot;There was an error adding your comment.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Edit title and description&lt;br /&gt;
find_link('Edit').click&lt;br /&gt;
expect(page).to have_content &amp;quot;Edit Suggested topic Computer Vision&amp;quot;&lt;br /&gt;
fill_in 'suggestion_title', with: 'Computer Vision 2'&lt;br /&gt;
fill_in 'suggestion_description', with: 'This is a Computer Vision suggestion 2'&lt;br /&gt;
select &amp;quot;Y&amp;quot;, :from =&amp;gt; &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button 'Submit'&lt;br /&gt;
expect(page).to have_content &amp;quot;Suggested topics for Assignment 1&amp;quot;&lt;br /&gt;
expect(page).to have_content &amp;quot;Computer Vision 2&amp;quot;	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Spotta</name></author>
	</entry>
</feed>