CSC/ECE 517 Fall 2015/oss E1556 CHM

From Expertiza_Wiki
Revision as of 16:50, 30 October 2015 by Hma5 (talk | contribs)
Jump to navigation Jump to search

E1556. Refactoring SuggestionController.rb

Project description

Expertiza

Optimization

Syntax

Refator

Test

Rspec

Test1

Test2

Test3

The third test is similar to the second one. Team no.23781 and assignment no.711 are chosen for this test again. 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.

visit 'content_pages/view'
fill_in "User Name", with: "student5404"
fill_in "Password", with: "password"
click_button "SIGN IN"
  
visit '/suggestion/new?id=711'
fill_in 'suggestion_title',  with: 'test title'
fill_in 'suggestion_description',  with: 'test description'
select 'No', from: "suggestion_signup_preference"
click_button "Submit"
  
click_link "Logout"

After the suggestion is made, login as an instructor, find the assignment, and approve the suggestion.

visit 'content_pages/view'
fill_in "User Name", with: 'instructor6'
fill_in "Password", with: 'password'
click_button "SIGN IN"

num = Suggestion.last.id
path = "/suggestion/" + num.to_s
visit path
click_button "Approve suggestion"

click_link "Logout"

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.

visit 'content_pages/view'
fill_in "User Name", with: 'student5404'
fill_in "Password", with: 'password'
click_button "SIGN IN"
  
visit '/sign_up_sheet/list?assignment_id=711'
expect(page).to have_content('Your topic(s): Amazon S3 and Rails')
click_link "Logout"

visit 'content_pages/view'
fill_in "User Name", with: 'instructor6'
fill_in "Password", with: 'password'
click_button "SIGN IN"

visit "/assignments/711/edit#tabs-2"
expect(page).to have_content("Amazon S3 and Rails")
expect(page).to have_content("test title")

Result