Skip to content

Commit

Permalink
#1 fix tests for departments, registrations, scholarships, and study …
Browse files Browse the repository at this point in the history
…groups
  • Loading branch information
codeodor committed Feb 12, 2012
1 parent 4d0bb79 commit e8ee7f2
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 45 deletions.
16 changes: 8 additions & 8 deletions test/fixtures/registrations.yml
Expand Up @@ -5,23 +5,23 @@ one:
approved: false
teaching_assistant: false
registration_fee: 1.5
user_id: 1
section_id: 1
study_group_id: 1
user: student
section: MWF
study_group: one
class_coordinator: false
study_group_leader: false
signup_reason_id: 1
signup_reason: one
scholarship_code_id: 1

two:
payment_status: 1
approved: false
teaching_assistant: false
registration_fee: 1.5
user_id: 1
section_id: 1
study_group_id: 1
user: admin
section: MWF
study_group: one
class_coordinator: false
study_group_leader: false
signup_reason_id: 1
signup_reason: one
scholarship_code_id: 1
8 changes: 4 additions & 4 deletions test/fixtures/scholarship_codes.yml
@@ -1,13 +1,13 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html

one:
department_id: 1
code: MyString
department: math
code: ABC123
discount_type: 1
discount_amount: 1.5

two:
department_id: 1
code: MyString
department: science
code: CAB333
discount_type: 1
discount_amount: 1.5
4 changes: 2 additions & 2 deletions test/fixtures/study_groups.yml
Expand Up @@ -2,7 +2,7 @@

one:
name: MyString
section_id: 1
section: MWF
official: false
website: MyString
leader_id: 1
Expand All @@ -12,7 +12,7 @@ one:

two:
name: MyString
section_id: 1
section: MWF
official: false
website: MyString
leader_id: 1
Expand Down
2 changes: 1 addition & 1 deletion test/functional/departments_controller_test.rb
Expand Up @@ -3,7 +3,7 @@
class DepartmentsControllerTest < ActionController::TestCase
setup do
sign_in users(:admin)
@department = departments(:one)
@department = departments(:math)
end

test "should get index" do
Expand Down
20 changes: 10 additions & 10 deletions test/functional/registrations_controller_test.rb
Expand Up @@ -7,44 +7,44 @@ class RegistrationsControllerTest < ActionController::TestCase
end

test "should get index" do
get :index
get :index, department_id: @registration.section.course.department.id, course_id: @registration.section.course.id, section_id: @registration.section.id
assert_response :success
assert_not_nil assigns(:registrations)
end

test "should get new" do
get :new
get :new, department_id: @registration.section.course.department.id, course_id: @registration.section.course.id, section_id: @registration.section.id
assert_response :success
end

test "should create registration" do
assert_difference('Registration.count') do
post :create, registration: @registration.attributes
post :create, registration: @registration.attributes, department_id: @registration.section.course.department.id, course_id: @registration.section.course.id, section_id: @registration.section.id
end

assert_redirected_to registration_path(assigns(:registration))
assert_redirected_to department_course_section_registration_path(assigns(:registration).section.course.department, assigns(:registration).section.course, assigns(:registration).section, assigns(:registration))
end

test "should show registration" do
get :show, id: @registration
get :show, id: @registration, department_id: @registration.section.course.department.id, course_id: @registration.section.course.id, section_id: @registration.section.id
assert_response :success
end

test "should get edit" do
get :edit, id: @registration
get :edit, id: @registration, department_id: @registration.section.course.department.id, course_id: @registration.section.course.id, section_id: @registration.section.id
assert_response :success
end

test "should update registration" do
put :update, id: @registration, registration: @registration.attributes
assert_redirected_to registration_path(assigns(:registration))
put :update, id: @registration, registration: @registration.attributes, department_id: @registration.section.course.department.id, course_id: @registration.section.course.id, section_id: @registration.section.id
assert_redirected_to department_course_section_registration_path(assigns(:registration).section.course.department, assigns(:registration).section.course, assigns(:registration).section, assigns(:registration))
end

test "should destroy registration" do
assert_difference('Registration.count', -1) do
delete :destroy, id: @registration
delete :destroy, id: @registration, department_id: @registration.section.course.department.id, course_id: @registration.section.course.id, section_id: @registration.section.id
end

assert_redirected_to registrations_path
assert_redirected_to department_course_section_registrations_path(@registration.section.course.department, @registration.section.course, @registration.section)
end
end
20 changes: 10 additions & 10 deletions test/functional/scholarship_codes_controller_test.rb
Expand Up @@ -7,44 +7,44 @@ class ScholarshipCodesControllerTest < ActionController::TestCase
end

test "should get index" do
get :index
get :index, department_id: @scholarship_code.department
assert_response :success
assert_not_nil assigns(:scholarship_codes)
end

test "should get new" do
get :new
get :new, department_id: @scholarship_code.department
assert_response :success
end

test "should create scholarship_code" do
assert_difference('ScholarshipCode.count') do
post :create, scholarship_code: @scholarship_code.attributes
post :create, scholarship_code: @scholarship_code.attributes, department_id: @scholarship_code.department
end

assert_redirected_to scholarship_code_path(assigns(:scholarship_code))
assert_redirected_to department_scholarship_code_path(@scholarship_code.department, assigns(:scholarship_code))
end

test "should show scholarship_code" do
get :show, id: @scholarship_code
get :show, id: @scholarship_code, department_id: @scholarship_code.department
assert_response :success
end

test "should get edit" do
get :edit, id: @scholarship_code
get :edit, id: @scholarship_code, department_id: @scholarship_code.department
assert_response :success
end

test "should update scholarship_code" do
put :update, id: @scholarship_code, scholarship_code: @scholarship_code.attributes
assert_redirected_to scholarship_code_path(assigns(:scholarship_code))
put :update, id: @scholarship_code, scholarship_code: @scholarship_code.attributes, department_id: @scholarship_code.department
assert_redirected_to department_scholarship_code_path(@scholarship_code.department, assigns(:scholarship_code))
end

test "should destroy scholarship_code" do
assert_difference('ScholarshipCode.count', -1) do
delete :destroy, id: @scholarship_code
delete :destroy, id: @scholarship_code, department_id: @scholarship_code.department
end

assert_redirected_to scholarship_codes_path
assert_redirected_to department_scholarship_codes_path(@scholarship_code.department)
end
end
20 changes: 10 additions & 10 deletions test/functional/study_groups_controller_test.rb
Expand Up @@ -7,44 +7,44 @@ class StudyGroupsControllerTest < ActionController::TestCase
end

test "should get index" do
get :index
get :index, department_id: @study_group.section.course.department.id, course_id: @study_group.section.course_id, section_id: @study_group.section_id
assert_response :success
assert_not_nil assigns(:study_groups)
end

test "should get new" do
get :new
get :new, department_id: @study_group.section.course.department.id, course_id: @study_group.section.course_id, section_id: @study_group.section_id
assert_response :success
end

test "should create study_group" do
assert_difference('StudyGroup.count') do
post :create, study_group: @study_group.attributes
post :create, study_group: @study_group.attributes, department_id: @study_group.section.course.department.id, course_id: @study_group.section.course_id, section_id: @study_group.section_id
end

assert_redirected_to study_group_path(assigns(:study_group))
assert_redirected_to department_course_section_study_group_path(assigns(:study_group).section.course.department, assigns(:study_group).section.course, assigns(:study_group).section, assigns(:study_group))
end

test "should show study_group" do
get :show, id: @study_group
get :show, id: @study_group, department_id: @study_group.section.course.department.id, course_id: @study_group.section.course_id, section_id: @study_group.section_id
assert_response :success
end

test "should get edit" do
get :edit, id: @study_group
get :edit, id: @study_group, department_id: @study_group.section.course.department.id, course_id: @study_group.section.course_id, section_id: @study_group.section_id
assert_response :success
end

test "should update study_group" do
put :update, id: @study_group, study_group: @study_group.attributes
assert_redirected_to study_group_path(assigns(:study_group))
put :update, id: @study_group, study_group: @study_group.attributes, department_id: @study_group.section.course.department.id, course_id: @study_group.section.course_id, section_id: @study_group.section_id
assert_redirected_to department_course_section_study_group_path(assigns(:study_group).section.course.department, assigns(:study_group).section.course, assigns(:study_group).section, assigns(:study_group))
end

test "should destroy study_group" do
assert_difference('StudyGroup.count', -1) do
delete :destroy, id: @study_group
delete :destroy, id: @study_group, department_id: @study_group.section.course.department.id, course_id: @study_group.section.course_id, section_id: @study_group.section_id
end

assert_redirected_to study_groups_path
assert_redirected_to department_course_section_study_groups_path(@study_group.section.course.department, @study_group.section.course, @study_group.section)
end
end

0 comments on commit e8ee7f2

Please sign in to comment.