<?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=Hma5</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=Hma5"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Hma5"/>
	<updated>2026-06-04T23:49:08Z</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_2015_E1582_Create_integration_tests_for_the_instructor_interface_using_capybara_and_rspec&amp;diff=100009</id>
		<title>CSC/ECE 517 Fall 2015 E1582 Create integration tests for the instructor interface using capybara and rspec</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1582_Create_integration_tests_for_the_instructor_interface_using_capybara_and_rspec&amp;diff=100009"/>
		<updated>2015-11-20T15:28:17Z</updated>

		<summary type="html">&lt;p&gt;Hma5: /* View scores for an assignment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to create integration tests for the instructor interface of Expertiza. The UI procedures need to be tested are:&lt;br /&gt;
* Log in&lt;br /&gt;
* Create a course&lt;br /&gt;
* View scores for an assignment&lt;br /&gt;
* View review scores (“review report”)&lt;br /&gt;
* View author-feedback scores&lt;br /&gt;
* Create an assignment&lt;br /&gt;
** 2 rounds of review&lt;br /&gt;
** Has no topics / has topics&lt;br /&gt;
** Staggered-deadline assignments&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a Behavior Driven Development (BDD) framework for Ruby. It is composed of 4 main parts &amp;lt;ref&amp;gt;[http://rspec.info/ RSpec Official Website]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
; rspec-core&lt;br /&gt;
: The spec runner, providing a rich command line program, flexible and customizable reporting, and an API to organize your code examples. &lt;br /&gt;
&lt;br /&gt;
An example of running rspec file in terminal: &amp;lt;code&amp;gt;rspec spec/model_spec.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; rspec-expectations&lt;br /&gt;
: Provides a readable API to express expected outcomes of a code example.&lt;br /&gt;
&lt;br /&gt;
; rspec-mocks&lt;br /&gt;
: Test double framework, providing multiple types of fake objects to allow you to tightly control the environment in which your specs run.&lt;br /&gt;
&lt;br /&gt;
; rspec-rails&lt;br /&gt;
: Supports using RSpec to test Ruby on Rails applications in place of Rails' built-in test framework.&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a web-based automation test tool that simulates a real user to follow the scenarios of user stories.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara on GitHub]&amp;lt;/ref&amp;gt; It could interact with app to receive pages, parse the HTML and submit forms as a user would.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=p7ZcZNuZ0aw Introducing cucumber &amp;amp; capybara on YouTube]&amp;lt;/ref&amp;gt; Used with RSpec and Ruby on Rails (version 1.9 or later), capybara makes it easier to write integration tests. &amp;lt;ref&amp;gt;[http://techiferous.com/2010/04/using-capybara-in-rails-3/ Using Capybara in Rails 3]&amp;lt;/ref&amp;gt; It is used on the top of an underlying web-based driver and offers a user-friendly DSL (Domain Specific Language) to describe actions executed by the underlying web driver. Such as &amp;lt;code&amp;gt;rack::test&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;selenium-webdriver&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;capybara-webkit&amp;lt;/code&amp;gt;.&amp;lt;ref&amp;gt;[http://www.sitepoint.com/basics-capybara-improving-tests/ The Basics of Capybara and Improving Your Tests]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this project, we use capybara with rspec by adding the following line:&lt;br /&gt;
&amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;&lt;br /&gt;
Then put capybara specs in &amp;lt;code&amp;gt;spec/features&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration test is a software testing definition that we combine modules then test them as one group. It is an important application testing way. It is always adapted after unit testing, we need to combine different units to test the functionalities and verify that the aggregated group could deliver its output properly. The purpose of integration test is to verify the functionality of interface between interacted parts, also we can know performance of the subsystems. The integration testing has two types, big bang top down and bottom up.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following 6 features:&lt;br /&gt;
# Log in: ensure an instructor is able to login to the system&lt;br /&gt;
# Create a course:ensure an instuctor is able to create a course.&lt;br /&gt;
# View scores for an assignment: ensure that the score of a certain assignment can be viewed.&lt;br /&gt;
# View review scores (“review report”): ensure to view the score of a review.&lt;br /&gt;
# View author-feedback scores: ensure to view the score of an author feedback.&lt;br /&gt;
# Create an assignment: ensure to create an assignment which has two rounds of review, has a topic or does not has a topic, and has a staggered-deadline.&lt;br /&gt;
&lt;br /&gt;
=== Create a course ===&lt;br /&gt;
* Scenario 1: create a public course&lt;br /&gt;
# sign in&lt;br /&gt;
# click &amp;quot;Courses&amp;quot; to browse the course list&lt;br /&gt;
# click &amp;quot;New public course&amp;quot; to create a public course&lt;br /&gt;
# fill in the text area, and click &amp;quot;Create&amp;quot; button&lt;br /&gt;
After returning to the course list, the new course we created is expected to be shown.&lt;br /&gt;
* Scenario 2: create a private course&lt;br /&gt;
# sign in&lt;br /&gt;
# click &amp;quot;Courses&amp;quot; to browse the course list&lt;br /&gt;
# click &amp;quot;New private course&amp;quot; to create a private course&lt;br /&gt;
# fill in the text area, and click &amp;quot;Create&amp;quot; button&lt;br /&gt;
After returning to the course list, the new course we created is expected to be shown.&lt;br /&gt;
&lt;br /&gt;
=== View scores for an assignment ===&lt;br /&gt;
# sign in&lt;br /&gt;
# click &amp;quot;Assignments&amp;quot; to browse assignment list&lt;br /&gt;
# choose a certain assignment, click &amp;quot;View scores&amp;quot; button&lt;br /&gt;
In the grades review page, scores are expected to be shown.&lt;br /&gt;
&lt;br /&gt;
=== View review scores (“review report”) ===&lt;br /&gt;
* Scenario 1: No review scores available&lt;br /&gt;
# Sign in&lt;br /&gt;
# Click link for Assignment&lt;br /&gt;
# Click ‘Your scores’&lt;br /&gt;
# Click ‘Show reviews’&lt;br /&gt;
# Check that nothing exists&lt;br /&gt;
# Check for dashes&lt;br /&gt;
*Scenario 2: Review scores available&lt;br /&gt;
# Sign in&lt;br /&gt;
# Click link for Assignment&lt;br /&gt;
# Click ‘Your scores’&lt;br /&gt;
# Click ‘show reviews’&lt;br /&gt;
# Check that review scores exists&lt;br /&gt;
&lt;br /&gt;
=== View author-feedback scores ===&lt;br /&gt;
* Scenario 1: No author-feedback scores available.&lt;br /&gt;
# Sign in &lt;br /&gt;
# Click link for Assignment&lt;br /&gt;
# Click ‘Your scores’&lt;br /&gt;
# Click ‘show author feedbacks’&lt;br /&gt;
# Check that nothing exists&lt;br /&gt;
*Scenario 2: Author-feedback scores available.&lt;br /&gt;
# Sign in&lt;br /&gt;
# Click link for Assignment&lt;br /&gt;
# Click ‘Your scores’&lt;br /&gt;
# Click ‘show author feedbacks’&lt;br /&gt;
# Check that author-feedback scores exists&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1582_Create_integration_tests_for_the_instructor_interface_using_capybara_and_rspec&amp;diff=100008</id>
		<title>CSC/ECE 517 Fall 2015 E1582 Create integration tests for the instructor interface using capybara and rspec</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1582_Create_integration_tests_for_the_instructor_interface_using_capybara_and_rspec&amp;diff=100008"/>
		<updated>2015-11-20T15:27:34Z</updated>

		<summary type="html">&lt;p&gt;Hma5: /* Create a course */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to create integration tests for the instructor interface of Expertiza. The UI procedures need to be tested are:&lt;br /&gt;
* Log in&lt;br /&gt;
* Create a course&lt;br /&gt;
* View scores for an assignment&lt;br /&gt;
* View review scores (“review report”)&lt;br /&gt;
* View author-feedback scores&lt;br /&gt;
* Create an assignment&lt;br /&gt;
** 2 rounds of review&lt;br /&gt;
** Has no topics / has topics&lt;br /&gt;
** Staggered-deadline assignments&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a Behavior Driven Development (BDD) framework for Ruby. It is composed of 4 main parts &amp;lt;ref&amp;gt;[http://rspec.info/ RSpec Official Website]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
; rspec-core&lt;br /&gt;
: The spec runner, providing a rich command line program, flexible and customizable reporting, and an API to organize your code examples. &lt;br /&gt;
&lt;br /&gt;
An example of running rspec file in terminal: &amp;lt;code&amp;gt;rspec spec/model_spec.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; rspec-expectations&lt;br /&gt;
: Provides a readable API to express expected outcomes of a code example.&lt;br /&gt;
&lt;br /&gt;
; rspec-mocks&lt;br /&gt;
: Test double framework, providing multiple types of fake objects to allow you to tightly control the environment in which your specs run.&lt;br /&gt;
&lt;br /&gt;
; rspec-rails&lt;br /&gt;
: Supports using RSpec to test Ruby on Rails applications in place of Rails' built-in test framework.&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a web-based automation test tool that simulates a real user to follow the scenarios of user stories.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara on GitHub]&amp;lt;/ref&amp;gt; It could interact with app to receive pages, parse the HTML and submit forms as a user would.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=p7ZcZNuZ0aw Introducing cucumber &amp;amp; capybara on YouTube]&amp;lt;/ref&amp;gt; Used with RSpec and Ruby on Rails (version 1.9 or later), capybara makes it easier to write integration tests. &amp;lt;ref&amp;gt;[http://techiferous.com/2010/04/using-capybara-in-rails-3/ Using Capybara in Rails 3]&amp;lt;/ref&amp;gt; It is used on the top of an underlying web-based driver and offers a user-friendly DSL (Domain Specific Language) to describe actions executed by the underlying web driver. Such as &amp;lt;code&amp;gt;rack::test&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;selenium-webdriver&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;capybara-webkit&amp;lt;/code&amp;gt;.&amp;lt;ref&amp;gt;[http://www.sitepoint.com/basics-capybara-improving-tests/ The Basics of Capybara and Improving Your Tests]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this project, we use capybara with rspec by adding the following line:&lt;br /&gt;
&amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;&lt;br /&gt;
Then put capybara specs in &amp;lt;code&amp;gt;spec/features&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration test is a software testing definition that we combine modules then test them as one group. It is an important application testing way. It is always adapted after unit testing, we need to combine different units to test the functionalities and verify that the aggregated group could deliver its output properly. The purpose of integration test is to verify the functionality of interface between interacted parts, also we can know performance of the subsystems. The integration testing has two types, big bang top down and bottom up.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following 6 features:&lt;br /&gt;
# Log in: ensure an instructor is able to login to the system&lt;br /&gt;
# Create a course:ensure an instuctor is able to create a course.&lt;br /&gt;
# View scores for an assignment: ensure that the score of a certain assignment can be viewed.&lt;br /&gt;
# View review scores (“review report”): ensure to view the score of a review.&lt;br /&gt;
# View author-feedback scores: ensure to view the score of an author feedback.&lt;br /&gt;
# Create an assignment: ensure to create an assignment which has two rounds of review, has a topic or does not has a topic, and has a staggered-deadline.&lt;br /&gt;
&lt;br /&gt;
=== Create a course ===&lt;br /&gt;
* Scenario 1: create a public course&lt;br /&gt;
# sign in&lt;br /&gt;
# click &amp;quot;Courses&amp;quot; to browse the course list&lt;br /&gt;
# click &amp;quot;New public course&amp;quot; to create a public course&lt;br /&gt;
# fill in the text area, and click &amp;quot;Create&amp;quot; button&lt;br /&gt;
After returning to the course list, the new course we created is expected to be shown.&lt;br /&gt;
* Scenario 2: create a private course&lt;br /&gt;
# sign in&lt;br /&gt;
# click &amp;quot;Courses&amp;quot; to browse the course list&lt;br /&gt;
# click &amp;quot;New private course&amp;quot; to create a private course&lt;br /&gt;
# fill in the text area, and click &amp;quot;Create&amp;quot; button&lt;br /&gt;
After returning to the course list, the new course we created is expected to be shown.&lt;br /&gt;
&lt;br /&gt;
=== View scores for an assignment ===&lt;br /&gt;
# sign in&lt;br /&gt;
# click &amp;quot;Assignments&amp;quot; to browse assignment list&lt;br /&gt;
# choose a certain assignment, click &amp;quot;View scores&amp;quot; button&lt;br /&gt;
In the grades review page, scores are expected to be shown.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== View review scores (“review report”) ===&lt;br /&gt;
* Scenario 1: No review scores available&lt;br /&gt;
# Sign in&lt;br /&gt;
# Click link for Assignment&lt;br /&gt;
# Click ‘Your scores’&lt;br /&gt;
# Click ‘Show reviews’&lt;br /&gt;
# Check that nothing exists&lt;br /&gt;
# Check for dashes&lt;br /&gt;
*Scenario 2: Review scores available&lt;br /&gt;
# Sign in&lt;br /&gt;
# Click link for Assignment&lt;br /&gt;
# Click ‘Your scores’&lt;br /&gt;
# Click ‘show reviews’&lt;br /&gt;
# Check that review scores exists&lt;br /&gt;
&lt;br /&gt;
=== View author-feedback scores ===&lt;br /&gt;
* Scenario 1: No author-feedback scores available.&lt;br /&gt;
# Sign in &lt;br /&gt;
# Click link for Assignment&lt;br /&gt;
# Click ‘Your scores’&lt;br /&gt;
# Click ‘show author feedbacks’&lt;br /&gt;
# Check that nothing exists&lt;br /&gt;
*Scenario 2: Author-feedback scores available.&lt;br /&gt;
# Sign in&lt;br /&gt;
# Click link for Assignment&lt;br /&gt;
# Click ‘Your scores’&lt;br /&gt;
# Click ‘show author feedbacks’&lt;br /&gt;
# Check that author-feedback scores exists&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1582_Create_integration_tests_for_the_instructor_interface_using_capybara_and_rspec&amp;diff=100007</id>
		<title>CSC/ECE 517 Fall 2015 E1582 Create integration tests for the instructor interface using capybara and rspec</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1582_Create_integration_tests_for_the_instructor_interface_using_capybara_and_rspec&amp;diff=100007"/>
		<updated>2015-11-20T15:27:01Z</updated>

		<summary type="html">&lt;p&gt;Hma5: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Purpose''' ==&lt;br /&gt;
This project is to create integration tests for the instructor interface of Expertiza. The UI procedures need to be tested are:&lt;br /&gt;
* Log in&lt;br /&gt;
* Create a course&lt;br /&gt;
* View scores for an assignment&lt;br /&gt;
* View review scores (“review report”)&lt;br /&gt;
* View author-feedback scores&lt;br /&gt;
* Create an assignment&lt;br /&gt;
** 2 rounds of review&lt;br /&gt;
** Has no topics / has topics&lt;br /&gt;
** Staggered-deadline assignments&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Background''' ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
Rspec &amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/RSpec RSpec Wiki Page]&amp;lt;/ref&amp;gt; is a Behavior Driven Development (BDD) framework for Ruby. It is composed of 4 main parts &amp;lt;ref&amp;gt;[http://rspec.info/ RSpec Official Website]&amp;lt;/ref&amp;gt;:&lt;br /&gt;
; rspec-core&lt;br /&gt;
: The spec runner, providing a rich command line program, flexible and customizable reporting, and an API to organize your code examples. &lt;br /&gt;
&lt;br /&gt;
An example of running rspec file in terminal: &amp;lt;code&amp;gt;rspec spec/model_spec.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; rspec-expectations&lt;br /&gt;
: Provides a readable API to express expected outcomes of a code example.&lt;br /&gt;
&lt;br /&gt;
; rspec-mocks&lt;br /&gt;
: Test double framework, providing multiple types of fake objects to allow you to tightly control the environment in which your specs run.&lt;br /&gt;
&lt;br /&gt;
; rspec-rails&lt;br /&gt;
: Supports using RSpec to test Ruby on Rails applications in place of Rails' built-in test framework.&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a web-based automation test tool that simulates a real user to follow the scenarios of user stories.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara on GitHub]&amp;lt;/ref&amp;gt; It could interact with app to receive pages, parse the HTML and submit forms as a user would.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=p7ZcZNuZ0aw Introducing cucumber &amp;amp; capybara on YouTube]&amp;lt;/ref&amp;gt; Used with RSpec and Ruby on Rails (version 1.9 or later), capybara makes it easier to write integration tests. &amp;lt;ref&amp;gt;[http://techiferous.com/2010/04/using-capybara-in-rails-3/ Using Capybara in Rails 3]&amp;lt;/ref&amp;gt; It is used on the top of an underlying web-based driver and offers a user-friendly DSL (Domain Specific Language) to describe actions executed by the underlying web driver. Such as &amp;lt;code&amp;gt;rack::test&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;selenium-webdriver&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;capybara-webkit&amp;lt;/code&amp;gt;.&amp;lt;ref&amp;gt;[http://www.sitepoint.com/basics-capybara-improving-tests/ The Basics of Capybara and Improving Your Tests]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this project, we use capybara with rspec by adding the following line:&lt;br /&gt;
&amp;lt;code&amp;gt; require 'capybara/rspec' &amp;lt;/code&amp;gt;&lt;br /&gt;
Then put capybara specs in &amp;lt;code&amp;gt;spec/features&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
Integration test is a software testing definition that we combine modules then test them as one group. It is an important application testing way. It is always adapted after unit testing, we need to combine different units to test the functionalities and verify that the aggregated group could deliver its output properly. The purpose of integration test is to verify the functionality of interface between interacted parts, also we can know performance of the subsystems. The integration testing has two types, big bang top down and bottom up.&lt;br /&gt;
&lt;br /&gt;
* '''Big Bang'''&lt;br /&gt;
&lt;br /&gt;
In this type, since all the application is combined with all major usage modules. So we test them under usage model testing, which means we can simulate the users' acts under testing environment. When doing this, we can test if all the expected components is got when we actually do the same way under production environment. It is an effective way to test the functionalities and got better coverage since we are creating the realistic scenarios. It will make sure the application can have proper output when a user does the same input.&lt;br /&gt;
&lt;br /&gt;
* '''Top down and Bottom up'''&lt;br /&gt;
&lt;br /&gt;
Top down and bottom up is another type of integration testing. For top down, we test the top integrated module firstly and test the ranch of it again and again, then we can test all the related modules finally. For Bottom up way, we test the most basic module at first and check the module that containing this basic module. The advantage of it is that we can find the bug easier because we will not miss any branch that we use. However, it is time consuming in this way.&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Integration_testing/ Integration testing on Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
Based on the project requirements, the testing can be divided into the following 6 features:&lt;br /&gt;
# Log in: ensure an instructor is able to login to the system&lt;br /&gt;
# Create a course:ensure an instuctor is able to create a course.&lt;br /&gt;
# View scores for an assignment: ensure that the score of a certain assignment can be viewed.&lt;br /&gt;
# View review scores (“review report”): ensure to view the score of a review.&lt;br /&gt;
# View author-feedback scores: ensure to view the score of an author feedback.&lt;br /&gt;
# Create an assignment: ensure to create an assignment which has two rounds of review, has a topic or does not has a topic, and has a staggered-deadline.&lt;br /&gt;
&lt;br /&gt;
=== Create a course ===&lt;br /&gt;
* Scenario 1: create a public course&lt;br /&gt;
# sign in&lt;br /&gt;
# click &amp;quot;Courses&amp;quot; to browse course list&lt;br /&gt;
# click &amp;quot;New public course&amp;quot; to create a public course&lt;br /&gt;
# fill in the text area, and click &amp;quot;Create&amp;quot; button&lt;br /&gt;
After returning to the course list, the new course we created is expected to be shown.&lt;br /&gt;
* Scenario 2: create a private course&lt;br /&gt;
# sign in&lt;br /&gt;
# click &amp;quot;Courses&amp;quot; to browse course list&lt;br /&gt;
# click &amp;quot;New private course&amp;quot; to create a private course&lt;br /&gt;
# fill in the text area, and click &amp;quot;Create&amp;quot; button&lt;br /&gt;
After returning to the course list, the new course we created is expected to be shown.&lt;br /&gt;
&lt;br /&gt;
=== View scores for an assignment ===&lt;br /&gt;
# sign in&lt;br /&gt;
# click &amp;quot;Assignments&amp;quot; to browse assignment list&lt;br /&gt;
# choose a certain assignment, click &amp;quot;View scores&amp;quot; button&lt;br /&gt;
In the grades review page, scores are expected to be shown.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== View review scores (“review report”) ===&lt;br /&gt;
* Scenario 1: No review scores available&lt;br /&gt;
# Sign in&lt;br /&gt;
# Click link for Assignment&lt;br /&gt;
# Click ‘Your scores’&lt;br /&gt;
# Click ‘Show reviews’&lt;br /&gt;
# Check that nothing exists&lt;br /&gt;
# Check for dashes&lt;br /&gt;
*Scenario 2: Review scores available&lt;br /&gt;
# Sign in&lt;br /&gt;
# Click link for Assignment&lt;br /&gt;
# Click ‘Your scores’&lt;br /&gt;
# Click ‘show reviews’&lt;br /&gt;
# Check that review scores exists&lt;br /&gt;
&lt;br /&gt;
=== View author-feedback scores ===&lt;br /&gt;
* Scenario 1: No author-feedback scores available.&lt;br /&gt;
# Sign in &lt;br /&gt;
# Click link for Assignment&lt;br /&gt;
# Click ‘Your scores’&lt;br /&gt;
# Click ‘show author feedbacks’&lt;br /&gt;
# Check that nothing exists&lt;br /&gt;
*Scenario 2: Author-feedback scores available.&lt;br /&gt;
# Sign in&lt;br /&gt;
# Click link for Assignment&lt;br /&gt;
# Click ‘Your scores’&lt;br /&gt;
# Click ‘show author feedbacks’&lt;br /&gt;
# Check that author-feedback scores exists&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:9.png&amp;diff=99116</id>
		<title>File:9.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:9.png&amp;diff=99116"/>
		<updated>2015-11-09T20:43:04Z</updated>

		<summary type="html">&lt;p&gt;Hma5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:8.png&amp;diff=99115</id>
		<title>File:8.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:8.png&amp;diff=99115"/>
		<updated>2015-11-09T20:42:57Z</updated>

		<summary type="html">&lt;p&gt;Hma5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:7.png&amp;diff=99114</id>
		<title>File:7.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:7.png&amp;diff=99114"/>
		<updated>2015-11-09T20:42:50Z</updated>

		<summary type="html">&lt;p&gt;Hma5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:6.png&amp;diff=99113</id>
		<title>File:6.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:6.png&amp;diff=99113"/>
		<updated>2015-11-09T20:42:42Z</updated>

		<summary type="html">&lt;p&gt;Hma5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:5.png&amp;diff=99112</id>
		<title>File:5.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:5.png&amp;diff=99112"/>
		<updated>2015-11-09T20:42:33Z</updated>

		<summary type="html">&lt;p&gt;Hma5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:4.png&amp;diff=99111</id>
		<title>File:4.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:4.png&amp;diff=99111"/>
		<updated>2015-11-09T20:42:21Z</updated>

		<summary type="html">&lt;p&gt;Hma5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:3.png&amp;diff=99108</id>
		<title>File:3.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:3.png&amp;diff=99108"/>
		<updated>2015-11-09T20:38:13Z</updated>

		<summary type="html">&lt;p&gt;Hma5: uploaded a new version of &amp;amp;quot;File:3.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;IS-A and HAS-A Rules of Inheritance&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:2.png&amp;diff=99107</id>
		<title>File:2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:2.png&amp;diff=99107"/>
		<updated>2015-11-09T20:37:51Z</updated>

		<summary type="html">&lt;p&gt;Hma5: uploaded a new version of &amp;amp;quot;File:2.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Double diamond problem&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1556_CHM&amp;diff=99106</id>
		<title>CSC/ECE 517 Fall 2015/oss E1556 CHM</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1556_CHM&amp;diff=99106"/>
		<updated>2015-11-09T20:36:53Z</updated>

		<summary type="html">&lt;p&gt;Hma5: /* UI test */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;6&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1556. Refactoring SuggestionController.rb&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
== Project description==&lt;br /&gt;
This project is about testing and optimizing of SuggestionController of Expertiza system. Suggestion Controller is a module for students to suggest a new topic for their writing assignments, and instructor can approve the suggestion. &lt;br /&gt;
&lt;br /&gt;
Typically, there are three cases when instructor approves the suggestion. First, if the student already has a topic and when suggesting a new topic, he chooses 'Yes' in the signup_preference, he will enroll the new suggested topic automatically after the instructor approves the suggested topic. Second, if the student is in the waitlist of a topic, and when suggesting a new topic, he chooses 'Yes' in the signup_preference, he will enroll the new suggested topic and be removed from the former waitlist. Third, if the student is in the waitlist of a topic, and when suggesting a new topic, he chooses 'No' in the signup_preference, after the instructor approves the new topic, he will remain in the waitlist of former topic, and new topic is left as 'no chooser'.&lt;br /&gt;
&lt;br /&gt;
Besides, Suggestion Controller also needs to be optimized from two aspects. First, the syntax need to be upgraded from rails 3.x to rails 4.x. Second, refactoring the mailer part is necessary.&lt;br /&gt;
== Expertiza==&lt;br /&gt;
The Expertiza project is software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==  Optimization==&lt;br /&gt;
=== Syntax ===&lt;br /&gt;
For the code to be coordinated with Rails 4 syntax, there is one major difference between Ruby 1.9 and 1.8 need to be change in the suggestion_controller.rb.&lt;br /&gt;
The hash operator using the &amp;quot;hash rocket&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{ :key =&amp;gt; 'value' }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Need to be changed into:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 { key :  'value' }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Refator ===&lt;br /&gt;
The approve_suggestion() method is quite long in the original code, and the send email function in the method is achieved twice, which doesn’t conform with DRY principle.&lt;br /&gt;
&lt;br /&gt;
The logic of the approve_suggestion() method is described as follows. First, approve the suggestion by create a new record in the SignUpTopic model, set relative parameters, and save the new record. Then send notification to the team. In the notification part, if the student doesn’t have a team, a new team should be created and assigned to the suggested topic.&lt;br /&gt;
Based on the logic, the approve_suggestion() method can be clearly divided into two parts: approve suggestion part, and notification part. In the notification part, send email function can be written as a single method in order not to repeat. Besides, creating a new team can also be written as a new method.&lt;br /&gt;
&lt;br /&gt;
After refactor, there are four new methods: approve, notification, create_new_team, and send_email. Approve and notification are called within approve_suggestion, while create_new_team and send_email are called within notification.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_new_team&lt;br /&gt;
    new_team = AssignmentTeam.create(name: 'Team' + @user_id.to_s + '_' + rand(1000).to_s, parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
    t_user = TeamsUser.create(team_id: new_team.id, user_id: @user_id)&lt;br /&gt;
    SignedUpTeam.create(topic_id: @signuptopic.id, team_id: new_team.id, is_waitlisted: 0)&lt;br /&gt;
          parent = TeamNode.create(parent_id: @signuptopic.assignment_id, node_object_id: new_team.id)&lt;br /&gt;
          TeamUserNode.create(parent_id: parent.id, node_object_id: t_user.id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def send_email&lt;br /&gt;
    proposer = User.find(@user_id)&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    cc_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
    end&lt;br /&gt;
    Mailer.suggested_topic_approved_message(&lt;br /&gt;
        { to: proposer.email,&lt;br /&gt;
          cc: cc_mail_list,&lt;br /&gt;
          subject: &amp;quot;Suggested topic '#{@suggestion.title}' has already been approved&amp;quot;,&lt;br /&gt;
          body: {&lt;br /&gt;
              approved_topic_name: @suggestion.title,&lt;br /&gt;
              proposer: proposer.name&lt;br /&gt;
          }&lt;br /&gt;
        }&lt;br /&gt;
    ).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def approve&lt;br /&gt;
    @suggestion = Suggestion.find(params[:id])&lt;br /&gt;
    @user_id = User.where(name: @suggestion.unityID).first.id&lt;br /&gt;
    @team_id = TeamsUser.team_id(@suggestion.assignment_id, @user_id)&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@suggestion.assignment_id, @user_id)&lt;br /&gt;
    @signuptopic = SignUpTopic.new&lt;br /&gt;
    @signuptopic.topic_identifier = 'S' + Suggestion.where(&amp;quot;assignment_id = ? and id &amp;lt;= ?&amp;quot;, @suggestion.assignment_id, @suggestion.id).size.to_s&lt;br /&gt;
    @signuptopic.topic_name = @suggestion.title&lt;br /&gt;
    @signuptopic.assignment_id = @suggestion.assignment_id&lt;br /&gt;
    @signuptopic.max_choosers = 1;&lt;br /&gt;
    if @signuptopic.save &amp;amp;&amp;amp; @suggestion.update_attribute('status', 'Approved')&lt;br /&gt;
      flash[:notice] = 'Successfully approved the suggestion.'&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'Error when approving the suggestion.'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y'&lt;br /&gt;
      #if this user do not have team in this assignment, create one for him/her and assign this topic to this team.&lt;br /&gt;
      if @team_id.nil?&lt;br /&gt;
        create_new_team&lt;br /&gt;
      else #this user has a team in this assignment, check whether this team has topic or not&lt;br /&gt;
        if @topic_id.nil?&lt;br /&gt;
          #clean waitlists&lt;br /&gt;
          SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
          SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
        else&lt;br /&gt;
          @signuptopic.private_to = @user_id&lt;br /&gt;
          @signuptopic.save&lt;br /&gt;
          #if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
          send_email&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      #if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      send_email&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def approve_suggestion&lt;br /&gt;
    approve&lt;br /&gt;
    notification&lt;br /&gt;
    redirect_to action: 'show', id: @suggestion&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test ==&lt;br /&gt;
=== Rspec===&lt;br /&gt;
[[Rspec]] was used to conduct all the tests.&lt;br /&gt;
RSpec is a Behaviour-Driven Development tool for Ruby programmers. BDD is an approach to software development that combines Test-Driven Development, Domain Driven Design, and Acceptance Test-Driven Planning. RSpec helps you do the TDD part of that equation, focusing on the documentation and design aspects of TDD.&lt;br /&gt;
&lt;br /&gt;
=== Test1 ===&lt;br /&gt;
In the first test, we are going to test the result of approving a student's suggestion topic if the student is in a waitlist. He will be removed from the waitlist and added to the new list, if he selected the signup_preference to be 'Yes'.&lt;br /&gt;
We choose 'Writing Assignment 1a' of 'CSC/ECE 517, Spring 2015' as test assignment. I simulate creating a new suggestion with student5717, in team 'Writing Assignment 1a Team14'.&lt;br /&gt;
&lt;br /&gt;
First, log in as Student5717 and suggest a new topic, and choose 'Yes' in signup_preference.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     # Login with student5717 account&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      expect(page).to have_content('Welcome')&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: &amp;quot;student5717&amp;quot;&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: &amp;quot;password&amp;quot;&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
      # suggest a new suggestion&lt;br /&gt;
      visit '/suggestion/new?id=711'&lt;br /&gt;
      fill_in 'suggestion_title',  with: 'RSpect'&lt;br /&gt;
      fill_in 'suggestion_description',  with: 'RSpect is a ROR test framework. It focus on function test'&lt;br /&gt;
      # select 'suggestion_signup_preference', with: 'Y'&lt;br /&gt;
      expect{click_button &amp;quot;Submit&amp;quot;}.to change(Suggestion, :count).by(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, log out Student5717, and log in with 'instructor6' account, who is the manager of this course. Then approve the suggest.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      # Logout current account student5717&lt;br /&gt;
      visit '/suggestion/new?id=711'&lt;br /&gt;
      click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
      expect(current_path).to eq(&amp;quot;/&amp;quot;)&lt;br /&gt;
      &lt;br /&gt;
      # Login with account instructor6&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      expect(page).to have_content('Welcome.')&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
      &lt;br /&gt;
      # approve the suggestion&lt;br /&gt;
      expect(page).to have_content('Manage content')&lt;br /&gt;
      visit '/suggestion/list?id=711&amp;amp;type=Assignment'&lt;br /&gt;
      expect(page).to have_content('Suggested topics for Writing assignment 1a')&lt;br /&gt;
      expect(page).to have_content('RSpect')&lt;br /&gt;
      &lt;br /&gt;
      num = Suggestion.last.id&lt;br /&gt;
      visit &amp;quot;/suggestion/&amp;quot;+num.to_s&lt;br /&gt;
      expect(page).to have_content('Suggestion')&lt;br /&gt;
      expect(page).to have_content('Title:	RSpect')&lt;br /&gt;
      click_button &amp;quot;Approve suggestion&amp;quot;&lt;br /&gt;
      visit &amp;quot;/suggestion/&amp;quot;+num.to_s&lt;br /&gt;
      expect(page).to have_content('status:	Approved')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finally, check if suggestion approved successfully. I need to check topic list with 'instructor6' account logged in and check the selected topic in student5717 account.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      # check if is not in waitlist&lt;br /&gt;
      visit &amp;quot;/assignments/711/edit#tabs-2&amp;quot;&lt;br /&gt;
      expect(page).to have_no_content(&amp;quot;&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;Writing assignment 1a_Team14&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;student5717 &amp;lt;font color='red'&amp;gt;(waitlisted)&amp;lt;/font&amp;gt;&amp;quot;)&lt;br /&gt;
      &lt;br /&gt;
      # Logout current account instructor6&lt;br /&gt;
      visit '/suggestion/new?id=711'&lt;br /&gt;
      click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
      current_path.should == &amp;quot;/&amp;quot;&lt;br /&gt;
      &lt;br /&gt;
      # Login with student5717 account&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      expect(page).to have_content('Welcome')&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: &amp;quot;student5717&amp;quot;&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: &amp;quot;password&amp;quot;&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
      &lt;br /&gt;
      # Check if you select the topic successfully&lt;br /&gt;
      visit '/sign_up_sheet/list?assignment_id=711'&lt;br /&gt;
      expect(page).to have_content('Your topic(s): RSpect')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Test2 ===&lt;br /&gt;
For the second test, Writing Assignment 1a team1, whose team id is 23781, was chosen to perform a serial of action. Team no.23781 is holding a topic: Amazon S3 and Rails. And Writing Assignment 1a team5, whose team id is 23800, is in the waiting list of this topic.&lt;br /&gt;
First, sign in as Student 5404 from team1, send a suggestion for new topic and indicate they want to choose their suggested topic.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      @newtopic = 'Violet and Zoe'&lt;br /&gt;
&lt;br /&gt;
      #sign in as student5404:&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: 'student5404'&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
      expect(page).to have_content('Assignments')&lt;br /&gt;
&lt;br /&gt;
      #suggest a topic:&lt;br /&gt;
      # signup_preference default to be Y&lt;br /&gt;
      visit &amp;quot;/student_task/view?id=28634&amp;quot;&lt;br /&gt;
      expect(page).to have_content('Submit or Review work')&lt;br /&gt;
      visit &amp;quot;/suggestion/new?id=711&amp;quot;&lt;br /&gt;
      expect(page).to have_content('New suggestion')&lt;br /&gt;
      fill_in 'Title',with: @newtopic&lt;br /&gt;
      expect{click_button &amp;quot;Submit&amp;quot;}.to change(Suggestion, :count).by(1)&lt;br /&gt;
&lt;br /&gt;
      #logout&lt;br /&gt;
      click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
      expect(current_path).to eq(&amp;quot;/&amp;quot;)&lt;br /&gt;
      visit '/suggestion/new?id=711'&lt;br /&gt;
      expect(page).to have_content('This is not allowed')&lt;br /&gt;
      expect(page).to have_content('Welcome')&lt;br /&gt;
      expect(page).to have_no_content('User: student5404')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then sign in as instructor6 and approve the suggested topic.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #sign in as instructor6&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      expect(page).to have_content('Welcome.')&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
      expect(page).to have_content('Manage content')&lt;br /&gt;
&lt;br /&gt;
      #approve the suggestion&lt;br /&gt;
      visit '/suggestion/list?id=711&amp;amp;type=Assignment'&lt;br /&gt;
      expect(page).to have_content('Suggested topics for Writing assignment 1a')&lt;br /&gt;
      num = Suggestion.last.id.to_s&lt;br /&gt;
      visit &amp;quot;/suggestion/&amp;quot;+num&lt;br /&gt;
      expect(page).to have_content('Suggestion')&lt;br /&gt;
      expect(page).to have_content('Title: '+@newtopic)&lt;br /&gt;
      click_button &amp;quot;Approve suggestion&amp;quot;&lt;br /&gt;
      visit &amp;quot;/suggestion/&amp;quot;+num.to_s&lt;br /&gt;
      expect(page).to have_content('status:	Approved')&lt;br /&gt;
&lt;br /&gt;
      #logout as instructor6&lt;br /&gt;
      click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
      expect(current_path).to eq(&amp;quot;/&amp;quot;)&lt;br /&gt;
      visit '/suggestion/new?id=711'&lt;br /&gt;
      expect(page).to have_content('This is not allowed')&lt;br /&gt;
      expect(page).to have_content('Welcome')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finally, to check the results. On the one hand, sign in as student5404 again and see if her/his team is holding the new topic. On the other hand sign in as instructor6 and check if team no.23800 is holding the old topic: Amazon S3 and Rails.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      #sign in as student5404:&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: 'student5404'&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
      expect(page).to have_content('Assignments')&lt;br /&gt;
&lt;br /&gt;
      #check the approved suggestion in topics list&lt;br /&gt;
      visit &amp;quot;/sign_up_sheet/list?assignment_id=711&amp;quot;&lt;br /&gt;
      expect(page).to have_content(&amp;quot;Your approved suggested topic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
      # switch to the new topic&lt;br /&gt;
      num2 = SignUpTopic.last.id.to_s&lt;br /&gt;
      visit &amp;quot;/sign_up_sheet/switch_original_topic_to_approved_suggested_topic/&amp;quot;+num2+&amp;quot;?assignment_id=711&amp;quot;&lt;br /&gt;
      expect(page).to have_content(&amp;quot;Your topic(s): &amp;quot;+@newtopic)&lt;br /&gt;
      &lt;br /&gt;
      #logout student5404&lt;br /&gt;
      click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
      expect(current_path).to eq(&amp;quot;/&amp;quot;)&lt;br /&gt;
      visit '/suggestion/new?id=711'&lt;br /&gt;
      expect(page).to have_content('This is not allowed')&lt;br /&gt;
      expect(page).to have_content('Welcome')&lt;br /&gt;
      expect(page).to have_no_content('User: student5404')&lt;br /&gt;
&lt;br /&gt;
      #sign in as instructor6&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      expect(page).to have_content('Welcome.')&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
      expect(page).to have_content('Manage content')&lt;br /&gt;
      &lt;br /&gt;
      # check if team1 is has not enrolled&lt;br /&gt;
      visit &amp;quot;/assignments/711/edit#tabs-2&amp;quot;&lt;br /&gt;
      expect(page).to have_no_content(&amp;quot;&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;Writing assignment 1a_Team1&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;student5404 student5731 &amp;lt;br/&amp;gt;&amp;quot;)&lt;br /&gt;
      expect(page).to have_content(&amp;quot;Writing assignment 1a_Team5 student5740 student5704&amp;quot;)&lt;br /&gt;
      expect(page).to have_content(&amp;quot;S1 Violet and Zoe Writing assignment 1a_Team1 student5404 student5731&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Test3 ===&lt;br /&gt;
The third test is similar to the second one. Team no.23781 and assignment no.711 are chosen for this test again. &lt;br /&gt;
First, student no.5404 login to the system, visit the assignment page, and make a topic suggestion. In the suggestion, instead of choosing “yes” in signup preference, the student chooses “no” in order not to use the suggested topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: &amp;quot;student5404&amp;quot;&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: &amp;quot;password&amp;quot;&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
visit '/suggestion/new?id=711'&lt;br /&gt;
fill_in 'suggestion_title',  with: 'test title'&lt;br /&gt;
fill_in 'suggestion_description',  with: 'test description'&lt;br /&gt;
select 'No', from: &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button &amp;quot;Submit&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After the suggestion is made, login as an instructor, find the assignment, and approve the suggestion. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
&lt;br /&gt;
num = Suggestion.last.id&lt;br /&gt;
path = &amp;quot;/suggestion/&amp;quot; + num.to_s&lt;br /&gt;
visit path&lt;br /&gt;
click_button &amp;quot;Approve suggestion&amp;quot;&lt;br /&gt;
&lt;br /&gt;
click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In the final step, we check if the new topic is shown in the topic list, then login as student no.5401 again, check if they still hold their old topic.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: 'student5404'&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
visit '/sign_up_sheet/list?assignment_id=711'&lt;br /&gt;
expect(page).to have_content('Your topic(s): Amazon S3 and Rails')&lt;br /&gt;
click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
&lt;br /&gt;
visit &amp;quot;/assignments/711/edit#tabs-2&amp;quot;&lt;br /&gt;
expect(page).to have_content(&amp;quot;Amazon S3 and Rails&amp;quot;)&lt;br /&gt;
expect(page).to have_content(&amp;quot;test title&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Result ===&lt;br /&gt;
Here is the result of our tests. All test cases passed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ChendeMacBook-Pro:expertiza chen$ rspec spec/controllers/suggestion_controller_spec.rb &lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 8804&lt;br /&gt;
/Users/chen/RubymineProjects/expertiza/app/models/suggestion.rb:5: warning: circular argument reference - assignment_id&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
Deprecation Warnings:&lt;br /&gt;
&lt;br /&gt;
Using `should` from rspec-expectations' old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:should` with `config.expect_with(:rspec) { |c| c.syntax = :should }` instead. Called from /Users/chen/RubymineProjects/expertiza/spec/controllers/suggestion_controller_spec.rb:67:in `block (3 levels) in &amp;lt;top (required)&amp;gt;'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need more of the backtrace for any of these deprecations to&lt;br /&gt;
identify where to make the necessary changes, you can configure&lt;br /&gt;
`config.raise_errors_for_deprecations!`, and it will turn the&lt;br /&gt;
deprecation warnings into errors, giving you the full backtrace.&lt;br /&gt;
&lt;br /&gt;
1 deprecation warning total&lt;br /&gt;
&lt;br /&gt;
Finished in 1 minute 6.74 seconds (files took 5.3 seconds to load)&lt;br /&gt;
6 examples, 0 failures&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 8804&lt;br /&gt;
&lt;br /&gt;
Coverage report generated for RSpec to /Users/chen/RubymineProjects/expertiza/coverage. 1638 / 5233 LOC (31.3%) covered.&lt;br /&gt;
[Coveralls] Outside the CI environment, not sending data.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== UI test ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For instructor:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For students:&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For student users, first you need to login your account, find a certain course, and make suggestion&lt;br /&gt;
&lt;br /&gt;
[[File:1.png]]&lt;br /&gt;
&lt;br /&gt;
Then, based on your need, choose if you want to work on the suggestion you suggested.&lt;br /&gt;
&lt;br /&gt;
[[File:2.png]]&lt;br /&gt;
&lt;br /&gt;
After saving, there will be a flash message on your webpage, and the suggested topic would be shown.&lt;br /&gt;
&lt;br /&gt;
[[File:3.png]]&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:1.png&amp;diff=99105</id>
		<title>File:1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:1.png&amp;diff=99105"/>
		<updated>2015-11-09T20:36:07Z</updated>

		<summary type="html">&lt;p&gt;Hma5: uploaded a new version of &amp;amp;quot;File:1.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Distributed Version Control System&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1556_CHM&amp;diff=99102</id>
		<title>CSC/ECE 517 Fall 2015/oss E1556 CHM</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1556_CHM&amp;diff=99102"/>
		<updated>2015-11-09T20:32:22Z</updated>

		<summary type="html">&lt;p&gt;Hma5: /* UI test */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;6&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1556. Refactoring SuggestionController.rb&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
== Project description==&lt;br /&gt;
This project is about testing and optimizing of SuggestionController of Expertiza system. Suggestion Controller is a module for students to suggest a new topic for their writing assignments, and instructor can approve the suggestion. &lt;br /&gt;
&lt;br /&gt;
Typically, there are three cases when instructor approves the suggestion. First, if the student already has a topic and when suggesting a new topic, he chooses 'Yes' in the signup_preference, he will enroll the new suggested topic automatically after the instructor approves the suggested topic. Second, if the student is in the waitlist of a topic, and when suggesting a new topic, he chooses 'Yes' in the signup_preference, he will enroll the new suggested topic and be removed from the former waitlist. Third, if the student is in the waitlist of a topic, and when suggesting a new topic, he chooses 'No' in the signup_preference, after the instructor approves the new topic, he will remain in the waitlist of former topic, and new topic is left as 'no chooser'.&lt;br /&gt;
&lt;br /&gt;
Besides, Suggestion Controller also needs to be optimized from two aspects. First, the syntax need to be upgraded from rails 3.x to rails 4.x. Second, refactoring the mailer part is necessary.&lt;br /&gt;
== Expertiza==&lt;br /&gt;
The Expertiza project is software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==  Optimization==&lt;br /&gt;
=== Syntax ===&lt;br /&gt;
For the code to be coordinated with Rails 4 syntax, there is one major difference between Ruby 1.9 and 1.8 need to be change in the suggestion_controller.rb.&lt;br /&gt;
The hash operator using the &amp;quot;hash rocket&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{ :key =&amp;gt; 'value' }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Need to be changed into:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 { key :  'value' }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Refator ===&lt;br /&gt;
The approve_suggestion() method is quite long in the original code, and the send email function in the method is achieved twice, which doesn’t conform with DRY principle.&lt;br /&gt;
&lt;br /&gt;
The logic of the approve_suggestion() method is described as follows. First, approve the suggestion by create a new record in the SignUpTopic model, set relative parameters, and save the new record. Then send notification to the team. In the notification part, if the student doesn’t have a team, a new team should be created and assigned to the suggested topic.&lt;br /&gt;
Based on the logic, the approve_suggestion() method can be clearly divided into two parts: approve suggestion part, and notification part. In the notification part, send email function can be written as a single method in order not to repeat. Besides, creating a new team can also be written as a new method.&lt;br /&gt;
&lt;br /&gt;
After refactor, there are four new methods: approve, notification, create_new_team, and send_email. Approve and notification are called within approve_suggestion, while create_new_team and send_email are called within notification.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_new_team&lt;br /&gt;
    new_team = AssignmentTeam.create(name: 'Team' + @user_id.to_s + '_' + rand(1000).to_s, parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
    t_user = TeamsUser.create(team_id: new_team.id, user_id: @user_id)&lt;br /&gt;
    SignedUpTeam.create(topic_id: @signuptopic.id, team_id: new_team.id, is_waitlisted: 0)&lt;br /&gt;
          parent = TeamNode.create(parent_id: @signuptopic.assignment_id, node_object_id: new_team.id)&lt;br /&gt;
          TeamUserNode.create(parent_id: parent.id, node_object_id: t_user.id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def send_email&lt;br /&gt;
    proposer = User.find(@user_id)&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    cc_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
    end&lt;br /&gt;
    Mailer.suggested_topic_approved_message(&lt;br /&gt;
        { to: proposer.email,&lt;br /&gt;
          cc: cc_mail_list,&lt;br /&gt;
          subject: &amp;quot;Suggested topic '#{@suggestion.title}' has already been approved&amp;quot;,&lt;br /&gt;
          body: {&lt;br /&gt;
              approved_topic_name: @suggestion.title,&lt;br /&gt;
              proposer: proposer.name&lt;br /&gt;
          }&lt;br /&gt;
        }&lt;br /&gt;
    ).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def approve&lt;br /&gt;
    @suggestion = Suggestion.find(params[:id])&lt;br /&gt;
    @user_id = User.where(name: @suggestion.unityID).first.id&lt;br /&gt;
    @team_id = TeamsUser.team_id(@suggestion.assignment_id, @user_id)&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@suggestion.assignment_id, @user_id)&lt;br /&gt;
    @signuptopic = SignUpTopic.new&lt;br /&gt;
    @signuptopic.topic_identifier = 'S' + Suggestion.where(&amp;quot;assignment_id = ? and id &amp;lt;= ?&amp;quot;, @suggestion.assignment_id, @suggestion.id).size.to_s&lt;br /&gt;
    @signuptopic.topic_name = @suggestion.title&lt;br /&gt;
    @signuptopic.assignment_id = @suggestion.assignment_id&lt;br /&gt;
    @signuptopic.max_choosers = 1;&lt;br /&gt;
    if @signuptopic.save &amp;amp;&amp;amp; @suggestion.update_attribute('status', 'Approved')&lt;br /&gt;
      flash[:notice] = 'Successfully approved the suggestion.'&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'Error when approving the suggestion.'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y'&lt;br /&gt;
      #if this user do not have team in this assignment, create one for him/her and assign this topic to this team.&lt;br /&gt;
      if @team_id.nil?&lt;br /&gt;
        create_new_team&lt;br /&gt;
      else #this user has a team in this assignment, check whether this team has topic or not&lt;br /&gt;
        if @topic_id.nil?&lt;br /&gt;
          #clean waitlists&lt;br /&gt;
          SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
          SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
        else&lt;br /&gt;
          @signuptopic.private_to = @user_id&lt;br /&gt;
          @signuptopic.save&lt;br /&gt;
          #if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
          send_email&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      #if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      send_email&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def approve_suggestion&lt;br /&gt;
    approve&lt;br /&gt;
    notification&lt;br /&gt;
    redirect_to action: 'show', id: @suggestion&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test ==&lt;br /&gt;
=== Rspec===&lt;br /&gt;
[[Rspec]] was used to conduct all the tests.&lt;br /&gt;
RSpec is a Behaviour-Driven Development tool for Ruby programmers. BDD is an approach to software development that combines Test-Driven Development, Domain Driven Design, and Acceptance Test-Driven Planning. RSpec helps you do the TDD part of that equation, focusing on the documentation and design aspects of TDD.&lt;br /&gt;
&lt;br /&gt;
=== Test1 ===&lt;br /&gt;
In the first test, we are going to test the result of approving a student's suggestion topic if the student is in a waitlist. He will be removed from the waitlist and added to the new list, if he selected the signup_preference to be 'Yes'.&lt;br /&gt;
We choose 'Writing Assignment 1a' of 'CSC/ECE 517, Spring 2015' as test assignment. I simulate creating a new suggestion with student5717, in team 'Writing Assignment 1a Team14'.&lt;br /&gt;
&lt;br /&gt;
First, log in as Student5717 and suggest a new topic, and choose 'Yes' in signup_preference.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     # Login with student5717 account&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      expect(page).to have_content('Welcome')&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: &amp;quot;student5717&amp;quot;&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: &amp;quot;password&amp;quot;&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
      # suggest a new suggestion&lt;br /&gt;
      visit '/suggestion/new?id=711'&lt;br /&gt;
      fill_in 'suggestion_title',  with: 'RSpect'&lt;br /&gt;
      fill_in 'suggestion_description',  with: 'RSpect is a ROR test framework. It focus on function test'&lt;br /&gt;
      # select 'suggestion_signup_preference', with: 'Y'&lt;br /&gt;
      expect{click_button &amp;quot;Submit&amp;quot;}.to change(Suggestion, :count).by(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, log out Student5717, and log in with 'instructor6' account, who is the manager of this course. Then approve the suggest.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      # Logout current account student5717&lt;br /&gt;
      visit '/suggestion/new?id=711'&lt;br /&gt;
      click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
      expect(current_path).to eq(&amp;quot;/&amp;quot;)&lt;br /&gt;
      &lt;br /&gt;
      # Login with account instructor6&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      expect(page).to have_content('Welcome.')&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
      &lt;br /&gt;
      # approve the suggestion&lt;br /&gt;
      expect(page).to have_content('Manage content')&lt;br /&gt;
      visit '/suggestion/list?id=711&amp;amp;type=Assignment'&lt;br /&gt;
      expect(page).to have_content('Suggested topics for Writing assignment 1a')&lt;br /&gt;
      expect(page).to have_content('RSpect')&lt;br /&gt;
      &lt;br /&gt;
      num = Suggestion.last.id&lt;br /&gt;
      visit &amp;quot;/suggestion/&amp;quot;+num.to_s&lt;br /&gt;
      expect(page).to have_content('Suggestion')&lt;br /&gt;
      expect(page).to have_content('Title:	RSpect')&lt;br /&gt;
      click_button &amp;quot;Approve suggestion&amp;quot;&lt;br /&gt;
      visit &amp;quot;/suggestion/&amp;quot;+num.to_s&lt;br /&gt;
      expect(page).to have_content('status:	Approved')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finally, check if suggestion approved successfully. I need to check topic list with 'instructor6' account logged in and check the selected topic in student5717 account.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      # check if is not in waitlist&lt;br /&gt;
      visit &amp;quot;/assignments/711/edit#tabs-2&amp;quot;&lt;br /&gt;
      expect(page).to have_no_content(&amp;quot;&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;Writing assignment 1a_Team14&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;student5717 &amp;lt;font color='red'&amp;gt;(waitlisted)&amp;lt;/font&amp;gt;&amp;quot;)&lt;br /&gt;
      &lt;br /&gt;
      # Logout current account instructor6&lt;br /&gt;
      visit '/suggestion/new?id=711'&lt;br /&gt;
      click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
      current_path.should == &amp;quot;/&amp;quot;&lt;br /&gt;
      &lt;br /&gt;
      # Login with student5717 account&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      expect(page).to have_content('Welcome')&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: &amp;quot;student5717&amp;quot;&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: &amp;quot;password&amp;quot;&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
      &lt;br /&gt;
      # Check if you select the topic successfully&lt;br /&gt;
      visit '/sign_up_sheet/list?assignment_id=711'&lt;br /&gt;
      expect(page).to have_content('Your topic(s): RSpect')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Test2 ===&lt;br /&gt;
For the second test, Writing Assignment 1a team1, whose team id is 23781, was chosen to perform a serial of action. Team no.23781 is holding a topic: Amazon S3 and Rails. And Writing Assignment 1a team5, whose team id is 23800, is in the waiting list of this topic.&lt;br /&gt;
First, sign in as Student 5404 from team1, send a suggestion for new topic and indicate they want to choose their suggested topic.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      @newtopic = 'Violet and Zoe'&lt;br /&gt;
&lt;br /&gt;
      #sign in as student5404:&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: 'student5404'&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
      expect(page).to have_content('Assignments')&lt;br /&gt;
&lt;br /&gt;
      #suggest a topic:&lt;br /&gt;
      # signup_preference default to be Y&lt;br /&gt;
      visit &amp;quot;/student_task/view?id=28634&amp;quot;&lt;br /&gt;
      expect(page).to have_content('Submit or Review work')&lt;br /&gt;
      visit &amp;quot;/suggestion/new?id=711&amp;quot;&lt;br /&gt;
      expect(page).to have_content('New suggestion')&lt;br /&gt;
      fill_in 'Title',with: @newtopic&lt;br /&gt;
      expect{click_button &amp;quot;Submit&amp;quot;}.to change(Suggestion, :count).by(1)&lt;br /&gt;
&lt;br /&gt;
      #logout&lt;br /&gt;
      click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
      expect(current_path).to eq(&amp;quot;/&amp;quot;)&lt;br /&gt;
      visit '/suggestion/new?id=711'&lt;br /&gt;
      expect(page).to have_content('This is not allowed')&lt;br /&gt;
      expect(page).to have_content('Welcome')&lt;br /&gt;
      expect(page).to have_no_content('User: student5404')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then sign in as instructor6 and approve the suggested topic.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #sign in as instructor6&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      expect(page).to have_content('Welcome.')&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
      expect(page).to have_content('Manage content')&lt;br /&gt;
&lt;br /&gt;
      #approve the suggestion&lt;br /&gt;
      visit '/suggestion/list?id=711&amp;amp;type=Assignment'&lt;br /&gt;
      expect(page).to have_content('Suggested topics for Writing assignment 1a')&lt;br /&gt;
      num = Suggestion.last.id.to_s&lt;br /&gt;
      visit &amp;quot;/suggestion/&amp;quot;+num&lt;br /&gt;
      expect(page).to have_content('Suggestion')&lt;br /&gt;
      expect(page).to have_content('Title: '+@newtopic)&lt;br /&gt;
      click_button &amp;quot;Approve suggestion&amp;quot;&lt;br /&gt;
      visit &amp;quot;/suggestion/&amp;quot;+num.to_s&lt;br /&gt;
      expect(page).to have_content('status:	Approved')&lt;br /&gt;
&lt;br /&gt;
      #logout as instructor6&lt;br /&gt;
      click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
      expect(current_path).to eq(&amp;quot;/&amp;quot;)&lt;br /&gt;
      visit '/suggestion/new?id=711'&lt;br /&gt;
      expect(page).to have_content('This is not allowed')&lt;br /&gt;
      expect(page).to have_content('Welcome')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finally, to check the results. On the one hand, sign in as student5404 again and see if her/his team is holding the new topic. On the other hand sign in as instructor6 and check if team no.23800 is holding the old topic: Amazon S3 and Rails.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      #sign in as student5404:&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: 'student5404'&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
      expect(page).to have_content('Assignments')&lt;br /&gt;
&lt;br /&gt;
      #check the approved suggestion in topics list&lt;br /&gt;
      visit &amp;quot;/sign_up_sheet/list?assignment_id=711&amp;quot;&lt;br /&gt;
      expect(page).to have_content(&amp;quot;Your approved suggested topic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
      # switch to the new topic&lt;br /&gt;
      num2 = SignUpTopic.last.id.to_s&lt;br /&gt;
      visit &amp;quot;/sign_up_sheet/switch_original_topic_to_approved_suggested_topic/&amp;quot;+num2+&amp;quot;?assignment_id=711&amp;quot;&lt;br /&gt;
      expect(page).to have_content(&amp;quot;Your topic(s): &amp;quot;+@newtopic)&lt;br /&gt;
      &lt;br /&gt;
      #logout student5404&lt;br /&gt;
      click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
      expect(current_path).to eq(&amp;quot;/&amp;quot;)&lt;br /&gt;
      visit '/suggestion/new?id=711'&lt;br /&gt;
      expect(page).to have_content('This is not allowed')&lt;br /&gt;
      expect(page).to have_content('Welcome')&lt;br /&gt;
      expect(page).to have_no_content('User: student5404')&lt;br /&gt;
&lt;br /&gt;
      #sign in as instructor6&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      expect(page).to have_content('Welcome.')&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
      expect(page).to have_content('Manage content')&lt;br /&gt;
      &lt;br /&gt;
      # check if team1 is has not enrolled&lt;br /&gt;
      visit &amp;quot;/assignments/711/edit#tabs-2&amp;quot;&lt;br /&gt;
      expect(page).to have_no_content(&amp;quot;&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;Writing assignment 1a_Team1&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;student5404 student5731 &amp;lt;br/&amp;gt;&amp;quot;)&lt;br /&gt;
      expect(page).to have_content(&amp;quot;Writing assignment 1a_Team5 student5740 student5704&amp;quot;)&lt;br /&gt;
      expect(page).to have_content(&amp;quot;S1 Violet and Zoe Writing assignment 1a_Team1 student5404 student5731&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Test3 ===&lt;br /&gt;
The third test is similar to the second one. Team no.23781 and assignment no.711 are chosen for this test again. &lt;br /&gt;
First, student no.5404 login to the system, visit the assignment page, and make a topic suggestion. In the suggestion, instead of choosing “yes” in signup preference, the student chooses “no” in order not to use the suggested topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: &amp;quot;student5404&amp;quot;&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: &amp;quot;password&amp;quot;&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
visit '/suggestion/new?id=711'&lt;br /&gt;
fill_in 'suggestion_title',  with: 'test title'&lt;br /&gt;
fill_in 'suggestion_description',  with: 'test description'&lt;br /&gt;
select 'No', from: &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button &amp;quot;Submit&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After the suggestion is made, login as an instructor, find the assignment, and approve the suggestion. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
&lt;br /&gt;
num = Suggestion.last.id&lt;br /&gt;
path = &amp;quot;/suggestion/&amp;quot; + num.to_s&lt;br /&gt;
visit path&lt;br /&gt;
click_button &amp;quot;Approve suggestion&amp;quot;&lt;br /&gt;
&lt;br /&gt;
click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In the final step, we check if the new topic is shown in the topic list, then login as student no.5401 again, check if they still hold their old topic.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: 'student5404'&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
visit '/sign_up_sheet/list?assignment_id=711'&lt;br /&gt;
expect(page).to have_content('Your topic(s): Amazon S3 and Rails')&lt;br /&gt;
click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
&lt;br /&gt;
visit &amp;quot;/assignments/711/edit#tabs-2&amp;quot;&lt;br /&gt;
expect(page).to have_content(&amp;quot;Amazon S3 and Rails&amp;quot;)&lt;br /&gt;
expect(page).to have_content(&amp;quot;test title&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Result ===&lt;br /&gt;
Here is the result of our tests. All test cases passed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ChendeMacBook-Pro:expertiza chen$ rspec spec/controllers/suggestion_controller_spec.rb &lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 8804&lt;br /&gt;
/Users/chen/RubymineProjects/expertiza/app/models/suggestion.rb:5: warning: circular argument reference - assignment_id&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
Deprecation Warnings:&lt;br /&gt;
&lt;br /&gt;
Using `should` from rspec-expectations' old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:should` with `config.expect_with(:rspec) { |c| c.syntax = :should }` instead. Called from /Users/chen/RubymineProjects/expertiza/spec/controllers/suggestion_controller_spec.rb:67:in `block (3 levels) in &amp;lt;top (required)&amp;gt;'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need more of the backtrace for any of these deprecations to&lt;br /&gt;
identify where to make the necessary changes, you can configure&lt;br /&gt;
`config.raise_errors_for_deprecations!`, and it will turn the&lt;br /&gt;
deprecation warnings into errors, giving you the full backtrace.&lt;br /&gt;
&lt;br /&gt;
1 deprecation warning total&lt;br /&gt;
&lt;br /&gt;
Finished in 1 minute 6.74 seconds (files took 5.3 seconds to load)&lt;br /&gt;
6 examples, 0 failures&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 8804&lt;br /&gt;
&lt;br /&gt;
Coverage report generated for RSpec to /Users/chen/RubymineProjects/expertiza/coverage. 1638 / 5233 LOC (31.3%) covered.&lt;br /&gt;
[Coveralls] Outside the CI environment, not sending data.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== UI test ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For instructor:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For students:&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For student users, first you need to login your account, find a certain course, and make suggestion&lt;br /&gt;
[[File:1.png]]&lt;br /&gt;
Then, based on your need, choose if you want to work on the suggestion you suggested.&lt;br /&gt;
[[File:2.png]]&lt;br /&gt;
After saving, there will be a flash message on your webpage, and the suggested topic would be shown.&lt;br /&gt;
[[File:3.png]]&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:3.png&amp;diff=99101</id>
		<title>File:3.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:3.png&amp;diff=99101"/>
		<updated>2015-11-09T20:31:33Z</updated>

		<summary type="html">&lt;p&gt;Hma5: uploaded a new version of &amp;amp;quot;File:3.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;IS-A and HAS-A Rules of Inheritance&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:2.png&amp;diff=99100</id>
		<title>File:2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:2.png&amp;diff=99100"/>
		<updated>2015-11-09T20:31:11Z</updated>

		<summary type="html">&lt;p&gt;Hma5: uploaded a new version of &amp;amp;quot;File:2.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Double diamond problem&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:1.png&amp;diff=99099</id>
		<title>File:1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:1.png&amp;diff=99099"/>
		<updated>2015-11-09T20:26:50Z</updated>

		<summary type="html">&lt;p&gt;Hma5: uploaded a new version of &amp;amp;quot;File:1.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Distributed Version Control System&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:1.png&amp;diff=99098</id>
		<title>File:1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:1.png&amp;diff=99098"/>
		<updated>2015-11-09T20:25:44Z</updated>

		<summary type="html">&lt;p&gt;Hma5: uploaded a new version of &amp;amp;quot;File:1.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Distributed Version Control System&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1556_CHM&amp;diff=99097</id>
		<title>CSC/ECE 517 Fall 2015/oss E1556 CHM</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1556_CHM&amp;diff=99097"/>
		<updated>2015-11-09T20:25:10Z</updated>

		<summary type="html">&lt;p&gt;Hma5: /* UI test */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;6&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1556. Refactoring SuggestionController.rb&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
== Project description==&lt;br /&gt;
This project is about testing and optimizing of SuggestionController of Expertiza system. Suggestion Controller is a module for students to suggest a new topic for their writing assignments, and instructor can approve the suggestion. &lt;br /&gt;
&lt;br /&gt;
Typically, there are three cases when instructor approves the suggestion. First, if the student already has a topic and when suggesting a new topic, he chooses 'Yes' in the signup_preference, he will enroll the new suggested topic automatically after the instructor approves the suggested topic. Second, if the student is in the waitlist of a topic, and when suggesting a new topic, he chooses 'Yes' in the signup_preference, he will enroll the new suggested topic and be removed from the former waitlist. Third, if the student is in the waitlist of a topic, and when suggesting a new topic, he chooses 'No' in the signup_preference, after the instructor approves the new topic, he will remain in the waitlist of former topic, and new topic is left as 'no chooser'.&lt;br /&gt;
&lt;br /&gt;
Besides, Suggestion Controller also needs to be optimized from two aspects. First, the syntax need to be upgraded from rails 3.x to rails 4.x. Second, refactoring the mailer part is necessary.&lt;br /&gt;
== Expertiza==&lt;br /&gt;
The Expertiza project is software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==  Optimization==&lt;br /&gt;
=== Syntax ===&lt;br /&gt;
For the code to be coordinated with Rails 4 syntax, there is one major difference between Ruby 1.9 and 1.8 need to be change in the suggestion_controller.rb.&lt;br /&gt;
The hash operator using the &amp;quot;hash rocket&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{ :key =&amp;gt; 'value' }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Need to be changed into:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 { key :  'value' }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Refator ===&lt;br /&gt;
The approve_suggestion() method is quite long in the original code, and the send email function in the method is achieved twice, which doesn’t conform with DRY principle.&lt;br /&gt;
&lt;br /&gt;
The logic of the approve_suggestion() method is described as follows. First, approve the suggestion by create a new record in the SignUpTopic model, set relative parameters, and save the new record. Then send notification to the team. In the notification part, if the student doesn’t have a team, a new team should be created and assigned to the suggested topic.&lt;br /&gt;
Based on the logic, the approve_suggestion() method can be clearly divided into two parts: approve suggestion part, and notification part. In the notification part, send email function can be written as a single method in order not to repeat. Besides, creating a new team can also be written as a new method.&lt;br /&gt;
&lt;br /&gt;
After refactor, there are four new methods: approve, notification, create_new_team, and send_email. Approve and notification are called within approve_suggestion, while create_new_team and send_email are called within notification.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_new_team&lt;br /&gt;
    new_team = AssignmentTeam.create(name: 'Team' + @user_id.to_s + '_' + rand(1000).to_s, parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
    t_user = TeamsUser.create(team_id: new_team.id, user_id: @user_id)&lt;br /&gt;
    SignedUpTeam.create(topic_id: @signuptopic.id, team_id: new_team.id, is_waitlisted: 0)&lt;br /&gt;
          parent = TeamNode.create(parent_id: @signuptopic.assignment_id, node_object_id: new_team.id)&lt;br /&gt;
          TeamUserNode.create(parent_id: parent.id, node_object_id: t_user.id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def send_email&lt;br /&gt;
    proposer = User.find(@user_id)&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    cc_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
    end&lt;br /&gt;
    Mailer.suggested_topic_approved_message(&lt;br /&gt;
        { to: proposer.email,&lt;br /&gt;
          cc: cc_mail_list,&lt;br /&gt;
          subject: &amp;quot;Suggested topic '#{@suggestion.title}' has already been approved&amp;quot;,&lt;br /&gt;
          body: {&lt;br /&gt;
              approved_topic_name: @suggestion.title,&lt;br /&gt;
              proposer: proposer.name&lt;br /&gt;
          }&lt;br /&gt;
        }&lt;br /&gt;
    ).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def approve&lt;br /&gt;
    @suggestion = Suggestion.find(params[:id])&lt;br /&gt;
    @user_id = User.where(name: @suggestion.unityID).first.id&lt;br /&gt;
    @team_id = TeamsUser.team_id(@suggestion.assignment_id, @user_id)&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@suggestion.assignment_id, @user_id)&lt;br /&gt;
    @signuptopic = SignUpTopic.new&lt;br /&gt;
    @signuptopic.topic_identifier = 'S' + Suggestion.where(&amp;quot;assignment_id = ? and id &amp;lt;= ?&amp;quot;, @suggestion.assignment_id, @suggestion.id).size.to_s&lt;br /&gt;
    @signuptopic.topic_name = @suggestion.title&lt;br /&gt;
    @signuptopic.assignment_id = @suggestion.assignment_id&lt;br /&gt;
    @signuptopic.max_choosers = 1;&lt;br /&gt;
    if @signuptopic.save &amp;amp;&amp;amp; @suggestion.update_attribute('status', 'Approved')&lt;br /&gt;
      flash[:notice] = 'Successfully approved the suggestion.'&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'Error when approving the suggestion.'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y'&lt;br /&gt;
      #if this user do not have team in this assignment, create one for him/her and assign this topic to this team.&lt;br /&gt;
      if @team_id.nil?&lt;br /&gt;
        create_new_team&lt;br /&gt;
      else #this user has a team in this assignment, check whether this team has topic or not&lt;br /&gt;
        if @topic_id.nil?&lt;br /&gt;
          #clean waitlists&lt;br /&gt;
          SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
          SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
        else&lt;br /&gt;
          @signuptopic.private_to = @user_id&lt;br /&gt;
          @signuptopic.save&lt;br /&gt;
          #if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
          send_email&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      #if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      send_email&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def approve_suggestion&lt;br /&gt;
    approve&lt;br /&gt;
    notification&lt;br /&gt;
    redirect_to action: 'show', id: @suggestion&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test ==&lt;br /&gt;
=== Rspec===&lt;br /&gt;
[[Rspec]] was used to conduct all the tests.&lt;br /&gt;
RSpec is a Behaviour-Driven Development tool for Ruby programmers. BDD is an approach to software development that combines Test-Driven Development, Domain Driven Design, and Acceptance Test-Driven Planning. RSpec helps you do the TDD part of that equation, focusing on the documentation and design aspects of TDD.&lt;br /&gt;
&lt;br /&gt;
=== Test1 ===&lt;br /&gt;
In the first test, we are going to test the result of approving a student's suggestion topic if the student is in a waitlist. He will be removed from the waitlist and added to the new list, if he selected the signup_preference to be 'Yes'.&lt;br /&gt;
We choose 'Writing Assignment 1a' of 'CSC/ECE 517, Spring 2015' as test assignment. I simulate creating a new suggestion with student5717, in team 'Writing Assignment 1a Team14'.&lt;br /&gt;
&lt;br /&gt;
First, log in as Student5717 and suggest a new topic, and choose 'Yes' in signup_preference.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
     # Login with student5717 account&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      expect(page).to have_content('Welcome')&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: &amp;quot;student5717&amp;quot;&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: &amp;quot;password&amp;quot;&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
      # suggest a new suggestion&lt;br /&gt;
      visit '/suggestion/new?id=711'&lt;br /&gt;
      fill_in 'suggestion_title',  with: 'RSpect'&lt;br /&gt;
      fill_in 'suggestion_description',  with: 'RSpect is a ROR test framework. It focus on function test'&lt;br /&gt;
      # select 'suggestion_signup_preference', with: 'Y'&lt;br /&gt;
      expect{click_button &amp;quot;Submit&amp;quot;}.to change(Suggestion, :count).by(1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, log out Student5717, and log in with 'instructor6' account, who is the manager of this course. Then approve the suggest.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      # Logout current account student5717&lt;br /&gt;
      visit '/suggestion/new?id=711'&lt;br /&gt;
      click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
      expect(current_path).to eq(&amp;quot;/&amp;quot;)&lt;br /&gt;
      &lt;br /&gt;
      # Login with account instructor6&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      expect(page).to have_content('Welcome.')&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
      &lt;br /&gt;
      # approve the suggestion&lt;br /&gt;
      expect(page).to have_content('Manage content')&lt;br /&gt;
      visit '/suggestion/list?id=711&amp;amp;type=Assignment'&lt;br /&gt;
      expect(page).to have_content('Suggested topics for Writing assignment 1a')&lt;br /&gt;
      expect(page).to have_content('RSpect')&lt;br /&gt;
      &lt;br /&gt;
      num = Suggestion.last.id&lt;br /&gt;
      visit &amp;quot;/suggestion/&amp;quot;+num.to_s&lt;br /&gt;
      expect(page).to have_content('Suggestion')&lt;br /&gt;
      expect(page).to have_content('Title:	RSpect')&lt;br /&gt;
      click_button &amp;quot;Approve suggestion&amp;quot;&lt;br /&gt;
      visit &amp;quot;/suggestion/&amp;quot;+num.to_s&lt;br /&gt;
      expect(page).to have_content('status:	Approved')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finally, check if suggestion approved successfully. I need to check topic list with 'instructor6' account logged in and check the selected topic in student5717 account.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      # check if is not in waitlist&lt;br /&gt;
      visit &amp;quot;/assignments/711/edit#tabs-2&amp;quot;&lt;br /&gt;
      expect(page).to have_no_content(&amp;quot;&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;Writing assignment 1a_Team14&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;student5717 &amp;lt;font color='red'&amp;gt;(waitlisted)&amp;lt;/font&amp;gt;&amp;quot;)&lt;br /&gt;
      &lt;br /&gt;
      # Logout current account instructor6&lt;br /&gt;
      visit '/suggestion/new?id=711'&lt;br /&gt;
      click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
      current_path.should == &amp;quot;/&amp;quot;&lt;br /&gt;
      &lt;br /&gt;
      # Login with student5717 account&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      expect(page).to have_content('Welcome')&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: &amp;quot;student5717&amp;quot;&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: &amp;quot;password&amp;quot;&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
      &lt;br /&gt;
      # Check if you select the topic successfully&lt;br /&gt;
      visit '/sign_up_sheet/list?assignment_id=711'&lt;br /&gt;
      expect(page).to have_content('Your topic(s): RSpect')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Test2 ===&lt;br /&gt;
For the second test, Writing Assignment 1a team1, whose team id is 23781, was chosen to perform a serial of action. Team no.23781 is holding a topic: Amazon S3 and Rails. And Writing Assignment 1a team5, whose team id is 23800, is in the waiting list of this topic.&lt;br /&gt;
First, sign in as Student 5404 from team1, send a suggestion for new topic and indicate they want to choose their suggested topic.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      @newtopic = 'Violet and Zoe'&lt;br /&gt;
&lt;br /&gt;
      #sign in as student5404:&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: 'student5404'&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
      expect(page).to have_content('Assignments')&lt;br /&gt;
&lt;br /&gt;
      #suggest a topic:&lt;br /&gt;
      # signup_preference default to be Y&lt;br /&gt;
      visit &amp;quot;/student_task/view?id=28634&amp;quot;&lt;br /&gt;
      expect(page).to have_content('Submit or Review work')&lt;br /&gt;
      visit &amp;quot;/suggestion/new?id=711&amp;quot;&lt;br /&gt;
      expect(page).to have_content('New suggestion')&lt;br /&gt;
      fill_in 'Title',with: @newtopic&lt;br /&gt;
      expect{click_button &amp;quot;Submit&amp;quot;}.to change(Suggestion, :count).by(1)&lt;br /&gt;
&lt;br /&gt;
      #logout&lt;br /&gt;
      click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
      expect(current_path).to eq(&amp;quot;/&amp;quot;)&lt;br /&gt;
      visit '/suggestion/new?id=711'&lt;br /&gt;
      expect(page).to have_content('This is not allowed')&lt;br /&gt;
      expect(page).to have_content('Welcome')&lt;br /&gt;
      expect(page).to have_no_content('User: student5404')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then sign in as instructor6 and approve the suggested topic.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 #sign in as instructor6&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      expect(page).to have_content('Welcome.')&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
      expect(page).to have_content('Manage content')&lt;br /&gt;
&lt;br /&gt;
      #approve the suggestion&lt;br /&gt;
      visit '/suggestion/list?id=711&amp;amp;type=Assignment'&lt;br /&gt;
      expect(page).to have_content('Suggested topics for Writing assignment 1a')&lt;br /&gt;
      num = Suggestion.last.id.to_s&lt;br /&gt;
      visit &amp;quot;/suggestion/&amp;quot;+num&lt;br /&gt;
      expect(page).to have_content('Suggestion')&lt;br /&gt;
      expect(page).to have_content('Title: '+@newtopic)&lt;br /&gt;
      click_button &amp;quot;Approve suggestion&amp;quot;&lt;br /&gt;
      visit &amp;quot;/suggestion/&amp;quot;+num.to_s&lt;br /&gt;
      expect(page).to have_content('status:	Approved')&lt;br /&gt;
&lt;br /&gt;
      #logout as instructor6&lt;br /&gt;
      click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
      expect(current_path).to eq(&amp;quot;/&amp;quot;)&lt;br /&gt;
      visit '/suggestion/new?id=711'&lt;br /&gt;
      expect(page).to have_content('This is not allowed')&lt;br /&gt;
      expect(page).to have_content('Welcome')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finally, to check the results. On the one hand, sign in as student5404 again and see if her/his team is holding the new topic. On the other hand sign in as instructor6 and check if team no.23800 is holding the old topic: Amazon S3 and Rails.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      #sign in as student5404:&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: 'student5404'&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
      expect(page).to have_content('Assignments')&lt;br /&gt;
&lt;br /&gt;
      #check the approved suggestion in topics list&lt;br /&gt;
      visit &amp;quot;/sign_up_sheet/list?assignment_id=711&amp;quot;&lt;br /&gt;
      expect(page).to have_content(&amp;quot;Your approved suggested topic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
      # switch to the new topic&lt;br /&gt;
      num2 = SignUpTopic.last.id.to_s&lt;br /&gt;
      visit &amp;quot;/sign_up_sheet/switch_original_topic_to_approved_suggested_topic/&amp;quot;+num2+&amp;quot;?assignment_id=711&amp;quot;&lt;br /&gt;
      expect(page).to have_content(&amp;quot;Your topic(s): &amp;quot;+@newtopic)&lt;br /&gt;
      &lt;br /&gt;
      #logout student5404&lt;br /&gt;
      click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
      expect(current_path).to eq(&amp;quot;/&amp;quot;)&lt;br /&gt;
      visit '/suggestion/new?id=711'&lt;br /&gt;
      expect(page).to have_content('This is not allowed')&lt;br /&gt;
      expect(page).to have_content('Welcome')&lt;br /&gt;
      expect(page).to have_no_content('User: student5404')&lt;br /&gt;
&lt;br /&gt;
      #sign in as instructor6&lt;br /&gt;
      visit 'content_pages/view'&lt;br /&gt;
      expect(page).to have_content('Welcome.')&lt;br /&gt;
      fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
      fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
      click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
      expect(page).to have_content('Manage content')&lt;br /&gt;
      &lt;br /&gt;
      # check if team1 is has not enrolled&lt;br /&gt;
      visit &amp;quot;/assignments/711/edit#tabs-2&amp;quot;&lt;br /&gt;
      expect(page).to have_no_content(&amp;quot;&amp;lt;br/&amp;gt;&amp;lt;b&amp;gt;Writing assignment 1a_Team1&amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;student5404 student5731 &amp;lt;br/&amp;gt;&amp;quot;)&lt;br /&gt;
      expect(page).to have_content(&amp;quot;Writing assignment 1a_Team5 student5740 student5704&amp;quot;)&lt;br /&gt;
      expect(page).to have_content(&amp;quot;S1 Violet and Zoe Writing assignment 1a_Team1 student5404 student5731&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Test3 ===&lt;br /&gt;
The third test is similar to the second one. Team no.23781 and assignment no.711 are chosen for this test again. &lt;br /&gt;
First, student no.5404 login to the system, visit the assignment page, and make a topic suggestion. In the suggestion, instead of choosing “yes” in signup preference, the student chooses “no” in order not to use the suggested topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: &amp;quot;student5404&amp;quot;&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: &amp;quot;password&amp;quot;&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
visit '/suggestion/new?id=711'&lt;br /&gt;
fill_in 'suggestion_title',  with: 'test title'&lt;br /&gt;
fill_in 'suggestion_description',  with: 'test description'&lt;br /&gt;
select 'No', from: &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button &amp;quot;Submit&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After the suggestion is made, login as an instructor, find the assignment, and approve the suggestion. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
&lt;br /&gt;
num = Suggestion.last.id&lt;br /&gt;
path = &amp;quot;/suggestion/&amp;quot; + num.to_s&lt;br /&gt;
visit path&lt;br /&gt;
click_button &amp;quot;Approve suggestion&amp;quot;&lt;br /&gt;
&lt;br /&gt;
click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In the final step, we check if the new topic is shown in the topic list, then login as student no.5401 again, check if they still hold their old topic.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: 'student5404'&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
visit '/sign_up_sheet/list?assignment_id=711'&lt;br /&gt;
expect(page).to have_content('Your topic(s): Amazon S3 and Rails')&lt;br /&gt;
click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
&lt;br /&gt;
visit &amp;quot;/assignments/711/edit#tabs-2&amp;quot;&lt;br /&gt;
expect(page).to have_content(&amp;quot;Amazon S3 and Rails&amp;quot;)&lt;br /&gt;
expect(page).to have_content(&amp;quot;test title&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Result ===&lt;br /&gt;
Here is the result of our tests. All test cases passed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ChendeMacBook-Pro:expertiza chen$ rspec spec/controllers/suggestion_controller_spec.rb &lt;br /&gt;
[Coveralls] Set up the SimpleCov formatter.&lt;br /&gt;
[Coveralls] Using SimpleCov's 'rails' settings.&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 8804&lt;br /&gt;
/Users/chen/RubymineProjects/expertiza/app/models/suggestion.rb:5: warning: circular argument reference - assignment_id&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
Deprecation Warnings:&lt;br /&gt;
&lt;br /&gt;
Using `should` from rspec-expectations' old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:should` with `config.expect_with(:rspec) { |c| c.syntax = :should }` instead. Called from /Users/chen/RubymineProjects/expertiza/spec/controllers/suggestion_controller_spec.rb:67:in `block (3 levels) in &amp;lt;top (required)&amp;gt;'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need more of the backtrace for any of these deprecations to&lt;br /&gt;
identify where to make the necessary changes, you can configure&lt;br /&gt;
`config.raise_errors_for_deprecations!`, and it will turn the&lt;br /&gt;
deprecation warnings into errors, giving you the full backtrace.&lt;br /&gt;
&lt;br /&gt;
1 deprecation warning total&lt;br /&gt;
&lt;br /&gt;
Finished in 1 minute 6.74 seconds (files took 5.3 seconds to load)&lt;br /&gt;
6 examples, 0 failures&lt;br /&gt;
&lt;br /&gt;
Randomized with seed 8804&lt;br /&gt;
&lt;br /&gt;
Coverage report generated for RSpec to /Users/chen/RubymineProjects/expertiza/coverage. 1638 / 5233 LOC (31.3%) covered.&lt;br /&gt;
[Coveralls] Outside the CI environment, not sending data.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== UI test ===&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For instructor:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For students:&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For student users, first you need to login your account, find a certain course, and make suggestion&lt;br /&gt;
[[File:Example.jpg]]&lt;br /&gt;
Then, based on your need, choose if you want to work on the suggestion you suggested.&lt;br /&gt;
[[File:Example.jpg]]&lt;br /&gt;
After saving, there will be a flash message on your webpage, and the suggested topic would be shown.&lt;br /&gt;
[[File:Example.jpg]]&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1582_Create_integration_tests_for_the_instructor_interface_using_capybara_and_rspec&amp;diff=98154</id>
		<title>CSC/ECE 517 Fall 2015 E1582 Create integration tests for the instructor interface using capybara and rspec</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015_E1582_Create_integration_tests_for_the_instructor_interface_using_capybara_and_rspec&amp;diff=98154"/>
		<updated>2015-11-05T20:50:21Z</updated>

		<summary type="html">&lt;p&gt;Hma5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Intro ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
&lt;br /&gt;
=== Capybara ===&lt;br /&gt;
Capybara is a web-based automation test tool that simulates a real user to follow the scenarios of user stories.&amp;lt;ref&amp;gt;[https://github.com/jnicklas/capybara Capybara on GitHub]&amp;lt;/ref&amp;gt; It could interact with app to receive pages, parse the HTML and submit forms as a user would.&amp;lt;ref&amp;gt;[https://www.youtube.com/watch?v=p7ZcZNuZ0aw Introducing cucumber &amp;amp; capybara on YouTube]&amp;lt;/ref&amp;gt; Used with RSpec and Ruby on Rails (version 1.9 or later), capybara makes it easier to write integration tests. &amp;lt;ref&amp;gt;[http://techiferous.com/2010/04/using-capybara-in-rails-3/ Using Capybara in Rails 3]&amp;lt;/ref&amp;gt; It is used on the top of an underlying web-based driver and offers a user-friendly DSL (Domain Specific Language) to describe actions executed by the underlying web driver. Such as &amp;lt;code&amp;gt;rack::test&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;selenium-webdriver&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;capybara-webkit&amp;lt;/code&amp;gt;.&amp;lt;ref&amp;gt;[http://www.sitepoint.com/basics-capybara-improving-tests/ The Basics of Capybara and Improving Your Tests]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this project, we use capybara with rspec by adding the following line:&lt;br /&gt;
  require 'capybara/rspec'&lt;br /&gt;
Then put capybara specs in &amp;lt;code&amp;gt;spec/features&amp;lt;/code&amp;gt;.&lt;br /&gt;
=== Integration test ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
Based on the project requirements, testing can be divided into the following parts:&lt;br /&gt;
&lt;br /&gt;
T1. Ensure an instructor is able to login to the system.&lt;br /&gt;
&lt;br /&gt;
T2. Ensure an instuctor is able to create a course.&lt;br /&gt;
&lt;br /&gt;
T3. Ensure that the score of a certain assignment can be viewed.&lt;br /&gt;
&lt;br /&gt;
T4. Ensure to view the score of a review.&lt;br /&gt;
&lt;br /&gt;
T5. Ensure to view the score of an author feedback.&lt;br /&gt;
&lt;br /&gt;
T6. Ensure to create an assignment which has two rounds of review, has a topic or does not has a topic, and has a staggered-deadline.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references&amp;gt;&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1556_CHM&amp;diff=97344</id>
		<title>CSC/ECE 517 Fall 2015/oss E1556 CHM</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1556_CHM&amp;diff=97344"/>
		<updated>2015-10-30T17:22:18Z</updated>

		<summary type="html">&lt;p&gt;Hma5: /* Refator */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;6&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1556. Refactoring SuggestionController.rb&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
== Project description==&lt;br /&gt;
== Expertiza==&lt;br /&gt;
==  Optimization==&lt;br /&gt;
=== Syntax ===&lt;br /&gt;
=== Refator ===&lt;br /&gt;
The approve_suggestion() method is quite long in the original code, and the send email function in the method is achieved twice, which doesn’t conform with DRY principle.&lt;br /&gt;
&lt;br /&gt;
The logic of the approve_suggestion() method is described as follows. First, approve the suggestion by create a new record in the SignUpTopic model, set relative parameters, and save the new record. Then send notification to the team. In the notification part, if the student doesn’t have a team, a new team should be created and assigned to the suggested topic.&lt;br /&gt;
Based on the logic, the approve_suggestion() method can be clearly divided into two parts: approve suggestion part, and notification part. In the notification part, send email function can be written as a single method in order not to repeat. Besides, creating a new team can also be written as a new method.&lt;br /&gt;
&lt;br /&gt;
After refactor, there are four new methods: approve, notification, create_new_team, and send_email. Approve and notification are called within approve_suggestion, while create_new_team and send_email are called within notification.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def create_new_team&lt;br /&gt;
    new_team = AssignmentTeam.create(name: 'Team' + @user_id.to_s + '_' + rand(1000).to_s, parent_id: @signuptopic.assignment_id, type: 'AssignmentTeam')&lt;br /&gt;
    t_user = TeamsUser.create(team_id: new_team.id, user_id: @user_id)&lt;br /&gt;
    SignedUpTeam.create(topic_id: @signuptopic.id, team_id: new_team.id, is_waitlisted: 0)&lt;br /&gt;
          parent = TeamNode.create(parent_id: @signuptopic.assignment_id, node_object_id: new_team.id)&lt;br /&gt;
          TeamUserNode.create(parent_id: parent.id, node_object_id: t_user.id)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def send_email&lt;br /&gt;
    proposer = User.find(@user_id)&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: @team_id)&lt;br /&gt;
    cc_mail_list = Array.new&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
      cc_mail_list &amp;lt;&amp;lt; User.find(teams_user.user_id).email if teams_user.user_id != proposer.id&lt;br /&gt;
    end&lt;br /&gt;
    Mailer.suggested_topic_approved_message(&lt;br /&gt;
        { to: proposer.email,&lt;br /&gt;
          cc: cc_mail_list,&lt;br /&gt;
          subject: &amp;quot;Suggested topic '#{@suggestion.title}' has already been approved&amp;quot;,&lt;br /&gt;
          body: {&lt;br /&gt;
              approved_topic_name: @suggestion.title,&lt;br /&gt;
              proposer: proposer.name&lt;br /&gt;
          }&lt;br /&gt;
        }&lt;br /&gt;
    ).deliver&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def approve&lt;br /&gt;
    @suggestion = Suggestion.find(params[:id])&lt;br /&gt;
    @user_id = User.where(name: @suggestion.unityID).first.id&lt;br /&gt;
    @team_id = TeamsUser.team_id(@suggestion.assignment_id, @user_id)&lt;br /&gt;
    @topic_id = SignedUpTeam.topic_id(@suggestion.assignment_id, @user_id)&lt;br /&gt;
    @signuptopic = SignUpTopic.new&lt;br /&gt;
    @signuptopic.topic_identifier = 'S' + Suggestion.where(&amp;quot;assignment_id = ? and id &amp;lt;= ?&amp;quot;, @suggestion.assignment_id, @suggestion.id).size.to_s&lt;br /&gt;
    @signuptopic.topic_name = @suggestion.title&lt;br /&gt;
    @signuptopic.assignment_id = @suggestion.assignment_id&lt;br /&gt;
    @signuptopic.max_choosers = 1;&lt;br /&gt;
    if @signuptopic.save &amp;amp;&amp;amp; @suggestion.update_attribute('status', 'Approved')&lt;br /&gt;
      flash[:notice] = 'Successfully approved the suggestion.'&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = 'Error when approving the suggestion.'&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def notification&lt;br /&gt;
    if @suggestion.signup_preference == 'Y'&lt;br /&gt;
      #if this user do not have team in this assignment, create one for him/her and assign this topic to this team.&lt;br /&gt;
      if @team_id.nil?&lt;br /&gt;
        create_new_team&lt;br /&gt;
      else #this user has a team in this assignment, check whether this team has topic or not&lt;br /&gt;
        if @topic_id.nil?&lt;br /&gt;
          #clean waitlists&lt;br /&gt;
          SignedUpTeam.where(team_id: @team_id, is_waitlisted: 1).destroy_all&lt;br /&gt;
          SignedUpTeam.create(topic_id: @signuptopic.id, team_id: @team_id, is_waitlisted: 0)&lt;br /&gt;
        else&lt;br /&gt;
          @signuptopic.private_to = @user_id&lt;br /&gt;
          @signuptopic.save&lt;br /&gt;
          #if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
          send_email&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    else&lt;br /&gt;
      #if this team has topic, Expertiza will send an email (suggested_topic_approved_message) to this team&lt;br /&gt;
      send_email&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def approve_suggestion&lt;br /&gt;
    approve&lt;br /&gt;
    notification&lt;br /&gt;
    redirect_to action: 'show', id: @suggestion&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test ==&lt;br /&gt;
=== Rspec===&lt;br /&gt;
&lt;br /&gt;
=== Test1 ===&lt;br /&gt;
=== Test2 ===&lt;br /&gt;
=== Test3 ===&lt;br /&gt;
The third test is similar to the second one. Team no.23781 and assignment no.711 are chosen for this test again. &lt;br /&gt;
First, student no.5404 login to the system, visit the assignment page, and make a topic suggestion. In the suggestion, instead of choosing “yes” in signup preference, the student chooses “no” in order not to use the suggested topic. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: &amp;quot;student5404&amp;quot;&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: &amp;quot;password&amp;quot;&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
visit '/suggestion/new?id=711'&lt;br /&gt;
fill_in 'suggestion_title',  with: 'test title'&lt;br /&gt;
fill_in 'suggestion_description',  with: 'test description'&lt;br /&gt;
select 'No', from: &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button &amp;quot;Submit&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After the suggestion is made, login as an instructor, find the assignment, and approve the suggestion. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
&lt;br /&gt;
num = Suggestion.last.id&lt;br /&gt;
path = &amp;quot;/suggestion/&amp;quot; + num.to_s&lt;br /&gt;
visit path&lt;br /&gt;
click_button &amp;quot;Approve suggestion&amp;quot;&lt;br /&gt;
&lt;br /&gt;
click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In the final step, we check if the new topic is shown in the topic list, then login as student no.5401 again, check if they still hold their old topic.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: 'student5404'&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
visit '/sign_up_sheet/list?assignment_id=711'&lt;br /&gt;
expect(page).to have_content('Your topic(s): Amazon S3 and Rails')&lt;br /&gt;
click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
&lt;br /&gt;
visit &amp;quot;/assignments/711/edit#tabs-2&amp;quot;&lt;br /&gt;
expect(page).to have_content(&amp;quot;Amazon S3 and Rails&amp;quot;)&lt;br /&gt;
expect(page).to have_content(&amp;quot;test title&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Result ===&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1556_CHM&amp;diff=97340</id>
		<title>CSC/ECE 517 Fall 2015/oss E1556 CHM</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2015/oss_E1556_CHM&amp;diff=97340"/>
		<updated>2015-10-30T16:50:34Z</updated>

		<summary type="html">&lt;p&gt;Hma5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;6&amp;quot;&amp;gt;&amp;lt;b&amp;gt;E1556. Refactoring SuggestionController.rb&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&lt;br /&gt;
== Project description==&lt;br /&gt;
== Expertiza==&lt;br /&gt;
==  Optimization==&lt;br /&gt;
=== Syntax ===&lt;br /&gt;
=== Refator ===&lt;br /&gt;
== Test ==&lt;br /&gt;
=== Rspec===&lt;br /&gt;
&lt;br /&gt;
=== Test1 ===&lt;br /&gt;
=== Test2 ===&lt;br /&gt;
=== Test3 ===&lt;br /&gt;
The third test is similar to the second one. Team no.23781 and assignment no.711 are chosen for this test again. &lt;br /&gt;
First, student no.5404 login to the system, visit the assignment page, and make a topic suggestion. In the suggestion, instead of choosing “yes” in signup preference, the student chooses “no” in order not to use the suggested topic. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: &amp;quot;student5404&amp;quot;&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: &amp;quot;password&amp;quot;&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
visit '/suggestion/new?id=711'&lt;br /&gt;
fill_in 'suggestion_title',  with: 'test title'&lt;br /&gt;
fill_in 'suggestion_description',  with: 'test description'&lt;br /&gt;
select 'No', from: &amp;quot;suggestion_signup_preference&amp;quot;&lt;br /&gt;
click_button &amp;quot;Submit&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After the suggestion is made, login as an instructor, find the assignment, and approve the suggestion. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
&lt;br /&gt;
num = Suggestion.last.id&lt;br /&gt;
path = &amp;quot;/suggestion/&amp;quot; + num.to_s&lt;br /&gt;
visit path&lt;br /&gt;
click_button &amp;quot;Approve suggestion&amp;quot;&lt;br /&gt;
&lt;br /&gt;
click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In the final step, we check if the new topic is shown in the topic list, then login as student no.5401 again, check if they still hold their old topic.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: 'student5404'&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
visit '/sign_up_sheet/list?assignment_id=711'&lt;br /&gt;
expect(page).to have_content('Your topic(s): Amazon S3 and Rails')&lt;br /&gt;
click_link &amp;quot;Logout&amp;quot;&lt;br /&gt;
&lt;br /&gt;
visit 'content_pages/view'&lt;br /&gt;
fill_in &amp;quot;User Name&amp;quot;, with: 'instructor6'&lt;br /&gt;
fill_in &amp;quot;Password&amp;quot;, with: 'password'&lt;br /&gt;
click_button &amp;quot;SIGN IN&amp;quot;&lt;br /&gt;
&lt;br /&gt;
visit &amp;quot;/assignments/711/edit#tabs-2&amp;quot;&lt;br /&gt;
expect(page).to have_content(&amp;quot;Amazon S3 and Rails&amp;quot;)&lt;br /&gt;
expect(page).to have_content(&amp;quot;test title&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Result ===&lt;/div&gt;</summary>
		<author><name>Hma5</name></author>
	</entry>
</feed>