Created
September 26, 2016 18:57
-
-
Save mycargus/45d9d8440a10a90033cd84f9b36d1658 to your computer and use it in GitHub Desktop.
A ruby script that creates a course and 6 users, enrolls one user as a teacher in the course, and enrolls the remaining 5 users as students in the course
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec/factories/course_factory' | |
require 'spec/factories/user_factory' | |
# Create, register, and enroll teacher | |
course_with_teacher( | |
active_course: 1, | |
active_enrollment: 1, | |
course_name: 'E2E Course', | |
name: 'Teacher 1' | |
) | |
@user.pseudonyms.create!( | |
unique_id: '[email protected]', | |
password: 'password', | |
password_confirmation: 'password' | |
) | |
@user.email = '[email protected]' | |
@user.accept_terms | |
@user.register! | |
# Create and enroll 5 students | |
5.times do |i| | |
index = i + 1 | |
course_with_student( | |
active_all: 1, | |
course: @course, | |
name: "Student #{index}" | |
) | |
email = "student#{index}@example.com" | |
@user.pseudonyms.create!( | |
unique_id: email, | |
password: 'password', | |
password_confirmation: 'password' | |
) | |
@user.email = email | |
@user.accept_terms | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment