1
0
Fork 0

Fix tests in various ways

This commit is contained in:
Andrew Tomaka 2013-07-19 01:13:50 -04:00
parent 4831fd71e8
commit b49fca81b5
2 changed files with 19 additions and 4 deletions

View File

@ -6,6 +6,7 @@ one:
course: 101
alerted: false
semester: US13
sections: [1, 2, 3]
two:
user_id: 1
@ -13,6 +14,7 @@ two:
course: 241A
alerted: true
semester: FS13
sections: [3, 6, 9]
three:
user_id: 2
@ -20,4 +22,5 @@ three:
course: 312
alerted: false
semester: SS14
sections: [5, 6, 11]

View File

@ -3,8 +3,10 @@ require 'test_helper'
class AlertsControllerTest < ActionController::TestCase
setup do
@alert = alerts(:one)
@alert = alerts(:two)
@alert = alerts(:three)
@user = users(:one)
sign_in :user, @user
end
test "should get index" do
@ -20,7 +22,12 @@ class AlertsControllerTest < ActionController::TestCase
test "should create alert" do
assert_difference('Alert.count') do
post :create, alert: { alerted: @alert.alerted, course: @alert.course, department: @alert.department, user_id: @alert.user_id }
post :create, alert: {
course: @alert.course,
department: @alert.department,
semester: @alert.semester,
sections: @alert.sections
}
end
assert_redirected_to alert_path(assigns(:alert))
@ -37,7 +44,12 @@ class AlertsControllerTest < ActionController::TestCase
end
test "should update alert" do
put :update, id: @alert, alert: { alerted: @alert.alerted, course: @alert.course, department: @alert.department, user_id: @alert.user_id }
put :update, id: @alert, alert: {
course: @alert.course,
department: @alert.department,
semester: @alert.semester,
sections: @alert.sections
}
assert_redirected_to alert_path(assigns(:alert))
end