1
0
Fork 0
MSU-Course-Alerter/test/functional/alerts_controller_test.rb

64 lines
1.3 KiB
Ruby
Raw Permalink Normal View History

2013-04-02 02:43:01 -04:00
require 'test_helper'
class AlertsControllerTest < ActionController::TestCase
setup do
@alert = alerts(:one)
2013-07-19 01:13:50 -04:00
@user = users(:one)
sign_in :user, @user
2013-04-02 02:43:01 -04:00
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:alerts)
end
test "should get new" do
get :new
assert_response :success
end
test "should create alert" do
assert_difference('Alert.count') do
2013-07-19 01:13:50 -04:00
post :create, alert: {
course: @alert.course,
department: @alert.department,
semester: @alert.semester,
sections: @alert.sections
}
2013-04-02 02:43:01 -04:00
end
assert_redirected_to alert_path(assigns(:alert))
end
test "should show alert" do
get :show, id: @alert
assert_response :success
end
test "should get edit" do
get :edit, id: @alert
assert_response :success
end
test "should update alert" do
2013-07-19 01:13:50 -04:00
put :update, id: @alert, alert: {
course: @alert.course,
department: @alert.department,
semester: @alert.semester,
sections: @alert.sections
}
2013-04-02 02:43:01 -04:00
assert_redirected_to alert_path(assigns(:alert))
end
test "should destroy alert" do
assert_difference('Alert.count', -1) do
delete :destroy, id: @alert
end
assert_redirected_to alerts_path
end
end