Created
March 31, 2017 15:44
-
-
Save mycargus/8295111d07db290dcea1678b75337010 to your computer and use it in GitHub Desktop.
You can save this file and run it in a rails runner like so: 'bundle exec rails runner seed.rb'. Or you can simply copy/paste into a rails console.
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' | |
include Factories | |
# 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