spec: rename the `course` helper to `course_factory`
closes CNVS-34046 test plan: specs should pass Change-Id: I8684d30e5af7be04566b2d3903db2b7f4b14b24b Reviewed-on: https://gerrit.instructure.com/98439 Tested-by: Jenkins Reviewed-by: Landon Wilkins <lwilkins@instructure.com> Product-Review: Landon Wilkins <lwilkins@instructure.com> QA-Review: Landon Wilkins <lwilkins@instructure.com>
This commit is contained in:
parent
ece65b5a89
commit
57497719a7
|
@ -52,7 +52,7 @@ describe "Default Account Reports" do
|
|||
@course1.enrollment_term_id = @term1.id
|
||||
@course1.sis_source_id = "SIS_COURSE_ID_1"
|
||||
@course1.save!
|
||||
@course2 = course(:course_name => 'Math 101', :account => @account, :active_course => true)
|
||||
@course2 = course_factory(:course_name => 'Math 101', :account => @account, :active_course => true)
|
||||
|
||||
@enrollment1 = @course1.enroll_user(@user1, 'StudentEnrollment', :enrollment_state => :active)
|
||||
@enrollment2 = @course1.enroll_user(@user2, 'StudentEnrollment', :enrollment_state => :completed)
|
||||
|
@ -304,7 +304,7 @@ describe "Default Account Reports" do
|
|||
past = gpg.grading_periods.create! title: "Past", start_date: 1.week.ago, end_date: 1.day.ago
|
||||
future = gpg.grading_periods.create! title: "Future", start_date: 1.day.from_now, end_date: 1.week.from_now
|
||||
|
||||
@course3 = course(:course_name => 'Fun 404', :account => @account, :active_course => true)
|
||||
@course3 = course_factory(:course_name => 'Fun 404', :account => @account, :active_course => true)
|
||||
@course3.enroll_user(@user2, 'StudentEnrollment', :enrollment_state => :active)
|
||||
@course3.enroll_user(@user4, 'StudentEnrollment', :enrollment_state => :active)
|
||||
|
||||
|
|
|
@ -25,12 +25,12 @@ describe 'Student reports' do
|
|||
Notification.where(name: "Report Generated").first_or_create
|
||||
Notification.where(name: "Report Generation Failed").first_or_create
|
||||
@account = Account.create(name: 'New Account', default_time_zone: 'UTC')
|
||||
@course1 = course(:course_name => 'English 101', :account => @account,
|
||||
@course1 = course_factory(:course_name => 'English 101', :account => @account,
|
||||
:active_course => true)
|
||||
@course1.sis_source_id = 'SIS_COURSE_ID_1'
|
||||
@course1.save!
|
||||
@course1.offer
|
||||
@course2 = course(:course_name => 'Math 101', :account => @account,
|
||||
@course2 = course_factory(:course_name => 'Math 101', :account => @account,
|
||||
:active_course => true)
|
||||
@course2.offer
|
||||
@course3 = Course.create(:name => 'Science 101', :course_code => 'SCI101',
|
||||
|
@ -580,7 +580,7 @@ describe 'Student reports' do
|
|||
it 'should show data for users in other accounts with enrollments on this account' do
|
||||
@different_account = Account.create(name: 'New Account', default_time_zone: 'UTC')
|
||||
|
||||
@course3 = course(:course_name => 'English 101', :account => @account, :active_course => true)
|
||||
@course3 = course_factory(:course_name => 'English 101', :account => @account, :active_course => true)
|
||||
@course3.save!
|
||||
@course3.offer
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ describe "Converting Blackboard Vista qti" do
|
|||
end
|
||||
|
||||
def import_into_course
|
||||
@course = course
|
||||
@course = course_factory
|
||||
@migration = ContentMigration.create(:context => @course)
|
||||
@migration.migration_settings[:migration_ids_to_import] = {:copy=>{:everything => true}}
|
||||
Importers::CourseContentImporter.import_content(@course, @course_data, nil, @migration)
|
||||
|
|
|
@ -80,11 +80,11 @@ describe AppointmentGroupsController, type: :request do
|
|||
ag2 = AppointmentGroup.create!(:title => "me neither", :contexts => [Course.create!])
|
||||
ag2.publish!
|
||||
|
||||
student_in_course :course => course(:active_all => true), :user => @me
|
||||
student_in_course :course => course_factory(active_all: true), :user => @me
|
||||
ag3 = AppointmentGroup.create!(:title => "enrollment not active", :contexts => [@course])
|
||||
ag3.publish!
|
||||
|
||||
student_in_course :course => course(:active_all => true), :user => @me, :active_all => true
|
||||
student_in_course :course => course_factory(active_all: true), :user => @me, :active_all => true
|
||||
ag4 = AppointmentGroup.create!(:title => "unpublished", :contexts => [@course])
|
||||
ag5 = AppointmentGroup.create!(:title => "no times", :contexts => [@course])
|
||||
ag5.publish!
|
||||
|
@ -129,11 +129,11 @@ describe AppointmentGroupsController, type: :request do
|
|||
end
|
||||
|
||||
it "should restrict reservable appointment groups by context_codes" do
|
||||
student_in_course :course => course(:active_all => true), :user => @me, :active_all => true
|
||||
student_in_course :course => course_factory(active_all: true), :user => @me, :active_all => true
|
||||
ag1 = AppointmentGroup.create!(:title => "yay", :new_appointments => [["#{Time.now.year + 1}-01-01 12:00:00", "#{Time.now.year + 1}-01-01 13:00:00"]], :contexts => [@course])
|
||||
ag1.publish!
|
||||
|
||||
student_in_course :course => course(:active_all => true), :user => @me, :active_all => true
|
||||
student_in_course :course => course_factory(active_all: true), :user => @me, :active_all => true
|
||||
ag2 = AppointmentGroup.create!(:title => "yay", :new_appointments => [["#{Time.now.year + 1}-01-01 12:00:00", "#{Time.now.year + 1}-01-01 13:00:00"]], :contexts => [@course])
|
||||
ag2.publish!
|
||||
|
||||
|
@ -147,7 +147,7 @@ describe AppointmentGroupsController, type: :request do
|
|||
end
|
||||
|
||||
it "should return past reservable appointment groups, if requested" do
|
||||
student_in_course :course => course(:active_all => true), :user => @me, :active_all => true
|
||||
student_in_course :course => course_factory(active_all: true), :user => @me, :active_all => true
|
||||
ag = AppointmentGroup.create!(:title => "past", :new_appointments => [["#{Time.now.year - 1}-01-01 12:00:00", "#{Time.now.year - 1}-01-01 13:00:00"]], :contexts => [@course])
|
||||
ag.publish!
|
||||
json = api_call(:get, "/api/v1/appointment_groups?scope=reservable&include_past_appointments=1", {
|
||||
|
@ -231,7 +231,7 @@ describe AppointmentGroupsController, type: :request do
|
|||
end
|
||||
|
||||
it 'should get a reservable appointment group' do
|
||||
student_in_course :course => course(:active_all => true), :user => @me, :active_all => true
|
||||
student_in_course :course => course_factory(active_all: true), :user => @me, :active_all => true
|
||||
ag = AppointmentGroup.create!(:title => "yay", :new_appointments => [["#{Time.now.year + 1}-01-01 12:00:00", "#{Time.now.year + 1}-01-01 13:00:00"]], :contexts => [@course])
|
||||
ag.publish!
|
||||
|
||||
|
@ -263,7 +263,7 @@ describe AppointmentGroupsController, type: :request do
|
|||
end
|
||||
|
||||
it 'should require action until the min has been met' do
|
||||
student_in_course :course => course(:active_all => true), :user => @me, :active_all => true
|
||||
student_in_course :course => course_factory(active_all: true), :user => @me, :active_all => true
|
||||
ag = AppointmentGroup.create!(:title => "yay", :new_appointments => [["#{Time.now.year + 1}-01-01 12:00:00", "#{Time.now.year + 1}-01-01 13:00:00"]], :min_appointments_per_participant => 1, :contexts => [@course])
|
||||
ag.publish!
|
||||
appt = ag.appointments.first
|
||||
|
@ -306,7 +306,7 @@ describe AppointmentGroupsController, type: :request do
|
|||
end
|
||||
|
||||
it 'should enforce create permissions' do
|
||||
student_in_course :course => course(:active_all => true), :user => @me, :active_all => true
|
||||
student_in_course :course => course_factory(active_all: true), :user => @me, :active_all => true
|
||||
raw_api_call(:post, "/api/v1/appointment_groups",
|
||||
{:controller => 'appointment_groups', :action => 'create', :format => 'json'},
|
||||
{:appointment_group => {:context_codes => [@course.asset_string], :title => "ohai"} })
|
||||
|
@ -334,7 +334,7 @@ describe AppointmentGroupsController, type: :request do
|
|||
end
|
||||
|
||||
it 'should enforce update permissions' do
|
||||
student_in_course :course => course(:active_all => true), :user => @me, :active_all => true
|
||||
student_in_course :course => course_factory(active_all: true), :user => @me, :active_all => true
|
||||
ag = AppointmentGroup.create!(:title => "something", :new_appointments => [["2012-01-01 12:00:00", "2012-01-01 13:00:00"]], :contexts => [@course])
|
||||
raw_api_call(:put, "/api/v1/appointment_groups/#{ag.id}",
|
||||
{:controller => 'appointment_groups', :action => 'update', :format => 'json', :id => ag.id.to_s},
|
||||
|
@ -370,7 +370,7 @@ describe AppointmentGroupsController, type: :request do
|
|||
end
|
||||
|
||||
it 'should enforce delete permissions' do
|
||||
student_in_course :course => course(:active_all => true), :user => @me, :active_all => true
|
||||
student_in_course :course => course_factory(active_all: true), :user => @me, :active_all => true
|
||||
ag = AppointmentGroup.create!(:title => "something", :new_appointments => [["2012-01-01 12:00:00", "2012-01-01 13:00:00"]], :contexts => [@course])
|
||||
raw_api_call(:delete, "/api/v1/appointment_groups/#{ag.id}",
|
||||
{:controller => 'appointment_groups', :action => 'destroy', :format => 'json', :id => ag.id.to_s})
|
||||
|
|
|
@ -595,7 +595,7 @@ describe AssignmentsApiController, :include_lti_spec_helpers, type: :request do
|
|||
|
||||
context "as a student" do
|
||||
before :once do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
setup_DA
|
||||
end
|
||||
|
||||
|
@ -617,7 +617,7 @@ describe AssignmentsApiController, :include_lti_spec_helpers, type: :request do
|
|||
|
||||
context "as an observer" do
|
||||
before :once do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
setup_DA
|
||||
@observer = User.create
|
||||
@observer_enrollment = @course.enroll_user(@observer, 'ObserverEnrollment', :section => @course.course_sections.first, :enrollment_state => 'active', :allow_multiple_enrollments => true)
|
||||
|
|
|
@ -193,7 +193,7 @@ describe CalendarEventsApiController, type: :request do
|
|||
contexts = [@course.asset_string]
|
||||
|
||||
# second context the user cannot access
|
||||
course()
|
||||
course_factory()
|
||||
@course.calendar_events.create(:title => "unauthorized_course", :start_at => '2012-01-08 12:00:00')
|
||||
contexts.push(@course.asset_string)
|
||||
|
||||
|
@ -267,7 +267,7 @@ describe CalendarEventsApiController, type: :request do
|
|||
end
|
||||
|
||||
it "should not allow anonymous users to access a non-public context" do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
public_course_query(:opts => {:expected_status => 401})
|
||||
end
|
||||
|
||||
|
@ -386,7 +386,7 @@ describe CalendarEventsApiController, type: :request do
|
|||
|
||||
context "basic scenarios" do
|
||||
before :once do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
@teacher = @course.admins.first
|
||||
student_in_course :course => @course, :user => @me, :active_all => true
|
||||
end
|
||||
|
@ -578,7 +578,7 @@ describe CalendarEventsApiController, type: :request do
|
|||
Notification.create! :name => 'Appointment Canceled By User', :category => "TestImmediately"
|
||||
|
||||
if as_student
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
@teacher = @course.admins.first
|
||||
student_in_course :course => @course, :user => @me, :active_all => true
|
||||
|
||||
|
@ -745,7 +745,7 @@ describe CalendarEventsApiController, type: :request do
|
|||
end
|
||||
|
||||
it 'should enforce permissions' do
|
||||
event = course.calendar_events.create(:title => 'event')
|
||||
event = course_factory.calendar_events.create(:title => 'event')
|
||||
raw_api_call(:get, "/api/v1/calendar_events/#{event.id}", {
|
||||
:controller => 'calendar_events_api', :action => 'show', :id => event.id.to_s, :format => 'json'})
|
||||
expect(JSON.parse(response.body)['status']).to eq 'unauthorized'
|
||||
|
@ -1357,7 +1357,7 @@ describe CalendarEventsApiController, type: :request do
|
|||
end
|
||||
|
||||
it 'should enforce permissions' do
|
||||
assignment = course.assignments.create(:title => 'event')
|
||||
assignment = course_factory.assignments.create(:title => 'event')
|
||||
raw_api_call(:get, "/api/v1/calendar_events/assignment_#{assignment.id}", {
|
||||
:controller => 'calendar_events_api', :action => 'show', :id => "assignment_#{assignment.id}", :format => 'json'})
|
||||
expect(JSON.parse(response.body)['status']).to eq 'unauthorized'
|
||||
|
@ -1852,7 +1852,7 @@ describe CalendarEventsApiController, type: :request do
|
|||
context 'when in different courses' do
|
||||
before(:each) do
|
||||
@course1 = @course
|
||||
@course2 = course(:active_all => true)
|
||||
@course2 = course_factory(active_all: true)
|
||||
|
||||
@assignment1 = @default_assignment
|
||||
@assignment2 = @course2.assignments.create!(:title => 'Override2', :due_at => '2012-01-13 12:00:00Z')
|
||||
|
|
|
@ -105,7 +105,7 @@ describe "Conferences API", type: :request do
|
|||
end
|
||||
|
||||
let(:conference) do
|
||||
BigBlueButtonConference.create!(context: course,
|
||||
BigBlueButtonConference.create!(context: course_factory,
|
||||
user: user_factory,
|
||||
conference_key: "conf_key")
|
||||
end
|
||||
|
|
|
@ -275,7 +275,7 @@ describe ContentExportsApiController, type: :request do
|
|||
expect(export.job_progress).to be_completed
|
||||
expect(export.attachment).not_to be_nil
|
||||
|
||||
course
|
||||
course_factory
|
||||
cm = @course.content_migrations.new
|
||||
cm.attachment = export.attachment
|
||||
cm.migration_type = "canvas_cartridge_importer"
|
||||
|
@ -315,7 +315,7 @@ describe ContentExportsApiController, type: :request do
|
|||
expect(export.job_progress).to be_completed
|
||||
expect(export.attachment).not_to be_nil
|
||||
|
||||
course
|
||||
course_factory
|
||||
cm = @course.content_migrations.new
|
||||
cm.attachment = export.attachment
|
||||
cm.migration_type = "canvas_cartridge_importer"
|
||||
|
@ -366,7 +366,7 @@ describe ContentExportsApiController, type: :request do
|
|||
run_jobs
|
||||
|
||||
export.reload
|
||||
course
|
||||
course_factory
|
||||
cm = @course.content_migrations.new
|
||||
cm.attachment = export.attachment
|
||||
cm.migration_type = "canvas_cartridge_importer"
|
||||
|
@ -425,7 +425,7 @@ describe ContentExportsApiController, type: :request do
|
|||
run_jobs
|
||||
|
||||
export.reload
|
||||
course
|
||||
course_factory
|
||||
cm = @course.content_migrations.new
|
||||
cm.attachment = export.attachment
|
||||
cm.migration_type = "canvas_cartridge_importer"
|
||||
|
@ -455,7 +455,7 @@ describe ContentExportsApiController, type: :request do
|
|||
run_jobs
|
||||
|
||||
export.reload
|
||||
course
|
||||
course_factory
|
||||
cm = @course.content_migrations.new
|
||||
cm.attachment = export.attachment
|
||||
cm.migration_type = "canvas_cartridge_importer"
|
||||
|
|
|
@ -590,7 +590,7 @@ describe ContentMigrationsController, type: :request do
|
|||
@params = {:controller => 'content_migrations', :format => 'json', :course_id => @course.id.to_param, :action => 'content_list', :id => @migration.id.to_param}
|
||||
@orig_course = @course
|
||||
|
||||
course
|
||||
course_factory
|
||||
@dt1 = @course.discussion_topics.create!(:message => "hi", :title => "discussion title")
|
||||
@cm = @course.context_modules.create!(:name => "some module")
|
||||
@att = Attachment.create!(:filename => 'first.txt', :uploaded_data => StringIO.new('ohai'), :folder => Folder.unfiled_folder(@course), :context => @course)
|
||||
|
|
|
@ -19,7 +19,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../api_spec_helper')
|
|||
|
||||
describe "Module Items API", type: :request do
|
||||
before :once do
|
||||
course.offer!
|
||||
course_factory.offer!
|
||||
|
||||
@module1 = @course.context_modules.create!(:name => "module1")
|
||||
@assignment = @course.assignments.create!(:name => "pls submit", :submission_types => ["online_text_entry"], :points_possible => 20)
|
||||
|
|
|
@ -19,7 +19,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../api_spec_helper')
|
|||
|
||||
describe "Modules API", type: :request do
|
||||
before :once do
|
||||
course.offer!
|
||||
course_factory.offer!
|
||||
|
||||
@module1 = @course.context_modules.create!(:name => "module1")
|
||||
@assignment = @course.assignments.create!(:name => "pls submit", :submission_types => ["online_text_entry"], :points_possible => 42)
|
||||
|
|
|
@ -23,7 +23,7 @@ describe "CourseAudit API", type: :request do
|
|||
context "not configured" do
|
||||
before do
|
||||
Canvas::Cassandra::DatabaseBuilder.stubs(:configured?).with('auditors').returns(false)
|
||||
course
|
||||
course_factory
|
||||
end
|
||||
|
||||
it "should 404" do
|
||||
|
|
|
@ -1800,7 +1800,7 @@ describe CoursesController, type: :request do
|
|||
@role = Account.default.roles.build :name => 'SuperTeacher'
|
||||
@role.base_role_type = 'TeacherEnrollment'
|
||||
@role.save!
|
||||
@course3 = course
|
||||
@course3 = course_factory
|
||||
@course3.enroll_user(@me, 'TeacherEnrollment', { :role => @role, :active_all => true })
|
||||
end
|
||||
|
||||
|
@ -1831,10 +1831,10 @@ describe CoursesController, type: :request do
|
|||
@course2.restrict_enrollments_to_course_dates = true
|
||||
@course2.save! # pending_active
|
||||
|
||||
@course3 = course(:active_all => true)
|
||||
@course3 = course_factory(active_all: true)
|
||||
@course3.enroll_user(@me, 'StudentEnrollment') #invited
|
||||
|
||||
@course4 = course(:active_all => true)
|
||||
@course4 = course_factory(active_all: true)
|
||||
@course4.enroll_user(@me, 'StudentEnrollment')
|
||||
@course4.start_at = 2.days.ago
|
||||
@course4.conclude_at = 1.day.ago
|
||||
|
@ -1894,9 +1894,9 @@ describe CoursesController, type: :request do
|
|||
@role = Account.default.roles.build :name => 'SuperTeacher'
|
||||
@role.base_role_type = 'TeacherEnrollment'
|
||||
@role.save!
|
||||
@course3 = course
|
||||
@course3 = course_factory
|
||||
@course3.enroll_user(@me, 'TeacherEnrollment', { :role => @role, :active_all => true })
|
||||
@course4 = course
|
||||
@course4 = course_factory
|
||||
@course4.enroll_user(@me, 'TaEnrollment')
|
||||
@course4.workflow_state = 'created'
|
||||
@course4.save
|
||||
|
@ -2839,7 +2839,7 @@ describe CoursesController, type: :request do
|
|||
it "should not find courses in other root accounts" do
|
||||
acct = account_model(:name => 'root')
|
||||
acct.account_users.create!(user: @user)
|
||||
course(:account => acct)
|
||||
course_factory(:account => acct)
|
||||
@course.update_attribute('sis_source_id', 'OTHER-SIS')
|
||||
raw_api_call(:get, "/api/v1/courses/sis_course_id:OTHER-SIS",
|
||||
:controller => "courses", :action => "show", :id => "sis_course_id:OTHER-SIS", :format => "json")
|
||||
|
|
|
@ -25,7 +25,7 @@ describe EnrollmentsApiController, type: :request do
|
|||
context "an admin user" do
|
||||
before :once do
|
||||
account_admin_user(:active_all => true)
|
||||
course(:active_course => true)
|
||||
course_factory(active_course: true)
|
||||
@unenrolled_user = user_with_pseudonym
|
||||
@section = @course.course_sections.create!
|
||||
@path = "/api/v1/courses/#{@course.id}/enrollments"
|
||||
|
@ -504,7 +504,7 @@ describe EnrollmentsApiController, type: :request do
|
|||
|
||||
it "should derive roles from parent accounts" do
|
||||
sub_account = Account.create!(:name => 'sub', :parent_account => @course.account)
|
||||
course(:account => sub_account)
|
||||
course_factory(:account => sub_account)
|
||||
|
||||
expect(@course.account.roles.active.where(:name => 'newrole').first).to be_nil
|
||||
course_role = @course.account.get_course_role_by_name('newrole')
|
||||
|
@ -536,7 +536,7 @@ describe EnrollmentsApiController, type: :request do
|
|||
before :once do
|
||||
course_with_teacher(:active_all => true)
|
||||
@course_with_teacher = @course
|
||||
@course_wo_teacher = course
|
||||
@course_wo_teacher = course_factory
|
||||
@course = @course_with_teacher
|
||||
@unenrolled_user = user_with_pseudonym
|
||||
@section = @course.course_sections.create
|
||||
|
@ -635,7 +635,7 @@ describe EnrollmentsApiController, type: :request do
|
|||
context "self enrollment" do
|
||||
before :once do
|
||||
Account.default.allow_self_enrollment!
|
||||
course(active_all: true)
|
||||
course_factory(active_all: true)
|
||||
@course.update_attribute(:self_enrollment, true)
|
||||
@unenrolled_user = user_with_pseudonym
|
||||
@path = "/api/v1/courses/#{@course.id}/enrollments"
|
||||
|
@ -1122,7 +1122,7 @@ describe EnrollmentsApiController, type: :request do
|
|||
it "should not include ids from different contexts" do
|
||||
original_course = @course
|
||||
|
||||
course(:active_all => true, :user => @user)
|
||||
course_factory(active_all: true, :user => @user)
|
||||
group2 = @course.groups.create!(:name => "My Group")
|
||||
group2.add_user(@student, 'accepted', true)
|
||||
|
||||
|
@ -1190,9 +1190,9 @@ describe EnrollmentsApiController, type: :request do
|
|||
end
|
||||
|
||||
it "should return enrollments for unpublished courses" do
|
||||
course
|
||||
course_factory
|
||||
@course.claim
|
||||
enrollment = course.enroll_student(@student)
|
||||
enrollment = course_factory.enroll_student(@student)
|
||||
enrollment.update_attribute(:workflow_state, 'active')
|
||||
|
||||
# without a state[] filter
|
||||
|
@ -1208,7 +1208,7 @@ describe EnrollmentsApiController, type: :request do
|
|||
it "should not return enrollments from other accounts" do
|
||||
# enroll the user in a course in another account
|
||||
account = Account.create!(:name => 'Account Two')
|
||||
course = course(:account => account, :course_name => 'Account Two Course', :active_course => true)
|
||||
course = course_factory(:account => account, :course_name => 'Account Two Course', :active_course => true)
|
||||
course.enroll_user(@student).accept!
|
||||
|
||||
json = api_call(:get, @user_path, @user_params)
|
||||
|
@ -1251,7 +1251,7 @@ describe EnrollmentsApiController, type: :request do
|
|||
context "user context" do
|
||||
before :once do
|
||||
@original_course = @course
|
||||
course.offer!
|
||||
course_factory.offer!
|
||||
@role = @course.account.roles.build :name => 'CustomStudent'
|
||||
@role.base_role_type = 'StudentEnrollment'
|
||||
@role.save!
|
||||
|
@ -1479,9 +1479,9 @@ describe EnrollmentsApiController, type: :request do
|
|||
end
|
||||
|
||||
it "should not show enrollments for courses that aren't published" do
|
||||
course
|
||||
course_factory
|
||||
@course.claim
|
||||
enrollment = course.enroll_student(@user)
|
||||
enrollment = course_factory.enroll_student(@user)
|
||||
enrollment.update_attribute(:workflow_state, 'active')
|
||||
|
||||
# Request w/o a state[] filter.
|
||||
|
@ -1495,9 +1495,9 @@ describe EnrollmentsApiController, type: :request do
|
|||
end
|
||||
|
||||
it "should show enrollments for courses that aren't published if state[]=current_and_future" do
|
||||
course
|
||||
course_factory
|
||||
@course.claim
|
||||
enrollment = course.enroll_student(@user)
|
||||
enrollment = course_factory.enroll_student(@user)
|
||||
enrollment.update_attribute(:workflow_state, 'active')
|
||||
|
||||
json = api_call(:get, @user_path,
|
||||
|
@ -1506,9 +1506,9 @@ describe EnrollmentsApiController, type: :request do
|
|||
end
|
||||
|
||||
it "should accept multiple state[] filters" do
|
||||
course
|
||||
course_factory
|
||||
@course.offer!
|
||||
enrollment = course.enroll_student(@user)
|
||||
enrollment = course_factory.enroll_student(@user)
|
||||
enrollment.update_attribute(:workflow_state, 'completed')
|
||||
|
||||
json = api_call(:get, @user_path,
|
||||
|
@ -1624,7 +1624,7 @@ describe EnrollmentsApiController, type: :request do
|
|||
before :once do
|
||||
@student = user_factory(active_all: true, active_state: 'active')
|
||||
3.times do
|
||||
course
|
||||
course_factory
|
||||
@course.enroll_student(@student, enrollment_state: 'active')
|
||||
end
|
||||
@observer = user_factory(active_all: true, active_state: 'active')
|
||||
|
|
|
@ -638,7 +638,7 @@ describe "Files API", type: :request do
|
|||
end
|
||||
|
||||
it "should 404 with wrong context" do
|
||||
course
|
||||
course_factory
|
||||
user_session(@user)
|
||||
opts = @file_path_options.merge(:course_id => @course.id.to_param)
|
||||
api_call(:get, "/api/v1/courses/#{@course.id}/files/#{@att.id}", opts, {}, {}, :expected_status => 404)
|
||||
|
|
|
@ -467,7 +467,7 @@ describe "Folders API", type: :request do
|
|||
|
||||
context "course" do
|
||||
before :once do
|
||||
course active_all: true
|
||||
course_factory active_all: true
|
||||
@root_folder = Folder.root_folders(@course).first
|
||||
@request_path = "/api/v1/courses/#{@course.id}/folders/by_path"
|
||||
@params_hash.merge!(course_id: @course.to_param)
|
||||
|
@ -553,12 +553,12 @@ describe "Folders API", type: :request do
|
|||
|
||||
describe "copy_folder" do
|
||||
before :once do
|
||||
@source_context = course active_all: true
|
||||
@source_context = course_factory active_all: true
|
||||
@source_folder = @source_context.folders.create! name: 'teh folder'
|
||||
@file = attachment_model context: @source_context, folder: @source_folder, display_name: 'foo'
|
||||
@params_hash = { controller: 'folders', action: 'copy_folder', format: 'json' }
|
||||
|
||||
@dest_context = course active_all: true
|
||||
@dest_context = course_factory active_all: true
|
||||
@dest_folder = @dest_context.folders.create! name: 'put stuff here', parent_folder: Folder.root_folders(@dest_context).first
|
||||
|
||||
user_model
|
||||
|
@ -654,7 +654,7 @@ describe "Folders API", type: :request do
|
|||
describe "copy_file" do
|
||||
before :once do
|
||||
@params_hash = { controller: 'folders', action: 'copy_file', format: 'json' }
|
||||
@dest_context = course active_all: true
|
||||
@dest_context = course_factory active_all: true
|
||||
@dest_folder = @dest_context.folders.create! name: 'put stuff here', parent_folder: Folder.root_folders(@dest_context).first
|
||||
|
||||
user_model
|
||||
|
|
|
@ -73,7 +73,7 @@ describe GradingStandardsApiController, type: :request do
|
|||
end
|
||||
|
||||
it "should create course level grading standards" do
|
||||
course = course(name: 'grading standard course')
|
||||
course = course_factory(name: 'grading standard course')
|
||||
@resource_path = "/api/v1/courses/#{course.id}/grading_standards"
|
||||
@resource_params = { :controller => 'grading_standards_api', :action => 'create', :format => 'json', :course_id => course.id.to_s }
|
||||
post_params = {"title"=>"course grading standard", "grading_scheme_entry"=>[{"name"=>"A", "value"=>"90"}, {"name"=>"B", "value"=>"80"}, {"name"=>"C", "value"=>"70"}]}
|
||||
|
@ -114,7 +114,7 @@ describe GradingStandardsApiController, type: :request do
|
|||
@account = Account.default
|
||||
@resource_path = "/api/v1/accounts/#{@account.id}/grading_standards"
|
||||
@resource_params = { :controller => 'grading_standards_api', :action => 'create', :format => 'json', :account_id => @account.id.to_s }
|
||||
@course = course(name: 'grading standard course')
|
||||
@course = course_factory(name: 'grading standard course')
|
||||
user_factory
|
||||
enrollment = @course.enroll_teacher(@user)
|
||||
enrollment.accept!
|
||||
|
@ -126,7 +126,7 @@ describe GradingStandardsApiController, type: :request do
|
|||
end
|
||||
|
||||
it "should not be able to create course level grading standards" do
|
||||
course = course(name: 'grading standard course')
|
||||
course = course_factory(name: 'grading standard course')
|
||||
@resource_path = "/api/v1/courses/#{course.id}/grading_standards"
|
||||
@resource_params = { :controller => 'grading_standards_api', :action => 'create', :format => 'json', :course_id => course.id.to_s }
|
||||
post_params = {"title"=>"course grading standard", "grading_scheme_entry"=>[{"name"=>"A", "value"=>"90"}, {"name"=>"B", "value"=>"80"}, {"name"=>"C", "value"=>"70"}]}
|
||||
|
|
|
@ -45,7 +45,7 @@ describe "Group Categories API", type: :request do
|
|||
|
||||
describe "course group categories" do
|
||||
before :once do
|
||||
@course = course(:course_name => 'Math 101', :account => @account, :active_course => true)
|
||||
@course = course_factory(:course_name => 'Math 101', :account => @account, :active_course => true)
|
||||
@category = GroupCategory.student_organized_for(@course)
|
||||
end
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../../api_spec_helper')
|
||||
|
||||
describe LiveAssessments::AssessmentsController, type: :request do
|
||||
let_once(:assessment_course) { course(active_all: true) }
|
||||
let_once(:assessment_course) { course_factory(active_all: true) }
|
||||
let_once(:teacher) { assessment_course.teachers.first }
|
||||
let_once(:student) { course_with_student(course: assessment_course).user }
|
||||
let_once(:outcome) do
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../../api_spec_helper')
|
||||
|
||||
describe LiveAssessments::ResultsController, type: :request do
|
||||
let_once(:assessment_course) { course(active_all: true) }
|
||||
let_once(:assessment_course) { course_factory(active_all: true) }
|
||||
let_once(:teacher) { assessment_course.teachers.first }
|
||||
let_once(:student) { course_with_student(course: assessment_course).user }
|
||||
let_once(:another_student) { course_with_student(course: assessment_course).user }
|
||||
|
|
|
@ -22,7 +22,7 @@ describe 'Originality Reports API', type: :request do
|
|||
before :each do
|
||||
attachment_model
|
||||
|
||||
course(active_all: true)
|
||||
course_factory(active_all: true)
|
||||
student_in_course active_all: true
|
||||
teacher_in_course active_all: true
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../sharding_spec_helper')
|
|||
describe "Outcome Results API", type: :request do
|
||||
|
||||
let_once(:outcome_course) do
|
||||
course(active_all: true)
|
||||
course_factory(active_all: true)
|
||||
@course
|
||||
end
|
||||
|
||||
|
@ -218,7 +218,7 @@ describe "Outcome Results API", type: :request do
|
|||
end
|
||||
|
||||
it "requires section id to be a section in the context" do
|
||||
bogus_section = course(active_course: true).course_sections.create!(name: 'bogus section')
|
||||
bogus_section = course_factory(active_course: true).course_sections.create!(name: 'bogus section')
|
||||
raw_api_call(:get, outcome_rollups_url(outcome_course, section_id: bogus_section.id),
|
||||
controller: 'outcome_results', action: 'rollups', format: 'json',
|
||||
course_id: outcome_course.id.to_s, section_id: bogus_section.id.to_s)
|
||||
|
|
|
@ -50,7 +50,7 @@ describe "Pages API", type: :request do
|
|||
end
|
||||
|
||||
before :once do
|
||||
course
|
||||
course_factory
|
||||
@course.offer!
|
||||
@wiki = @course.wiki
|
||||
@wiki.set_front_page_url!('front-page')
|
||||
|
@ -1036,7 +1036,7 @@ describe "Pages API", type: :request do
|
|||
end
|
||||
|
||||
it "should deny access to wiki in an unenrolled course" do
|
||||
other_course = course
|
||||
other_course = course_factory
|
||||
other_course.offer!
|
||||
other_wiki = other_course.wiki
|
||||
other_wiki.set_front_page_url!('front-page')
|
||||
|
@ -1054,7 +1054,7 @@ describe "Pages API", type: :request do
|
|||
end
|
||||
|
||||
it "should allow access to a wiki in a public unenrolled course" do
|
||||
other_course = course
|
||||
other_course = course_factory
|
||||
other_course.is_public = true
|
||||
other_course.offer!
|
||||
other_wiki = other_course.wiki
|
||||
|
|
|
@ -19,7 +19,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../api_spec_helper')
|
|||
|
||||
describe Quizzes::CourseQuizExtensionsController, type: :request do
|
||||
before :once do
|
||||
course
|
||||
course_factory
|
||||
@quizzes = [1,2].map do |n|
|
||||
quiz = @course.quizzes.create!(:title => "quiz#{n}")
|
||||
quiz.publish!
|
||||
|
|
|
@ -37,7 +37,7 @@ describe Quizzes::OutstandingQuizSubmissionsController, type: :request do
|
|||
end
|
||||
|
||||
before :once do
|
||||
course
|
||||
course_factory
|
||||
@user = student_in_course.user
|
||||
@quiz = @course.quizzes.create!(:title => "Outstanding")
|
||||
@quiz.save
|
||||
|
@ -81,7 +81,7 @@ describe Quizzes::OutstandingQuizSubmissionsController, type: :request do
|
|||
end
|
||||
|
||||
before :once do
|
||||
course
|
||||
course_factory
|
||||
@quiz = @course.quizzes.create!(:title => "Outstanding")
|
||||
@quiz.save
|
||||
@submission = Quizzes::SubmissionManager.new(@quiz).find_or_create_submission(@user, false)
|
||||
|
|
|
@ -20,7 +20,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../api_spec_helper')
|
|||
describe Quizzes::QuizExtensionsController, type: :request do
|
||||
|
||||
before :once do
|
||||
course
|
||||
course_factory
|
||||
@quiz = @course.quizzes.create!(:title => 'quiz')
|
||||
@quiz.published_at = Time.now
|
||||
@quiz.workflow_state = 'available'
|
||||
|
|
|
@ -22,7 +22,7 @@ describe Quizzes::QuizQuestionsController, type: :request do
|
|||
|
||||
context 'as a teacher' do
|
||||
before :once do
|
||||
@course = course
|
||||
@course = course_factory
|
||||
teacher_in_course active_all: true
|
||||
@quiz = @course.quizzes.create!(:title => "A Sample Quiz")
|
||||
end
|
||||
|
|
|
@ -119,7 +119,7 @@ describe Quizzes::QuizSubmissionEventsApiController, type: :request do
|
|||
|
||||
before :once do
|
||||
Account.default.enable_feature!(:quiz_log_auditing)
|
||||
@quiz = course(active_all: true).quizzes.create!
|
||||
@quiz = course_factory(active_all: true).quizzes.create!
|
||||
end
|
||||
|
||||
context 'as the student who took the quiz' do
|
||||
|
|
|
@ -186,7 +186,7 @@ describe SectionsController, type: :request do
|
|||
end
|
||||
|
||||
it "should scope course sections to the course" do
|
||||
@other_course = course
|
||||
@other_course = course_factory
|
||||
@other_section = @other_course.default_section
|
||||
site_admin_user
|
||||
api_call(:get, "#{@path_prefix}/#{@other_section.id}", @path_params.merge({ :id => @other_section.to_param }), {}, {}, :expected_status => 404)
|
||||
|
@ -280,7 +280,7 @@ describe SectionsController, type: :request do
|
|||
|
||||
describe "#create" do
|
||||
before :once do
|
||||
course
|
||||
course_factory
|
||||
@path_prefix = "/api/v1/courses/#{@course.id}/sections"
|
||||
@path_params = { :controller => 'sections', :action => 'create', :course_id => @course.to_param, :format => 'json' }
|
||||
end
|
||||
|
@ -397,7 +397,7 @@ describe SectionsController, type: :request do
|
|||
|
||||
describe "#update" do
|
||||
before :once do
|
||||
course
|
||||
course_factory
|
||||
@section = @course.course_sections.create! :name => "Test Section"
|
||||
@section.update_attribute(:sis_source_id, "SISsy")
|
||||
@path_prefix = "/api/v1/sections"
|
||||
|
@ -488,7 +488,7 @@ describe SectionsController, type: :request do
|
|||
|
||||
describe "#delete" do
|
||||
before :once do
|
||||
course
|
||||
course_factory
|
||||
@section = @course.course_sections.create! :name => "Test Section"
|
||||
@section.update_attribute(:sis_source_id, "SISsy")
|
||||
@path_prefix = "/api/v1/sections"
|
||||
|
@ -542,8 +542,8 @@ describe SectionsController, type: :request do
|
|||
|
||||
describe "#crosslist" do
|
||||
before :once do
|
||||
@dest_course = course
|
||||
course
|
||||
@dest_course = course_factory
|
||||
course_factory
|
||||
@section = @course.course_sections.create!
|
||||
@params = { :controller => 'sections', :action => 'crosslist', :format => 'json' }
|
||||
end
|
||||
|
@ -640,8 +640,8 @@ describe SectionsController, type: :request do
|
|||
|
||||
describe "#uncrosslist" do
|
||||
before :once do
|
||||
@dest_course = course
|
||||
course
|
||||
@dest_course = course_factory
|
||||
course_factory
|
||||
@section = @course.course_sections.create!
|
||||
@section.crosslist_to_course(@dest_course)
|
||||
@params = { :controller => 'sections', :action => 'uncrosslist', :format => 'json' }
|
||||
|
|
|
@ -24,9 +24,9 @@ describe SisApiController, type: :request do
|
|||
end
|
||||
|
||||
# courses
|
||||
let_once(:course1) { course(account: @account) } # unpublished
|
||||
let_once(:course2) { course(account: @account, active_all: true) }
|
||||
let_once(:course3) { course(account: @account, active_all: true) }
|
||||
let_once(:course1) { course_factory(account: @account) } # unpublished
|
||||
let_once(:course2) { course_factory(account: @account, active_all: true) }
|
||||
let_once(:course3) { course_factory(account: @account, active_all: true) }
|
||||
|
||||
# non-postable assignments
|
||||
let_once(:assignment1) { course1.assignments.create!(post_to_sis: true) } # unpublished course
|
||||
|
@ -155,7 +155,7 @@ describe SisApiController, type: :request do
|
|||
|
||||
context 'for an unpublished course' do
|
||||
before :once do
|
||||
course
|
||||
course_factory
|
||||
account_admin_user(account: @course.root_account, active_all: true)
|
||||
end
|
||||
|
||||
|
@ -184,7 +184,7 @@ describe SisApiController, type: :request do
|
|||
|
||||
context 'for a published course' do
|
||||
before :once do
|
||||
course(active_all: true)
|
||||
course_factory(active_all: true)
|
||||
account_admin_user(account: @course.root_account, active_all: true)
|
||||
end
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ describe UsersController, type: :request do
|
|||
@student = user_factory(active_all: true)
|
||||
@shard1.activate do
|
||||
@account = Account.create!
|
||||
course(:active_all => true, :account => @account)
|
||||
course_factory(active_all: true, :account => @account)
|
||||
@course.enroll_student(@student).accept!
|
||||
@context = @course
|
||||
discussion_topic_model
|
||||
|
@ -107,7 +107,7 @@ describe UsersController, type: :request do
|
|||
|
||||
it "should find cross-shard submission comments" do
|
||||
@student = user_factory(active_all: true)
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
@course.enroll_student(@student).accept!
|
||||
@assignment = @course.assignments.create!(:title => 'assignment 1', :description => 'hai', :points_possible => '14.2', :submission_types => 'online_text_entry')
|
||||
@shard1.activate do
|
||||
|
|
|
@ -326,7 +326,7 @@ describe 'Submissions API', type: :request do
|
|||
it "does not find sections in other root accounts" do
|
||||
acct = account_model(:name => 'other root')
|
||||
@first_course = @course
|
||||
course(:active_all => true, :account => acct)
|
||||
course_factory(active_all: true, :account => acct)
|
||||
@course.default_section.update_attribute('sis_source_id', 'my-section-sis-id')
|
||||
json = api_call(:get,
|
||||
"/api/v1/sections/sis_section_id:my-section-sis-id/assignments/#{@a1.id}/submissions",
|
||||
|
@ -1385,7 +1385,7 @@ describe 'Submissions API', type: :request do
|
|||
context 'OriginalityReport' do
|
||||
it 'includes has_originality_report if the submission has an originality_report' do
|
||||
attachment_model
|
||||
course active_all: true
|
||||
course_factory active_all: true
|
||||
student_in_course active_all: true
|
||||
teacher_in_course active_all: true
|
||||
@assignment = @course.assignments.create!(title: "some assignment",
|
||||
|
@ -1411,7 +1411,7 @@ describe 'Submissions API', type: :request do
|
|||
|
||||
it 'does not include has_originality_report if the submission has no originality_report' do
|
||||
attachment_model
|
||||
course active_all: true
|
||||
course_factory active_all: true
|
||||
student_in_course active_all: true
|
||||
teacher_in_course active_all: true
|
||||
@assignment = @course.assignments.create!(title: "some assignment",
|
||||
|
@ -3611,7 +3611,7 @@ describe 'Submissions API', type: :request do
|
|||
end
|
||||
describe '#index' do
|
||||
context 'grouped_submissions' do
|
||||
let(:test_course) { course() }
|
||||
let(:test_course) { course_factory() }
|
||||
let(:teacher) { user_factory(active_all: true) }
|
||||
let(:student1) { user_factory(active_all: true) }
|
||||
let(:student2) { user_factory(active_all: true) }
|
||||
|
|
|
@ -21,7 +21,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../api_spec_helper')
|
|||
describe TabsController, type: :request do
|
||||
describe 'index' do
|
||||
it "should require read permissions on the context" do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
user_factory(active_all: true)
|
||||
api_call(:get, "/api/v1/courses/#{@course.id}/tabs",
|
||||
{ :controller => 'tabs', :action => 'index', :course_id => @course.to_param, :format => 'json'},
|
||||
|
|
|
@ -30,7 +30,7 @@ describe UsersController, type: :request do
|
|||
before :once do
|
||||
@teacher = course_with_teacher(:active_all => true, :user => user_with_pseudonym(:active_all => true))
|
||||
@teacher_course = @course
|
||||
@student_course = course(:active_all => true)
|
||||
@student_course = course_factory(active_all: true)
|
||||
@student_course.enroll_student(@user).accept!
|
||||
# an assignment i need to submit (needs_submitting)
|
||||
@a1 = Assignment.create!(:context => @student_course, :due_at => 6.days.from_now, :title => 'required work', :submission_types => 'online_text_entry', :points_possible => 10)
|
||||
|
|
|
@ -406,7 +406,7 @@ describe UserObserveesController, type: :request do
|
|||
context 'DELETE #destroy' do
|
||||
it 'should remove an observee by id' do
|
||||
parent.observed_users << student
|
||||
course.enroll_user(student)
|
||||
course_factory.enroll_user(student)
|
||||
observer_enrollment = parent.observer_enrollments.first
|
||||
|
||||
expect(delete_call).to eq student.id
|
||||
|
@ -416,7 +416,7 @@ describe UserObserveesController, type: :request do
|
|||
|
||||
it 'should remove an observee by id (for external accounts)' do
|
||||
external_parent.observed_users << external_student
|
||||
course(:account => external_account).enroll_user(external_student)
|
||||
course_factory(:account => external_account).enroll_user(external_student)
|
||||
observer_enrollment = external_parent.observer_enrollments.first
|
||||
|
||||
json = delete_call(user_id: external_parent.id, observee_id: external_student.id, api_user: multi_admin, domain_root_account: external_account)
|
||||
|
|
|
@ -128,9 +128,9 @@ describe Api::V1::User do
|
|||
student.pseudonyms.create!(:unique_id => 'xyz', :account => Account.default) { |p| p.sis_user_id = 'xyz' }
|
||||
|
||||
teacher = user_factory
|
||||
course1 = course(:active_all => true)
|
||||
course1 = course_factory(active_all: true)
|
||||
course1.enroll_user(teacher, "TeacherEnrollment").accept!
|
||||
course2 = course(:active_all => true)
|
||||
course2 = course_factory(active_all: true)
|
||||
course2.enroll_user(teacher, "StudentEnrollment").accept!
|
||||
|
||||
expect(@test_api.user_json(student, teacher, {}, [], course1)).to eq({
|
||||
|
@ -158,9 +158,9 @@ describe Api::V1::User do
|
|||
student.pseudonyms.create!(:unique_id => 'xyz', :account => Account.default) { |p| p.sis_user_id = 'xyz' }
|
||||
|
||||
teacher = user_factory
|
||||
course1 = course(:active_all => true)
|
||||
course1 = course_factory(active_all: true)
|
||||
course1.enroll_user(teacher, "TeacherEnrollment").accept!
|
||||
course2 = course(:active_all => true)
|
||||
course2 = course_factory(active_all: true)
|
||||
course2.enroll_user(teacher, "StudentEnrollment").accept!
|
||||
group1 = course1.groups.create!(:name => 'Group 1')
|
||||
group2 = course2.groups.create!(:name => 'Group 2')
|
||||
|
@ -1720,8 +1720,8 @@ describe "Users API", type: :request do
|
|||
|
||||
describe "PUT dashboard positions" do
|
||||
it "should allow setting dashboard positions" do
|
||||
course1 = course(:active_all => true)
|
||||
course2 = course(:active_all => true)
|
||||
course1 = course_factory(active_all: true)
|
||||
course2 = course_factory(active_all: true)
|
||||
json = api_call(
|
||||
:put,
|
||||
"/api/v1/users/#{@user.id}/dashboard_positions",
|
||||
|
@ -1745,7 +1745,7 @@ describe "Users API", type: :request do
|
|||
end
|
||||
|
||||
it "should not allow creating entries for entities that do not exist" do
|
||||
course1 = course(:active_all => true)
|
||||
course1 = course_factory(active_all: true)
|
||||
course1.enroll_user(@user, "TeacherEnrollment").accept!
|
||||
api_call(
|
||||
:put,
|
||||
|
@ -1767,7 +1767,7 @@ describe "Users API", type: :request do
|
|||
it "should not allow creating entries for entities that the user doesn't have read access to" do
|
||||
course_with_student(:active_all => true)
|
||||
course1 = @course
|
||||
course2 = course
|
||||
course2 = course_factory
|
||||
|
||||
api_call(
|
||||
:put,
|
||||
|
@ -1787,8 +1787,8 @@ describe "Users API", type: :request do
|
|||
end
|
||||
|
||||
it "should not allow setting positions to strings" do
|
||||
course1 = course(:active_all => true)
|
||||
course2 = course(:active_all => true)
|
||||
course1 = course_factory(active_all: true)
|
||||
course2 = course_factory(active_all: true)
|
||||
|
||||
api_call(
|
||||
:put,
|
||||
|
|
|
@ -209,7 +209,7 @@ describe AccountsController do
|
|||
it "should count total courses correctly" do
|
||||
account = Account.create!
|
||||
account_with_admin_logged_in(account: account)
|
||||
course(account: account)
|
||||
course_factory(account: account)
|
||||
@course.course_sections.create!
|
||||
@course.course_sections.create!
|
||||
@course.update_account_associations
|
||||
|
@ -613,8 +613,8 @@ describe AccountsController do
|
|||
describe "#account_courses" do
|
||||
before do
|
||||
@account = Account.create!
|
||||
@c1 = course(account: @account, name: "foo")
|
||||
@c2 = course(account: @account, name: "bar")
|
||||
@c1 = course_factory(account: @account, name: "foo")
|
||||
@c2 = course_factory(account: @account, name: "bar")
|
||||
end
|
||||
|
||||
it "should not allow get a list of courses with no permissions" do
|
||||
|
|
|
@ -694,10 +694,10 @@ describe ApplicationController do
|
|||
describe "#get_all_pertinent_contexts" do
|
||||
it "doesn't show unpublished courses to students" do
|
||||
student = user_factory(active_all: true)
|
||||
c1 = course
|
||||
c1 = course_factory
|
||||
e = c1.enroll_student(student)
|
||||
e.update_attribute(:workflow_state, 'active')
|
||||
c2 = course(:active_all => true)
|
||||
c2 = course_factory(active_all: true)
|
||||
c2.enroll_student(student).accept!
|
||||
|
||||
controller.instance_variable_set(:@context, student)
|
||||
|
|
|
@ -20,8 +20,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|||
|
||||
describe AppointmentGroupsController do
|
||||
before :once do
|
||||
@course2 = course(active_all: true)
|
||||
course(active_all: true)
|
||||
@course2 = course_factory(active_all: true)
|
||||
course_factory(active_all: true)
|
||||
student_in_course(active_all: true)
|
||||
@next_year = Time.now.year + 1
|
||||
@ag = AppointmentGroup.create!(:title => "blah", :contexts => [@course, @course2],
|
||||
|
|
|
@ -135,7 +135,7 @@ describe CommunicationChannelsController do
|
|||
describe "open registration" do
|
||||
before :once do
|
||||
@account = Account.create!
|
||||
course(:active_all => 1, :account => @account)
|
||||
course_factory(active_all: true, :account => @account)
|
||||
user_factory
|
||||
end
|
||||
|
||||
|
@ -372,7 +372,7 @@ describe CommunicationChannelsController do
|
|||
end
|
||||
|
||||
it "should show the confirm form for old creation_pending users that have a pseudonym" do
|
||||
course(:active_all => 1)
|
||||
course_factory(active_all: true)
|
||||
@user.accept_terms
|
||||
@user.update_attribute(:workflow_state, 'creation_pending')
|
||||
@cc = @user.communication_channels.create!(:path => 'jt@instructure.com')
|
||||
|
@ -386,7 +386,7 @@ describe CommunicationChannelsController do
|
|||
end
|
||||
|
||||
it "should work for old creation_pending users that have a pseudonym" do
|
||||
course(:active_all => 1)
|
||||
course_factory(active_all: true)
|
||||
@user.accept_terms
|
||||
@user.update_attribute(:workflow_state, 'creation_pending')
|
||||
@cc = @user.communication_channels.create!(:path => 'jt@instructure.com')
|
||||
|
@ -413,7 +413,7 @@ describe CommunicationChannelsController do
|
|||
|
||||
it "should allow the user to pick a new pseudonym if a conflict already exists" do
|
||||
user_with_pseudonym(:active_all => 1, :username => 'jt@instructure.com')
|
||||
course(:active_all => 1)
|
||||
course_factory(active_all: true)
|
||||
user_factory
|
||||
@user.accept_terms
|
||||
@user.update_attribute(:workflow_state, 'creation_pending')
|
||||
|
@ -430,7 +430,7 @@ describe CommunicationChannelsController do
|
|||
|
||||
it "should force the user to provide a unique_id if a conflict already exists" do
|
||||
user_with_pseudonym(:active_all => 1, :username => 'jt@instructure.com')
|
||||
course(:active_all => 1)
|
||||
course_factory(active_all: true)
|
||||
user_factory
|
||||
@user.accept_terms
|
||||
@user.update_attribute(:workflow_state, 'creation_pending')
|
||||
|
@ -538,7 +538,7 @@ describe CommunicationChannelsController do
|
|||
@account1.authentication_providers.create!(:auth_type => 'cas')
|
||||
user_with_pseudonym(:active_all => 1, :account => @account1, :username => 'jt@instructure.com')
|
||||
|
||||
course(:active_all => 1, :account => @account2)
|
||||
course_factory(active_all: true, :account => @account2)
|
||||
user_factory
|
||||
@user.update_attribute(:workflow_state, 'creation_pending')
|
||||
@cc = @user.communication_channels.create!(:path => 'jt@instructure.com')
|
||||
|
@ -554,7 +554,7 @@ describe CommunicationChannelsController do
|
|||
user_with_pseudonym(:active_all => 1, :username => 'jt@instructure.com')
|
||||
@old_user = @user
|
||||
|
||||
course(:active_all => 1, :account => @account2)
|
||||
course_factory(active_all: true, :account => @account2)
|
||||
user_factory
|
||||
@user.update_attribute(:workflow_state, 'creation_pending')
|
||||
@cc = @user.communication_channels.create!(:path => 'jt@instructure.com')
|
||||
|
@ -1174,7 +1174,7 @@ describe CommunicationChannelsController do
|
|||
end
|
||||
|
||||
it "should re-send enrollment invitation for an invited user" do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
@enrollment = @course.enroll_user(@user)
|
||||
expect(@enrollment.context).to eql(@course)
|
||||
Notification.create(:name => 'Enrollment Invitation')
|
||||
|
@ -1188,7 +1188,7 @@ describe CommunicationChannelsController do
|
|||
context "cross-shard user" do
|
||||
specs_require_sharding
|
||||
it "should re-send enrollment invitation for a cross-shard user" do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
enrollment = nil
|
||||
@shard1.activate do
|
||||
user_with_pseudonym :active_cc => true
|
||||
|
|
|
@ -61,7 +61,7 @@ describe ContentExportsController do
|
|||
describe 'export visibility' do
|
||||
context 'course' do
|
||||
before(:once) do
|
||||
course active_all: true
|
||||
course_factory active_all: true
|
||||
course_with_ta(course: @course, active_all: true)
|
||||
student_in_course(course: @course, active_all: true)
|
||||
@acx = factory_with_protected_attributes(@course.content_exports, user: @ta, export_type: 'common_cartridge')
|
||||
|
@ -102,7 +102,7 @@ describe ContentExportsController do
|
|||
|
||||
context "user" do
|
||||
before(:once) do
|
||||
course active_all: true
|
||||
course_factory active_all: true
|
||||
student_in_course(course: @course, active_all: true)
|
||||
@tzx = factory_with_protected_attributes(@student.content_exports, user: @teacher, export_type: 'zip')
|
||||
@sdx = factory_with_protected_attributes(@student.content_exports, user: @student, export_type: 'user_data')
|
||||
|
|
|
@ -136,12 +136,12 @@ describe ContextController do
|
|||
|
||||
it 'allows merged users from other shards to be referenced' do
|
||||
user1 = user_model
|
||||
course1 = course(:active_all => 1)
|
||||
course1 = course_factory(active_all: true)
|
||||
course1.enroll_user(user1)
|
||||
|
||||
@shard2.activate do
|
||||
@user2 = user_model
|
||||
@course2 = course(:active_all => 1)
|
||||
@course2 = course_factory(active_all: true)
|
||||
@course2.enroll_user(@user2)
|
||||
end
|
||||
|
||||
|
|
|
@ -531,7 +531,7 @@ describe ContextModulesController do
|
|||
describe "GET progressions" do
|
||||
context "unauthenticated user in public course" do
|
||||
before(:once) do
|
||||
course(:is_public => true, :active_all => true)
|
||||
course_factory(:is_public => true, :active_all => true)
|
||||
@user = nil
|
||||
@mod1 = @course.context_modules.create!(:name => 'unlocked')
|
||||
@mod2 = @course.context_modules.create!(:name => 'locked', :unlock_at => 1.week.from_now)
|
||||
|
|
|
@ -87,7 +87,7 @@ describe ConversationsController do
|
|||
it "should return conversations matching the specified filter" do
|
||||
user_session(@student)
|
||||
@c1 = conversation
|
||||
@other_course = course(:active_all => true)
|
||||
@other_course = course_factory(active_all: true)
|
||||
enrollment = @other_course.enroll_student(@user)
|
||||
enrollment.workflow_state = 'active'
|
||||
enrollment.save!
|
||||
|
@ -104,7 +104,7 @@ describe ConversationsController do
|
|||
user_session(@student)
|
||||
@course1 = @course
|
||||
@c1 = conversation(:course => @course1)
|
||||
@course2 = course(:active_all => true)
|
||||
@course2 = course_factory(active_all: true)
|
||||
enrollment = @course2.enroll_student(@user)
|
||||
enrollment.workflow_state = 'active'
|
||||
enrollment.save!
|
||||
|
@ -131,7 +131,7 @@ describe ConversationsController do
|
|||
it "should return conversations matching a user filter" do
|
||||
user_session(@student)
|
||||
@c1 = conversation
|
||||
@other_course = course(:active_all => true)
|
||||
@other_course = course_factory(active_all: true)
|
||||
enrollment = @other_course.enroll_student(@user)
|
||||
enrollment.workflow_state = 'active'
|
||||
enrollment.save!
|
||||
|
@ -264,7 +264,7 @@ describe ConversationsController do
|
|||
# can cause us to grab stale conversation_context_codes
|
||||
# which screws everything up
|
||||
enable_cache do
|
||||
course1 = course(:active_all => true)
|
||||
course1 = course_factory(active_all: true)
|
||||
|
||||
student1 = user_factory(active_user: true)
|
||||
student2 = user_factory(active_user: true)
|
||||
|
@ -279,7 +279,7 @@ describe ConversationsController do
|
|||
expect(response).to be_success
|
||||
end
|
||||
|
||||
course2 = course(:active_all => true)
|
||||
course2 = course_factory(active_all: true)
|
||||
course2.enroll_user(student2, "StudentEnrollment").accept!
|
||||
course2.enroll_user(student1, "StudentEnrollment").accept!
|
||||
user_session(User.find(student1.id)) # clear process local enrollment cache
|
||||
|
@ -379,9 +379,9 @@ describe ConversationsController do
|
|||
it "should correctly infer context tags" do
|
||||
course_with_teacher_logged_in(:active_all => true)
|
||||
@course1 = @course
|
||||
@course2 = course(:active_all => true)
|
||||
@course2 = course_factory(active_all: true)
|
||||
@course2.enroll_teacher(@user).accept
|
||||
@course3 = course(:active_all => true)
|
||||
@course3 = course_factory(active_all: true)
|
||||
@course3.enroll_student(@user)
|
||||
@group1 = @course1.groups.create!
|
||||
@group2 = @course1.groups.create!
|
||||
|
|
|
@ -39,7 +39,7 @@ describe CoursesController do
|
|||
|
||||
it "should not duplicate enrollments in variables" do
|
||||
course_with_student_logged_in(:active_all => true)
|
||||
course
|
||||
course_factory
|
||||
@course.start_at = Time.now + 2.weeks
|
||||
@course.restrict_enrollments_to_course_dates = true
|
||||
@course.save!
|
||||
|
@ -55,7 +55,7 @@ describe CoursesController do
|
|||
describe 'current_enrollments' do
|
||||
it "should group enrollments by course and type" do
|
||||
# enrollments with multiple sections of the same type should be de-duped
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
user_factory(active_all: true)
|
||||
sec1 = @course.course_sections.create!(:name => "section1")
|
||||
sec2 = @course.course_sections.create!(:name => "section2")
|
||||
|
@ -477,7 +477,7 @@ describe CoursesController do
|
|||
user_session(@user, @pseudonym)
|
||||
user = User.create! { |u| u.workflow_state = 'creation_pending' }
|
||||
user.communication_channels.create!(:path => @cc.path)
|
||||
course(:active_all => 1)
|
||||
course_factory(active_all: true)
|
||||
@enrollment = @course.enroll_student(user)
|
||||
post 'enrollment_invitation', :course_id => @course.id, :reject => '1', :invitation => @enrollment.uuid
|
||||
expect(response).to be_redirect
|
||||
|
@ -505,7 +505,7 @@ describe CoursesController do
|
|||
|
||||
it "should ask user to login for registered not-logged-in user" do
|
||||
user_with_pseudonym(:active_course => true, :active_user => true)
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
@enrollment = @course.enroll_user(@user)
|
||||
post 'enrollment_invitation', :course_id => @course.id, :accept => '1', :invitation => @enrollment.uuid
|
||||
expect(response).to be_redirect
|
||||
|
@ -514,7 +514,7 @@ describe CoursesController do
|
|||
|
||||
it "should defer to registration_confirmation for pre-registered not-logged-in user" do
|
||||
user_with_pseudonym
|
||||
course(:active_course => true, :active_user => true)
|
||||
course_factory(active_course: true, :active_user => true)
|
||||
@enrollment = @course.enroll_user(@user)
|
||||
post 'enrollment_invitation', :course_id => @course.id, :accept => '1', :invitation => @enrollment.uuid
|
||||
expect(response).to be_redirect
|
||||
|
@ -620,7 +620,7 @@ describe CoursesController do
|
|||
course_with_teacher_logged_in(:active_user => true)
|
||||
@c1 = @course
|
||||
|
||||
course(:active_course => true)
|
||||
course_factory(active_course: true)
|
||||
@c2 = @course
|
||||
|
||||
@fake1 = @c1.student_view_student
|
||||
|
@ -898,7 +898,7 @@ describe CoursesController do
|
|||
@account.settings[:allow_invitation_previews] = false
|
||||
@account.save!
|
||||
|
||||
course(:account => @account)
|
||||
course_factory(:account => @account)
|
||||
user_factory(active_all: true)
|
||||
enrollment = @course.enroll_teacher(@user, :enrollment_state => 'invited')
|
||||
user_session(@user)
|
||||
|
@ -972,7 +972,7 @@ describe CoursesController do
|
|||
it "should not use the session enrollment if it's for the wrong course" do
|
||||
@enrollment1 = @enrollment
|
||||
@course1 = @course
|
||||
course(:active_course => 1)
|
||||
course_factory(:active_course => 1)
|
||||
student_in_course(:user => @user)
|
||||
@enrollment2 = @enrollment
|
||||
@course2 = @course
|
||||
|
@ -1036,7 +1036,7 @@ describe CoursesController do
|
|||
it "should redirect to the xlisted course" do
|
||||
user_session(@student)
|
||||
@course1 = @course
|
||||
@course2 = course(:active_all => true)
|
||||
@course2 = course_factory(active_all: true)
|
||||
@course1.default_section.crosslist_to_course(@course2, :run_jobs_immediately => true)
|
||||
|
||||
get 'show', :id => @course1.id
|
||||
|
@ -1047,7 +1047,7 @@ describe CoursesController do
|
|||
it "should not redirect to the xlisted course if the enrollment is deleted" do
|
||||
user_session(@student)
|
||||
@course1 = @course
|
||||
@course2 = course(:active_all => true)
|
||||
@course2 = course_factory(active_all: true)
|
||||
@course1.default_section.crosslist_to_course(@course2, :run_jobs_immediately => true)
|
||||
@user.enrollments.destroy_all
|
||||
|
||||
|
@ -1400,7 +1400,7 @@ describe CoursesController do
|
|||
subaccount = account_model(:parent_account => Account.default)
|
||||
sub_subaccount1 = account_model(:parent_account => subaccount)
|
||||
sub_subaccount2 = account_model(:parent_account => subaccount)
|
||||
course(:account => sub_subaccount1)
|
||||
course_factory(:account => sub_subaccount1)
|
||||
|
||||
@user = account_admin_user(:account => subaccount, :active_user => true)
|
||||
user_session(@user)
|
||||
|
@ -1414,7 +1414,7 @@ describe CoursesController do
|
|||
it "should not let sub-account admins move courses to other accounts outside their sub-account" do
|
||||
subaccount1 = account_model(:parent_account => Account.default)
|
||||
subaccount2 = account_model(:parent_account => Account.default)
|
||||
course(:account => subaccount1)
|
||||
course_factory(:account => subaccount1)
|
||||
|
||||
@user = account_admin_user(:account => subaccount1, :active_user => true)
|
||||
user_session(@user)
|
||||
|
@ -1428,7 +1428,7 @@ describe CoursesController do
|
|||
it "should let site admins move courses to any account" do
|
||||
account1 = Account.create!(:name => "account1")
|
||||
account2 = Account.create!(:name => "account2")
|
||||
course(:account => account1)
|
||||
course_factory(:account => account1)
|
||||
|
||||
user_session(site_admin_user)
|
||||
|
||||
|
@ -1590,7 +1590,7 @@ describe CoursesController do
|
|||
describe "GET 'self_enrollment'" do
|
||||
before :once do
|
||||
Account.default.update_attribute(:settings, :self_enrollment => 'any', :open_registration => true)
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
end
|
||||
|
||||
it "should redirect to the new self enrollment form" do
|
||||
|
|
|
@ -79,7 +79,7 @@ describe ErrorsController do
|
|||
|
||||
it "records the real user if they are in student view" do
|
||||
authenticate_user!
|
||||
svs = course.student_view_student
|
||||
svs = course_factory.student_view_student
|
||||
session[:become_user_id] = svs.id
|
||||
post 'create', error: {message: 'test message'}
|
||||
expect(ErrorReport.order(:id).last.user_id).to eq @user.id
|
||||
|
|
|
@ -9,7 +9,7 @@ describe ExternalContentController do
|
|||
end
|
||||
|
||||
it "gets a context for external_tool_dialog" do
|
||||
c = course
|
||||
c = course_factory
|
||||
get :success, service: 'external_tool_dialog', course_id: c.id
|
||||
expect(assigns[:context]).to_not be_nil
|
||||
end
|
||||
|
@ -18,7 +18,7 @@ describe ExternalContentController do
|
|||
describe "POST success/external_tool_dialog" do
|
||||
it "js env is set correctly" do
|
||||
|
||||
c = course
|
||||
c = course_factory
|
||||
post(:success, service: 'external_tool_dialog', course_id: c.id, lti_message_type: 'ContentItemSelection',
|
||||
lti_version: 'LTI-1p0',
|
||||
data: '',
|
||||
|
@ -51,7 +51,7 @@ describe ExternalContentController do
|
|||
end
|
||||
|
||||
context 'external_tool service_id' do
|
||||
let(:test_course) {course}
|
||||
let(:test_course) {course_factory}
|
||||
let(:launch_url) {'http://test.com/launch'}
|
||||
let(:tool) do
|
||||
test_course.context_external_tools.create!(
|
||||
|
@ -151,7 +151,7 @@ describe ExternalContentController do
|
|||
|
||||
describe "#content_items_for_canvas" do
|
||||
it 'sets default placement advice' do
|
||||
c = course
|
||||
c = course_factory
|
||||
post(:success, service: 'external_tool_dialog', course_id: c.id, lti_message_type: 'ContentItemSelection',
|
||||
lti_version: 'LTI-1p0',
|
||||
data: '',
|
||||
|
@ -168,7 +168,7 @@ describe ExternalContentController do
|
|||
end
|
||||
|
||||
it "uses the default url if one isn't provided" do
|
||||
c = course
|
||||
c = course_factory
|
||||
json = JSON.parse(File.read(File.join(Rails.root, 'spec', 'fixtures', 'lti', 'content_items_2.json')))
|
||||
json['@graph'][0].delete('url')
|
||||
launch_url = 'http://example.com/launch'
|
||||
|
@ -187,7 +187,7 @@ describe ExternalContentController do
|
|||
|
||||
context 'lti_links' do
|
||||
it "generates a canvas tool launch url" do
|
||||
c = course
|
||||
c = course_factory
|
||||
json = JSON.parse(File.read(File.join(Rails.root, 'spec', 'fixtures', 'lti', 'content_items.json')))
|
||||
post(:success, service: 'external_tool_dialog', course_id: c.id, lti_message_type: 'ContentItemSelection',
|
||||
lti_version: 'LTI-1p0' ,
|
||||
|
@ -199,7 +199,7 @@ describe ExternalContentController do
|
|||
end
|
||||
|
||||
it "generates a borderless launch url for iframe target" do
|
||||
c = course
|
||||
c = course_factory
|
||||
json = JSON.parse(File.read(File.join(Rails.root, 'spec', 'fixtures', 'lti', 'content_items.json')))
|
||||
json['@graph'][0]['placementAdvice']['presentationDocumentTarget'] = 'iframe'
|
||||
post(:success, service: 'external_tool_dialog', course_id: c.id, lti_message_type: 'ContentItemSelection',
|
||||
|
@ -211,7 +211,7 @@ describe ExternalContentController do
|
|||
end
|
||||
|
||||
it "generates a borderless launch url for window target" do
|
||||
c = course
|
||||
c = course_factory
|
||||
json = JSON.parse(File.read(File.join(Rails.root, 'spec', 'fixtures', 'lti', 'content_items.json')))
|
||||
json['@graph'][0]['placementAdvice']['presentationDocumentTarget'] = 'window'
|
||||
post(:success, service: 'external_tool_dialog', course_id: c.id, lti_message_type: 'ContentItemSelection',
|
||||
|
|
|
@ -72,7 +72,7 @@ describe ExternalToolsController do
|
|||
|
||||
it "does not return a JWT token for another context" do
|
||||
teacher_course = @course
|
||||
other_course = course()
|
||||
other_course = course_factory()
|
||||
|
||||
@tool.context_id = other_course.id
|
||||
@tool.save!
|
||||
|
|
|
@ -194,7 +194,7 @@ describe FilesController do
|
|||
|
||||
context "file menu tool visibility" do
|
||||
before do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
@tool = @course.context_external_tools.create!(:name => "a", :url => "http://google.com", :consumer_key => '12345', :shared_secret => 'secret')
|
||||
@tool.file_menu = {
|
||||
:visibility => "admins"
|
||||
|
@ -1030,7 +1030,7 @@ describe FilesController do
|
|||
@shard1.activate do
|
||||
@student = user_factory(active_user: true)
|
||||
end
|
||||
course(:active_all => true, :account => account)
|
||||
course_factory(active_all: true, :account => account)
|
||||
@course.enroll_user(@student, "StudentEnrollment").accept!
|
||||
@assignment = @course.assignments.create!(:title => 'upload_assignment', :submission_types => 'online_upload')
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ describe GradebooksController do
|
|||
|
||||
it "does not allow access for an observer linked in a different course" do
|
||||
@course1 = @course
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
@course2 = @course
|
||||
|
||||
user_session(@observer)
|
||||
|
@ -542,7 +542,7 @@ describe GradebooksController do
|
|||
|
||||
describe "POST 'submissions_zip_upload'" do
|
||||
it "requires authentication" do
|
||||
course
|
||||
course_factory
|
||||
assignment_model
|
||||
post 'submissions_zip_upload', :course_id => @course.id, :assignment_id => @assignment.id, :submissions_zip => 'dummy'
|
||||
assert_unauthorized
|
||||
|
|
|
@ -191,7 +191,7 @@ module Lti
|
|||
|
||||
it "doesn't allow a student to reregister an app" do
|
||||
course_with_student_logged_in(active_all:true)
|
||||
get 'reregistration', course_id: course.id, tool_proxy_id: tool_proxy.id
|
||||
get 'reregistration', course_id: course_factory.id, tool_proxy_id: tool_proxy.id
|
||||
expect(response.code).to eq '404'
|
||||
end
|
||||
|
||||
|
|
|
@ -43,8 +43,8 @@ describe MediaObjectsController do
|
|||
|
||||
it "should retrieve info about a 'deleted' MediaObject" do
|
||||
deleted_media_id = '0_deadbeef'
|
||||
course
|
||||
media_object = course.media_objects.build :media_id => deleted_media_id
|
||||
course_factory
|
||||
media_object = course_factory.media_objects.build :media_id => deleted_media_id
|
||||
media_object.workflow_state = 'deleted'
|
||||
media_object.save!
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ describe OutcomeResultsController do
|
|||
end
|
||||
|
||||
let_once(:outcome_course) do
|
||||
course(active_all: true)
|
||||
course_factory(active_all: true)
|
||||
@course
|
||||
end
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ describe SearchController do
|
|||
it "should allow filtering out non-messageable courses" do
|
||||
course_with_student_logged_in(:active_all => true)
|
||||
@course.update_attribute(:name, "course1")
|
||||
@course2 = course(:active_all => 1)
|
||||
@course2 = course_factory(active_all: true)
|
||||
@course2.enroll_student(@user).accept
|
||||
@course2.update_attribute(:name, "course2")
|
||||
term = @course2.root_account.enrollment_terms.create! :name => "Fall", :end_at => 1.day.ago
|
||||
|
@ -86,7 +86,7 @@ describe SearchController do
|
|||
context "with admin_context" do
|
||||
it "should return nothing if the user doesn't have rights" do
|
||||
user_session(user_factory)
|
||||
course(:active_all => true).course_sections.create(:name => "other section")
|
||||
course_factory(active_all: true).course_sections.create(:name => "other section")
|
||||
expect(response).to be_success
|
||||
|
||||
get 'recipients', {
|
||||
|
@ -99,7 +99,7 @@ describe SearchController do
|
|||
it "should return sub-contexts" do
|
||||
account_admin_user()
|
||||
user_session(@user)
|
||||
course(:active_all => true).course_sections.create(:name => "other section")
|
||||
course_factory(active_all: true).course_sections.create(:name => "other section")
|
||||
|
||||
get 'recipients', {
|
||||
:type => 'section', :skip_visibility_checks => true,
|
||||
|
@ -112,7 +112,7 @@ describe SearchController do
|
|||
it "should return sub-users" do
|
||||
account_admin_user
|
||||
user_session(@user)
|
||||
course(:active_all => true).course_sections.create(:name => "other section")
|
||||
course_factory(active_all: true).course_sections.create(:name => "other section")
|
||||
course_with_student(:active_all => true)
|
||||
|
||||
get 'recipients', {
|
||||
|
@ -163,8 +163,8 @@ describe SearchController do
|
|||
|
||||
describe "GET 'all_courses'" do
|
||||
before(:once) do
|
||||
@c1 = course(course_name: 'foo', active_course: true)
|
||||
@c2 = course(course_name: 'bar', active_course: true)
|
||||
@c1 = course_factory(course_name: 'foo', active_course: true)
|
||||
@c2 = course_factory(course_name: 'bar', active_course: true)
|
||||
@c2.update_attribute(:indexed, true)
|
||||
end
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ describe SelfEnrollmentsController do
|
|||
describe "GET 'new'" do
|
||||
before do
|
||||
Account.default.allow_self_enrollment!
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
@course.update_attribute(:self_enrollment, true)
|
||||
end
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ describe 'Submissions::ShowHelper' do
|
|||
|
||||
describe '#render_user_not_found' do
|
||||
before do
|
||||
course
|
||||
course_factory
|
||||
assignment_model
|
||||
routes.draw { get 'anonymous' => 'anonymous#show' }
|
||||
end
|
||||
|
|
|
@ -614,7 +614,7 @@ describe SubmissionsController do
|
|||
|
||||
describe 'GET originality_report' do
|
||||
let_once(:test_course) do
|
||||
test_course = course(active_course: true)
|
||||
test_course = course_factory(active_course: true)
|
||||
test_course.enroll_teacher(test_teacher, enrollment_state: 'active')
|
||||
test_course.enroll_student(test_student, enrollment_state: 'active')
|
||||
test_course
|
||||
|
|
|
@ -54,7 +54,7 @@ describe TermsController do
|
|||
user_session(@user)
|
||||
|
||||
@term = @account.enrollment_terms.create!
|
||||
course account: @account
|
||||
course_factory account: @account
|
||||
@course.enrollment_term = @term
|
||||
@course.save!
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|||
|
||||
describe UserListsController do
|
||||
it "should not fail for permission to add students" do
|
||||
course
|
||||
course_factory
|
||||
role = custom_account_role('myadmin', :account => @course.account)
|
||||
account_admin_user_with_role_changes(:role => role, :role_changes => { :manage_students => true })
|
||||
user_session(@user)
|
||||
|
|
|
@ -261,7 +261,7 @@ describe UsersController do
|
|||
end
|
||||
|
||||
it "should not allow students to self register" do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
@course.update_attribute(:self_enrollment, true)
|
||||
|
||||
post 'create', :pseudonym => { :unique_id => 'jane@example.com', :password => 'lolwut12', :password_confirmation => 'lolwut12' }, :user => { :name => 'Jane Student', :terms_of_use => '1', :self_enrollment_code => @course.self_enrollment_code, :initial_enrollment_type => 'student' }, :pseudonym_type => 'username', :self_enrollment => '1', :format => 'json'
|
||||
|
@ -431,7 +431,7 @@ describe UsersController do
|
|||
context "self enrollment" do
|
||||
before(:once) do
|
||||
Account.default.allow_self_enrollment!
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
@course.update_attribute(:self_enrollment, true)
|
||||
end
|
||||
|
||||
|
@ -606,7 +606,7 @@ describe UsersController do
|
|||
|
||||
describe "GET 'grades_for_student'" do
|
||||
let(:test_course) do
|
||||
test_course = course(active_all: true)
|
||||
test_course = course_factory(active_all: true)
|
||||
test_course.root_account.enable_feature!(:multiple_grading_periods)
|
||||
test_course
|
||||
end
|
||||
|
@ -725,7 +725,7 @@ describe UsersController do
|
|||
|
||||
describe "GET 'grades'" do
|
||||
context "grading periods" do
|
||||
let(:test_course) { course(active_all: true) }
|
||||
let(:test_course) { course_factory(active_all: true) }
|
||||
let(:student1) { user_factory(active_all: true) }
|
||||
let(:student2) { user_factory(active_all: true) }
|
||||
let(:grading_period_group) { group_helper.legacy_create_for_course(test_course) }
|
||||
|
@ -767,7 +767,7 @@ describe UsersController do
|
|||
end
|
||||
|
||||
context "with Multiple Grading Periods enabled" do
|
||||
before(:once) { course.root_account.enable_feature!(:multiple_grading_periods) }
|
||||
before(:once) { course_factory.root_account.enable_feature!(:multiple_grading_periods) }
|
||||
|
||||
it "returns the grading periods" do
|
||||
user_session(observer)
|
||||
|
@ -810,7 +810,7 @@ describe UsersController do
|
|||
end
|
||||
|
||||
context "as a student" do
|
||||
let(:another_test_course) { course(active_all: true) }
|
||||
let(:another_test_course) { course_factory(active_all: true) }
|
||||
let(:test_student) do
|
||||
student = user_factory(active_all: true)
|
||||
course_with_user('StudentEnrollment', course: test_course, user: student, active_all: true)
|
||||
|
@ -839,7 +839,7 @@ describe UsersController do
|
|||
end
|
||||
|
||||
context "with Multiple Grading Periods enabled" do
|
||||
before(:once) { course.root_account.enable_feature!(:multiple_grading_periods) }
|
||||
before(:once) { course_factory.root_account.enable_feature!(:multiple_grading_periods) }
|
||||
|
||||
it "returns the grading periods" do
|
||||
user_session(test_student)
|
||||
|
@ -886,7 +886,7 @@ describe UsersController do
|
|||
@shard1.activate do
|
||||
account = Account.create!
|
||||
account.enable_feature!(:multiple_grading_periods)
|
||||
@course2 = course(active_all: true, account: account)
|
||||
@course2 = course_factory(active_all: true, account: account)
|
||||
course_with_user('StudentEnrollment', course: @course2, user: student1, active_all: true)
|
||||
grading_period_group2 = group_helper.legacy_create_for_course(@course2)
|
||||
@grading_period2 = grading_period_group2.grading_periods.create!(
|
||||
|
@ -911,8 +911,8 @@ describe UsersController do
|
|||
it "does not include designers in the teacher enrollments" do
|
||||
# teacher needs to be in two courses to get to the point where teacher
|
||||
# enrollments are queried
|
||||
@course1 = course(:active_all => true)
|
||||
@course2 = course(:active_all => true)
|
||||
@course1 = course_factory(active_all: true)
|
||||
@course2 = course_factory(active_all: true)
|
||||
@teacher = user_factory(active_all: true)
|
||||
@designer = user_factory(active_all: true)
|
||||
@course1.enroll_teacher(@teacher).accept!
|
||||
|
@ -931,8 +931,8 @@ describe UsersController do
|
|||
end
|
||||
|
||||
it "does not redirect to an observer enrollment with no observee" do
|
||||
@course1 = course(:active_all => true)
|
||||
@course2 = course(:active_all => true)
|
||||
@course1 = course_factory(active_all: true)
|
||||
@course2 = course_factory(active_all: true)
|
||||
@user = user_factory(active_all: true)
|
||||
@course1.enroll_user(@user, 'ObserverEnrollment')
|
||||
@course2.enroll_student(@user).accept!
|
||||
|
@ -1310,7 +1310,7 @@ describe UsersController do
|
|||
|
||||
describe '#toggle_recent_activity_dashboard' do
|
||||
it 'updates user preference based on value provided' do
|
||||
course
|
||||
course_factory
|
||||
user_factory(active_all: true)
|
||||
user_session(@user)
|
||||
|
||||
|
@ -1343,7 +1343,7 @@ describe UsersController do
|
|||
end
|
||||
|
||||
it 'works with an admin with manage_login_rights' do
|
||||
course
|
||||
course_factory
|
||||
account_admin_user(:active_all => true)
|
||||
user_session(@user)
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#
|
||||
|
||||
module Factories
|
||||
def course(opts={})
|
||||
def course_factory(opts={})
|
||||
account = opts[:account] || Account.default
|
||||
account.shard.activate do
|
||||
@course = Course.create!(:name => opts[:course_name], :account => account, :is_public => !!opts[:is_public])
|
||||
|
@ -34,7 +34,6 @@ module Factories
|
|||
end
|
||||
@course
|
||||
end
|
||||
alias_method :course_factory, :course
|
||||
|
||||
def course_model(opts={})
|
||||
allow_reusable = opts.delete :reusable
|
||||
|
@ -58,7 +57,7 @@ module Factories
|
|||
end
|
||||
|
||||
def course_with_user(enrollment_type, opts={})
|
||||
@course = opts[:course] || course(opts)
|
||||
@course = opts[:course] || course_factory(opts)
|
||||
@user = opts[:user] || @course.shard.activate { user_factory(opts) }
|
||||
@enrollment = @course.enroll_user(@user, enrollment_type, opts)
|
||||
@user.save!
|
||||
|
|
|
@ -68,7 +68,7 @@ module Factories
|
|||
end
|
||||
|
||||
def group_discussion_assignment
|
||||
course = @course || course(:active_all => true)
|
||||
course = @course || course_factory(active_all: true)
|
||||
group_category = course.group_categories.create!(:name => "category")
|
||||
@group1 = course.groups.create!(:name => "group 1", :group_category => group_category)
|
||||
@group2 = course.groups.create!(:name => "group 2", :group_category => group_category)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
module Factories
|
||||
def grading_periods(options = {})
|
||||
Account.default.set_feature_flag! :multiple_grading_periods, 'on'
|
||||
course = options[:context] || @course || course()
|
||||
course = options[:context] || @course || course_factory()
|
||||
count = options[:count] || 2
|
||||
|
||||
grading_period_group = Factories::GradingPeriodGroupHelper.new.legacy_create_for_course(course)
|
||||
|
|
|
@ -239,7 +239,7 @@ module Factories
|
|||
end
|
||||
|
||||
def assignment_quiz(questions, opts={})
|
||||
course = opts[:course] || course(:active_course => true)
|
||||
course = opts[:course] || course_factory(active_course: true)
|
||||
user = opts[:user] || user_factory(:active_user => true)
|
||||
course.enroll_student(user, :enrollment_state => 'active') unless user.enrollments.any? { |e| e.course_id == course.id }
|
||||
@assignment = course.assignments.create(title: opts.fetch(:title, "Test Assignment"))
|
||||
|
|
|
@ -21,7 +21,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|||
describe ContextModulesHelper do
|
||||
include ContextModulesHelper
|
||||
|
||||
let_once(:t_course) { course(active_all: true) }
|
||||
let_once(:t_course) { course_factory(active_all: true) }
|
||||
let_once(:t_module) { t_course.context_modules.create! name: "test module" }
|
||||
|
||||
describe "module_item_unpublishable?" do
|
||||
|
|
|
@ -24,7 +24,7 @@ describe SearchHelper do
|
|||
|
||||
context "load_all_contexts" do
|
||||
it "should return requested permissions" do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
@current_user = @teacher
|
||||
|
||||
load_all_contexts
|
||||
|
|
|
@ -142,7 +142,7 @@ describe "site-wide" do
|
|||
end
|
||||
|
||||
it "should use the real user's timezone and locale setting when masquerading as a fake student" do
|
||||
@fake_user = course(:active_all => true).student_view_student
|
||||
@fake_user = course_factory(active_all: true).student_view_student
|
||||
|
||||
user_with_pseudonym(:active_all => true)
|
||||
account_admin_user(:user => @user)
|
||||
|
|
|
@ -241,7 +241,7 @@ describe ContextModule do
|
|||
describe "caching" do
|
||||
it "should cache the view separately for each time zone" do
|
||||
enable_cache do
|
||||
course active_all: true
|
||||
course_factory active_all: true
|
||||
|
||||
mod = @course.context_modules.create!
|
||||
mod.unlock_at = Time.utc(2014, 12, 25, 12, 0)
|
||||
|
|
|
@ -25,14 +25,14 @@ describe "course" do
|
|||
# normally this would be a controller test, but there is a some code in the
|
||||
# views that i need to not explode
|
||||
it "should not require authorization for public courses" do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
@course.update_attribute(:is_public, true)
|
||||
get "/courses/#{@course.id}"
|
||||
expect(response).to be_success
|
||||
end
|
||||
|
||||
it "should load syllabus on public course with no user logged in" do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
@course.update_attribute(:is_public, true)
|
||||
get "/courses/#{@course.id}/assignments/syllabus"
|
||||
expect(response).to be_success
|
||||
|
@ -40,7 +40,7 @@ describe "course" do
|
|||
|
||||
it "should show the migration-in-progress notice" do
|
||||
enable_cache do
|
||||
course(active_all: true)
|
||||
course_factory(active_all: true)
|
||||
user_session(@teacher)
|
||||
migration = @course.content_migrations.build
|
||||
migration.migration_settings[:import_in_progress_notice] = '1'
|
||||
|
@ -62,7 +62,7 @@ describe "course" do
|
|||
|
||||
it "should not show the migration-in-progress notice to students" do
|
||||
enable_cache do
|
||||
course(active_all: true)
|
||||
course_factory(active_all: true)
|
||||
student_in_course active_all: true
|
||||
user_session(@student)
|
||||
migration = @course.content_migrations.build
|
||||
|
|
|
@ -27,10 +27,10 @@ describe "enrollment_date_restrictions" do
|
|||
|
||||
it "should not list inactive enrollments in the course list" do
|
||||
@student = user_with_pseudonym
|
||||
@enrollment1 = course(:course_name => "Course 1", :active_all => 1)
|
||||
@enrollment1 = course_factory(:course_name => "Course 1", :active_all => 1)
|
||||
e1 = student_in_course(:user => @student, :active_all => 1)
|
||||
|
||||
@enrollment2 = course(:course_name => "Course 2", :active_all => 1)
|
||||
@enrollment2 = course_factory(:course_name => "Course 2", :active_all => 1)
|
||||
|
||||
@course.update_attributes(:start_at => 2.days.from_now, :conclude_at => 4.days.from_now, :restrict_enrollments_to_course_dates => true)
|
||||
e2 = student_in_course(:user => @student, :active_all => 1)
|
||||
|
@ -69,10 +69,10 @@ describe "enrollment_date_restrictions" do
|
|||
end
|
||||
|
||||
it "should not show date inactive/completed courses in grades" do
|
||||
@course1 = course(:active_all => 1)
|
||||
@course2 = course(:active_all => 1)
|
||||
@course3 = course(:active_all => 1)
|
||||
@course4 = course(:active_all => 1)
|
||||
@course1 = course_factory(active_all: true)
|
||||
@course2 = course_factory(active_all: true)
|
||||
@course3 = course_factory(active_all: true)
|
||||
@course4 = course_factory(active_all: true)
|
||||
user_factory(active_all: true)
|
||||
|
||||
@course1.start_at = 4.days.ago
|
||||
|
|
|
@ -23,7 +23,7 @@ require 'nokogiri'
|
|||
describe "External Tools" do
|
||||
describe "Assignments" do
|
||||
before do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
assignment_model(:course => @course, :submission_types => "external_tool", :points_possible => 25)
|
||||
@tool = @course.context_external_tools.create!(:shared_secret => 'test_secret', :consumer_key => 'test_key', :name => 'my grade passback test tool', :domain => 'example.com')
|
||||
@tag = @assignment.build_external_tool_tag(:url => "http://example.com/one")
|
||||
|
|
|
@ -358,7 +358,7 @@ describe FilesController do
|
|||
end
|
||||
|
||||
it "should allow file previews for public-to-auth courses" do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
@course.update_attribute(:is_public_to_auth_users, true)
|
||||
|
||||
att = attachment_model(:uploaded_data => stub_png_data, :context => @course)
|
||||
|
|
|
@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|||
|
||||
context "accessing public content" do
|
||||
before :each do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
@course.update_attribute(:is_public, true)
|
||||
@course.update_attribute(:is_public_to_auth_users, true)
|
||||
end
|
||||
|
|
|
@ -651,7 +651,7 @@ describe "security" do
|
|||
it "read_course_list" do
|
||||
add_permission :view_statistics
|
||||
|
||||
course
|
||||
course_factory
|
||||
get "/accounts/#{Account.default.id}"
|
||||
expect(response).to be_redirect
|
||||
|
||||
|
@ -758,7 +758,7 @@ describe "security" do
|
|||
|
||||
describe 'course' do
|
||||
before (:each) do
|
||||
course(:active_all => 1)
|
||||
course_factory(active_all: true)
|
||||
Account.default.update_attribute(:settings, { :no_enrollments_can_create_courses => false })
|
||||
end
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ describe "syllabus" do
|
|||
|
||||
shared_examples_for "public syllabus file verifiers" do
|
||||
it "should allow viewing available files in a public syllabus" do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
attachment_model
|
||||
@course.syllabus_body = "<a href=\"/courses/#{@course.id}/files/#{@attachment.id}/download\">linky</a>"
|
||||
@course.public_syllabus = true
|
||||
|
@ -60,7 +60,7 @@ describe "syllabus" do
|
|||
end
|
||||
|
||||
it "should not allow viewing locked files in a public syllabus" do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
attachment_model
|
||||
@attachment.locked = true
|
||||
@attachment.save!
|
||||
|
@ -81,7 +81,7 @@ describe "syllabus" do
|
|||
|
||||
shared_examples_for "public syllabus for authenticated file verifiers" do
|
||||
it "should allow viewing available files in a public to authenticated syllabus" do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
attachment_model
|
||||
@course.syllabus_body = "<a href=\"/courses/#{@course.id}/files/#{@attachment.id}/download\">linky</a>"
|
||||
@course.public_syllabus_to_auth = true
|
||||
|
@ -98,7 +98,7 @@ describe "syllabus" do
|
|||
end
|
||||
|
||||
it "should not allow viewing locked files in a public to authenticated syllabus" do
|
||||
course(:active_all => true)
|
||||
course_factory(active_all: true)
|
||||
attachment_model
|
||||
@attachment.locked = true
|
||||
@attachment.save!
|
||||
|
@ -141,9 +141,9 @@ describe "syllabus" do
|
|||
end
|
||||
|
||||
it "as an authenticated non-course user with public_syllabus_to_auth true" do
|
||||
course.public_syllabus_to_auth = true
|
||||
course.public_syllabus = false
|
||||
course.save
|
||||
course_factory.public_syllabus_to_auth = true
|
||||
course_factory.public_syllabus = false
|
||||
course_factory.save
|
||||
user_factory(active_user: true)
|
||||
user_session(@user)
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ describe UsersController do
|
|||
|
||||
it "should show individual user info across courses" do
|
||||
@course1 = @course
|
||||
@course2 = course(:active_course => true)
|
||||
@course2 = course_factory(active_course: true)
|
||||
@course2.update_attribute(:name, 'coursename2')
|
||||
student_in_course(:course => @course2, :user => @e1.user)
|
||||
get user_student_teacher_activity_url(@teacher, @e1.user)
|
||||
|
@ -159,12 +159,12 @@ describe UsersController do
|
|||
@admin = account_admin_user
|
||||
user_session(@admin)
|
||||
|
||||
course
|
||||
course_factory
|
||||
student_in_course(:course => @course)
|
||||
get "/users/#{@student.id}"
|
||||
expect(response).to be_success
|
||||
|
||||
course(:account => account_model)
|
||||
course_factory(:account => account_model)
|
||||
student_in_course(:course => @course)
|
||||
get "/users/#{@student.id}"
|
||||
assert_status(401)
|
||||
|
|
|
@ -35,7 +35,7 @@ describe "acts_as_list" do
|
|||
|
||||
describe "#insert_at" do
|
||||
before :each do
|
||||
course
|
||||
course_factory
|
||||
@module_1 = @course.context_modules.create!(:name => "another module")
|
||||
@module_2 = @course.context_modules.create!(:name => "another module")
|
||||
@module_3 = @course.context_modules.create!(:name => "another module")
|
||||
|
@ -66,7 +66,7 @@ describe "acts_as_list" do
|
|||
|
||||
describe "#fix_position_conflicts" do
|
||||
it "should order null positions last" do
|
||||
course
|
||||
course_factory
|
||||
module_1 = @course.context_modules.create :name => 'one'
|
||||
ContextModule.where(id: module_1).update_all(position: nil)
|
||||
module_2 = @course.context_modules.create :name => 'two'
|
||||
|
@ -77,7 +77,7 @@ describe "acts_as_list" do
|
|||
end
|
||||
|
||||
it "should break ties by object id" do
|
||||
course
|
||||
course_factory
|
||||
module_1 = @course.context_modules.create :name => 'one'
|
||||
module_1.position = 1
|
||||
module_1.save!
|
||||
|
@ -89,7 +89,7 @@ describe "acts_as_list" do
|
|||
end
|
||||
|
||||
it "should consolidate gaps" do
|
||||
course
|
||||
course_factory
|
||||
module_1 = @course.context_modules.create :name => 'one'
|
||||
module_1.position = 1
|
||||
module_1.save!
|
||||
|
|
|
@ -35,14 +35,14 @@ describe AddressBook::Empty do
|
|||
|
||||
describe "known_in_context" do
|
||||
it "returns an empty array" do
|
||||
course = course(active_all: true)
|
||||
course = course_factory(active_all: true)
|
||||
expect(@address_book.known_in_context(course.asset_string)).to eql([])
|
||||
end
|
||||
end
|
||||
|
||||
describe "count_in_context" do
|
||||
it "returns zero" do
|
||||
course = course(active_all: true)
|
||||
course = course_factory(active_all: true)
|
||||
expect(@address_book.count_in_context(course.asset_string)).to eql(0)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ describe AddressBook::MessageableUser do
|
|||
it "includes only known users" do
|
||||
teacher = teacher_in_course(active_all: true).user
|
||||
student1 = student_in_course(active_all: true).user
|
||||
student2 = student_in_course(course: course(), active_all: true).user
|
||||
student2 = student_in_course(course: course_factory(), active_all: true).user
|
||||
address_book = AddressBook::MessageableUser.new(teacher)
|
||||
known_users = address_book.known_users([student1, student2])
|
||||
expect(known_users.map(&:id)).to include(student1.id)
|
||||
|
@ -32,7 +32,7 @@ describe AddressBook::MessageableUser do
|
|||
|
||||
it "caches the failure for unknown users" do
|
||||
teacher = teacher_in_course(active_all: true).user
|
||||
student = student_in_course(course: course(), active_all: true).user
|
||||
student = student_in_course(course: course_factory(), active_all: true).user
|
||||
address_book = AddressBook::MessageableUser.new(teacher)
|
||||
expect(address_book.known_users([student])).to be_empty
|
||||
expect(address_book.cached?(student)).to be_truthy
|
||||
|
@ -89,7 +89,7 @@ describe AddressBook::MessageableUser do
|
|||
end
|
||||
|
||||
it "no effect if no role in the course exists" do
|
||||
course = course(active_all: true)
|
||||
course = course_factory(active_all: true)
|
||||
@address_book.known_users([@student], include_context: course)
|
||||
expect(@address_book.common_courses(@student)).not_to include(course.id)
|
||||
end
|
||||
|
@ -103,8 +103,8 @@ describe AddressBook::MessageableUser do
|
|||
|
||||
describe "with optional :conversation_id" do
|
||||
it "treats unknown users in that conversation as known" do
|
||||
course1 = course(active_all: true)
|
||||
course2 = course(active_all: true)
|
||||
course1 = course_factory(active_all: true)
|
||||
course2 = course_factory(active_all: true)
|
||||
teacher = teacher_in_course(course: course1, active_all: true).user
|
||||
student = student_in_course(course: course2, active_all: true).user
|
||||
conversation = Conversation.initiate([teacher, student], true)
|
||||
|
@ -114,8 +114,8 @@ describe AddressBook::MessageableUser do
|
|||
end
|
||||
|
||||
it "ignores if sender is not a participant in the conversation" do
|
||||
course1 = course(active_all: true)
|
||||
course2 = course(active_all: true)
|
||||
course1 = course_factory(active_all: true)
|
||||
course2 = course_factory(active_all: true)
|
||||
teacher = teacher_in_course(course: course1, active_all: true).user
|
||||
student1 = student_in_course(course: course2, active_all: true).user
|
||||
student2 = student_in_course(course: course2, active_all: true).user
|
||||
|
@ -187,8 +187,8 @@ describe AddressBook::MessageableUser do
|
|||
|
||||
describe "known_in_context" do
|
||||
it "limits to users in context" do
|
||||
course1 = course(active_all: true)
|
||||
course2 = course(active_all: true)
|
||||
course1 = course_factory(active_all: true)
|
||||
course2 = course_factory(active_all: true)
|
||||
teacher = teacher_in_course(course: course1, active_all: true).user
|
||||
teacher_in_course(user: teacher, course: course2, active_all: true)
|
||||
student1 = student_in_course(course: course1, active_all: true).user
|
||||
|
@ -233,7 +233,7 @@ describe AddressBook::MessageableUser do
|
|||
enrollment = teacher_in_course(active_all: true)
|
||||
teacher = enrollment.user
|
||||
course1 = enrollment.course
|
||||
student = student_in_course(course: course(), active_all: true).user
|
||||
student = student_in_course(course: course_factory(), active_all: true).user
|
||||
address_book = AddressBook::MessageableUser.new(teacher)
|
||||
address_book.known_in_context(course1.asset_string)
|
||||
expect(address_book.cached?(student)).to be_falsey
|
||||
|
@ -309,8 +309,8 @@ describe AddressBook::MessageableUser do
|
|||
end
|
||||
|
||||
it "restricts to matching known users in optional :context" do
|
||||
course1 = course(active_all: true)
|
||||
course2 = course(active_all: true)
|
||||
course1 = course_factory(active_all: true)
|
||||
course2 = course_factory(active_all: true)
|
||||
teacher = teacher_in_course(course: course1, active_all: true).user
|
||||
teacher_in_course(user: teacher, course: course2, active_all: true)
|
||||
student1 = student_in_course(course: course1, active_all: true, name: 'Bob').user
|
||||
|
|
|
@ -26,7 +26,7 @@ describe Api::V1::Course do
|
|||
|
||||
describe "#course_settings_json" do
|
||||
it "should return course settings hash" do
|
||||
course
|
||||
course_factory
|
||||
grading_standard = grading_standard_for(@course)
|
||||
@course.grading_standard = grading_standard
|
||||
@course.save
|
||||
|
@ -41,7 +41,7 @@ describe Api::V1::Course do
|
|||
|
||||
describe "#course_json" do
|
||||
it "should work for a logged-out user" do
|
||||
course
|
||||
course_factory
|
||||
hash = course_json(@course, nil, nil, [], nil)
|
||||
expect(hash['id']).to be_present
|
||||
end
|
||||
|
|
|
@ -8,8 +8,8 @@ describe Api::V1::SisAssignment do
|
|||
subject { SisAssignmentHarness.new }
|
||||
|
||||
context "#sis_assignments_json" do
|
||||
let(:course_1) { course }
|
||||
let(:assignment_1) { assignment_model(course: course) }
|
||||
let(:course_1) { course_factory }
|
||||
let(:assignment_1) { assignment_model(course: course_factory) }
|
||||
let(:assignment_with_context) { Assignment.new }
|
||||
|
||||
let(:assignment_override_1) do
|
||||
|
|
|
@ -170,7 +170,7 @@ describe Api do
|
|||
end
|
||||
|
||||
it "should find course by lti_context_id" do
|
||||
lti_course = course
|
||||
lti_course = course_factory
|
||||
lti_course.lti_context_id = Canvas::Security.hmac_sha1(lti_course.asset_string.to_s, 'key')
|
||||
lti_course.save!
|
||||
expect(@api.api_find(Course, "lti_context_id:#{lti_course.lti_context_id}")).to eq lti_course
|
||||
|
@ -703,7 +703,7 @@ describe Api do
|
|||
end
|
||||
|
||||
it "should add context to files and remove verifier parameters" do
|
||||
course
|
||||
course_factory
|
||||
attachment_model(:context => @course)
|
||||
|
||||
html = %{<div>
|
||||
|
|
|
@ -209,7 +209,7 @@ describe Canvas::LiveEvents do
|
|||
|
||||
describe ".asset_access" do
|
||||
it "should trigger a live event without an asset subtype" do
|
||||
course
|
||||
course_factory
|
||||
|
||||
expect_event('asset_accessed', {
|
||||
asset_type: 'course',
|
||||
|
@ -224,7 +224,7 @@ describe Canvas::LiveEvents do
|
|||
end
|
||||
|
||||
it "should trigger a live event with an asset subtype" do
|
||||
course
|
||||
course_factory
|
||||
|
||||
expect_event('asset_accessed', {
|
||||
asset_type: 'course',
|
||||
|
|
|
@ -67,7 +67,7 @@ describe "Migration package importers" do
|
|||
context "migrator" do
|
||||
it "should deal with backslashes path separators in migrations" do
|
||||
file = File.new(File.dirname(__FILE__) + "/../../fixtures/migration/whatthebackslash.zip")
|
||||
cm = ContentMigration.create!(:context => course)
|
||||
cm = ContentMigration.create!(:context => course_factory)
|
||||
|
||||
mig = Canvas::Migration::Migrator.new({:archive_file => file, :content_migration => cm}, "test")
|
||||
mig.unzip_archive
|
||||
|
|
|
@ -70,7 +70,7 @@ describe CC::CCHelper do
|
|||
end
|
||||
|
||||
it "should find media objects outside the context (because course copy)" do
|
||||
other_course = course
|
||||
other_course = course_factory
|
||||
@exporter = CC::CCHelper::HtmlContentExporter.new(other_course, @user)
|
||||
@exporter.html_content(<<-HTML)
|
||||
<p><a id='media_comment_abcde' class='instructure_inline_media_comment'>this is a media comment</a></p>
|
||||
|
|
|
@ -14,13 +14,13 @@ describe "Exporter" do
|
|||
end
|
||||
|
||||
@attachment = Attachment.create({
|
||||
context: course,
|
||||
context: course_factory,
|
||||
filename: 'exportable-test-file',
|
||||
uploaded_data: File.open(cartridge_path)
|
||||
})
|
||||
|
||||
@attachment_without_modules = Attachment.create({
|
||||
context: course,
|
||||
context: course_factory,
|
||||
filename: 'exportable-test-file',
|
||||
uploaded_data: File.open(cartridge_without_modules_path)
|
||||
})
|
||||
|
|
|
@ -10,7 +10,7 @@ describe "Exporter" do
|
|||
end
|
||||
|
||||
@attachment = Attachment.create({
|
||||
context: course,
|
||||
context: course_factory,
|
||||
filename: 'exportable-test-file',
|
||||
uploaded_data: File.open(cartridge_path)
|
||||
})
|
||||
|
|
|
@ -1409,7 +1409,7 @@ describe "cc assignment extensions" do
|
|||
converter.export
|
||||
@course_data = converter.course.with_indifferent_access
|
||||
|
||||
@course = course
|
||||
@course = course_factory
|
||||
@migration = ContentMigration.create(:context => @course)
|
||||
@migration.migration_type = "canvas_cartridge_importer"
|
||||
@migration.migration_settings[:migration_ids_to_import] = {:copy => {}}
|
||||
|
@ -1454,7 +1454,7 @@ describe "matching question reordering" do
|
|||
converter.export
|
||||
@course_data = converter.course.with_indifferent_access
|
||||
|
||||
@course = course
|
||||
@course = course_factory
|
||||
@migration = ContentMigration.create(:context => @course)
|
||||
@migration.migration_type = "common_cartridge_importer"
|
||||
@migration.migration_settings[:migration_ids_to_import] = {:copy => {}}
|
||||
|
@ -1495,7 +1495,7 @@ describe "matching question reordering" do
|
|||
converter.export
|
||||
@course_data = converter.course.with_indifferent_access
|
||||
|
||||
@course = course
|
||||
@course = course_factory
|
||||
@migration = ContentMigration.create(:context => @course)
|
||||
@migration.migration_type = "canvas_cartridge_importer"
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
|
|||
describe Canvas::Migration::Worker::CCWorker do
|
||||
it "should set the worker_class on the migration" do
|
||||
cm = ContentMigration.create!(:migration_settings => { :converter_class => CC::Importer::Canvas::Converter,
|
||||
:no_archive_file => true }, :context => course)
|
||||
:no_archive_file => true }, :context => course_factory)
|
||||
cm.reset_job_progress
|
||||
CC::Importer::Canvas::Converter.any_instance.expects(:export).returns({})
|
||||
worker = Canvas::Migration::Worker::CCWorker.new(cm.id)
|
||||
|
@ -31,7 +31,7 @@ describe Canvas::Migration::Worker::CCWorker do
|
|||
|
||||
it "should honor skip_job_progress" do
|
||||
cm = ContentMigration.create!(:migration_settings => { :converter_class => CC::Importer::Canvas::Converter,
|
||||
:no_archive_file => true, :skip_job_progress => true }, :context => course)
|
||||
:no_archive_file => true, :skip_job_progress => true }, :context => course_factory)
|
||||
CC::Importer::Canvas::Converter.any_instance.expects(:export).returns({})
|
||||
worker = Canvas::Migration::Worker::CCWorker.new(cm.id)
|
||||
expect(worker.perform()).to eq true
|
||||
|
|
|
@ -15,7 +15,7 @@ describe "Standard Common Cartridge importing" do
|
|||
@course_data['all_files_export'] ||= {}
|
||||
@course_data['all_files_export']['file_path'] = @course_data['all_files_zip']
|
||||
|
||||
@course = course
|
||||
@course = course_factory
|
||||
@migration = ContentMigration.create(:context => @course)
|
||||
@migration.migration_settings[:migration_ids_to_import] = {:copy => {}}
|
||||
Importers::CourseContentImporter.import_content(@course, @course_data, nil, @migration)
|
||||
|
@ -37,7 +37,7 @@ describe "Standard Common Cartridge importing" do
|
|||
def import_from_file(filename)
|
||||
archive_file_path = File.join(File.dirname(__FILE__) + "/../../../fixtures/migration/#{filename}")
|
||||
unzipped_file_path = create_temp_dir!
|
||||
@course = course
|
||||
@course = course_factory
|
||||
@migration = ContentMigration.create(:context => @course)
|
||||
converter = CC::Importer::Standard::Converter.new(:export_archive_path=>archive_file_path, :course_name=>'oi',
|
||||
:base_download_dir=>unzipped_file_path, :content_migration => @migration)
|
||||
|
@ -145,7 +145,7 @@ describe "Standard Common Cartridge importing" do
|
|||
@course_data['all_files_export'] ||= {}
|
||||
@course_data['all_files_export']['file_path'] = @course_data['all_files_zip']
|
||||
|
||||
@course = course
|
||||
@course = course_factory
|
||||
@migration = ContentMigration.create(:context => @course)
|
||||
@migration.migration_settings[:migration_ids_to_import] = {:copy => {}}
|
||||
Importers::CourseContentImporter.import_content(@course, @course_data, nil, @migration)
|
||||
|
|
|
@ -14,7 +14,7 @@ describe "Standard Common Cartridge importing" do
|
|||
@course_data['all_files_export'] ||= {}
|
||||
@course_data['all_files_export']['file_path'] = @course_data['all_files_zip']
|
||||
|
||||
@course = course
|
||||
@course = course_factory
|
||||
@migration = ContentMigration.create(:context => @course)
|
||||
@migration.migration_settings[:migration_ids_to_import] = {:copy => {}}
|
||||
enable_cache do
|
||||
|
@ -241,7 +241,7 @@ describe "Standard Common Cartridge importing" do
|
|||
|
||||
context "selective import" do
|
||||
it "should selectively import files" do
|
||||
@course = course
|
||||
@course = course_factory
|
||||
@migration = ContentMigration.create(:context => @course)
|
||||
@migration.migration_settings[:migration_ids_to_import] = {
|
||||
:copy => {"discussion_topics" => {"I_00006_R" => true},
|
||||
|
@ -288,7 +288,7 @@ describe "Standard Common Cartridge importing" do
|
|||
|
||||
|
||||
it "should not import all attachments if :files does not exist" do
|
||||
@course = course
|
||||
@course = course_factory
|
||||
@migration = ContentMigration.create(:context => @course)
|
||||
@migration.migration_settings[:migration_ids_to_import] = {
|
||||
:copy => {"everything" => "0"}}.with_indifferent_access
|
||||
|
@ -341,7 +341,7 @@ describe "Standard Common Cartridge importing" do
|
|||
end
|
||||
|
||||
it "should fix position conflicts for modules" do
|
||||
@course = course
|
||||
@course = course_factory
|
||||
|
||||
mod1 = @course.context_modules.create :name => "ponies"
|
||||
mod1.position = 1
|
||||
|
@ -368,7 +368,7 @@ describe "Standard Common Cartridge importing" do
|
|||
end
|
||||
|
||||
it "should fix position conflicts for assignment groups" do
|
||||
@course = course
|
||||
@course = course_factory
|
||||
|
||||
ag1 = @course.assignment_groups.create :name => "ponies"
|
||||
ag1.position = 1
|
||||
|
@ -409,7 +409,7 @@ describe "Standard Common Cartridge importing" do
|
|||
end
|
||||
|
||||
it "should import submodules individually if selected" do
|
||||
course
|
||||
course_factory
|
||||
@migration = ContentMigration.create(:context => @course)
|
||||
@migration.migration_settings[:migration_ids_to_import] = {
|
||||
:copy => {"context_modules" => {"sf2" => "1"}}
|
||||
|
@ -586,7 +586,7 @@ describe "LTI tool combination" do
|
|||
@course_data['all_files_export'] ||= {}
|
||||
@course_data['all_files_export']['file_path'] = @course_data['all_files_zip']
|
||||
|
||||
@course = course
|
||||
@course = course_factory
|
||||
@migration = ContentMigration.create(:context => @course)
|
||||
@migration.migration_type = "common_cartridge_importer"
|
||||
@migration.migration_settings[:migration_ids_to_import] = {:copy => {}}
|
||||
|
@ -621,7 +621,7 @@ describe "other cc files" do
|
|||
archive_file_path = File.join(File.dirname(__FILE__) + "/../../../fixtures/migration/#{filename}")
|
||||
unzipped_file_path = create_temp_dir!
|
||||
|
||||
@course = course
|
||||
@course = course_factory
|
||||
@migration = ContentMigration.create(:context => @course)
|
||||
@migration.migration_type = "common_cartridge_importer"
|
||||
@migration.migration_settings[:migration_ids_to_import] = {:copy => {}}
|
||||
|
|
|
@ -196,7 +196,7 @@ describe ContentZipper do
|
|||
|
||||
describe "assignment_zip_filename" do
|
||||
it "should use use course and title slugs to keep filename length down" do
|
||||
course(active_all: true)
|
||||
course_factory(active_all: true)
|
||||
@course.short_name = "a" * 31
|
||||
@course.save!
|
||||
assignment_model(course: @course, title: "b" * 31)
|
||||
|
|
|
@ -23,7 +23,7 @@ describe CourseLinkValidator do
|
|||
it "should validate all the links" do
|
||||
CourseLinkValidator.any_instance.stubs(:reachable_url?).returns(false).once # don't actually ping the links for the specs
|
||||
|
||||
course
|
||||
course_factory
|
||||
attachment_model
|
||||
|
||||
bad_url = "http://www.notarealsitebutitdoesntmattercauseimstubbingitanwyay.com"
|
||||
|
@ -84,7 +84,7 @@ describe CourseLinkValidator do
|
|||
CourseLinkValidator.any_instance.stubs(:reachable_url?).returns(false) # don't actually ping the links for the specs
|
||||
html = %{<a href='http://www.notarealsitebutitdoesntmattercauseimstubbingitanwyay.com'>linky</a>}
|
||||
|
||||
course
|
||||
course_factory
|
||||
bank = @course.assessment_question_banks.create!(:title => 'bank')
|
||||
aq = bank.assessment_questions.create!(:question_data => {'name' => 'test question',
|
||||
'question_text' => html, 'answers' => [{'id' => 1}, {'id' => 2}]})
|
||||
|
@ -107,7 +107,7 @@ describe CourseLinkValidator do
|
|||
it "should not care if it can reach it" do
|
||||
CourseLinkValidator.any_instance.stubs(:reachable_url?).returns(true)
|
||||
|
||||
course
|
||||
course_factory
|
||||
topic = @course.discussion_topics.create!(:message => %{<a href="http://www.www.www">pretend this is real</a>}, :title => "title")
|
||||
|
||||
CourseLinkValidator.queue_course(@course)
|
||||
|
@ -118,7 +118,7 @@ describe CourseLinkValidator do
|
|||
end
|
||||
|
||||
it "should check for deleted/unpublished objects" do
|
||||
course
|
||||
course_factory
|
||||
active = @course.assignments.create!(:title => "blah")
|
||||
unpublished = @course.assignments.create!(:title => "blah")
|
||||
unpublished.unpublish!
|
||||
|
@ -145,7 +145,7 @@ describe CourseLinkValidator do
|
|||
end
|
||||
|
||||
it "should work with absolute links to local objects" do
|
||||
course
|
||||
course_factory
|
||||
deleted = @course.assignments.create!(:title => "blah")
|
||||
deleted.destroy
|
||||
|
||||
|
@ -163,8 +163,8 @@ describe CourseLinkValidator do
|
|||
end
|
||||
|
||||
it "should find links to other courses" do
|
||||
other_course = course
|
||||
course
|
||||
other_course = course_factory
|
||||
course_factory
|
||||
|
||||
link = "http://#{HostUrl.default_host}/courses/#{other_course.id}/assignments"
|
||||
|
||||
|
@ -182,7 +182,7 @@ describe CourseLinkValidator do
|
|||
end
|
||||
|
||||
it "should find links to wiki pages" do
|
||||
course
|
||||
course_factory
|
||||
active = @course.wiki.wiki_pages.create!(:title => "active and stuff")
|
||||
unpublished = @course.wiki.wiki_pages.create!(:title => "unpub")
|
||||
unpublished.unpublish!
|
||||
|
@ -211,7 +211,7 @@ describe CourseLinkValidator do
|
|||
end
|
||||
|
||||
it "should identify typo'd canvas links" do
|
||||
course
|
||||
course_factory
|
||||
invalid_link1 = "/cupbopourses"
|
||||
invalid_link2 = "http://#{HostUrl.default_host}/courses/#{@course.id}/pon3s"
|
||||
|
||||
|
@ -232,7 +232,7 @@ describe CourseLinkValidator do
|
|||
end
|
||||
|
||||
it "should not flag valid replaced attachments" do
|
||||
course
|
||||
course_factory
|
||||
att1 = attachment_with_context(@course, :display_name => "name")
|
||||
att2 = attachment_with_context(@course)
|
||||
|
||||
|
@ -264,7 +264,7 @@ describe CourseLinkValidator do
|
|||
end
|
||||
|
||||
it "should not flag links to public paths" do
|
||||
course
|
||||
course_factory
|
||||
@course.syllabus_body = %{<a href='/images/avatar-50.png'>link</a>}
|
||||
@course.save!
|
||||
|
||||
|
@ -276,7 +276,7 @@ describe CourseLinkValidator do
|
|||
end
|
||||
|
||||
it "should flag sneaky links" do
|
||||
course
|
||||
course_factory
|
||||
@course.syllabus_body = %{<a href='/../app/models/user.rb'>link</a>}
|
||||
@course.save!
|
||||
|
||||
|
@ -288,7 +288,7 @@ describe CourseLinkValidator do
|
|||
end
|
||||
|
||||
it "should not flag wiki pages with url encoding" do
|
||||
course
|
||||
course_factory
|
||||
page = @course.wiki.wiki_pages.create!(:title => "semi;colon", :body => 'sutff')
|
||||
|
||||
@course.syllabus_body = %{<a href='/courses/#{@course.id}/pages/#{CGI.escape(page.title)}'>link</a>}
|
||||
|
|
|
@ -44,7 +44,7 @@ describe DelayedMessageScrubber do
|
|||
describe '#scrub' do
|
||||
|
||||
before(:each) do
|
||||
@context = course
|
||||
@context = course_factory
|
||||
@notification = Notification.create!(name: 'Test Notification', category: 'Test')
|
||||
@recipient = user_factory
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ shared_examples_for "a differentiable_object" do
|
|||
it "should not filter if user not in course" do
|
||||
original_user = @user
|
||||
# override @user and @course
|
||||
student_in_course(:course => course)
|
||||
student_in_course(:course => course_factory)
|
||||
@user = original_user
|
||||
expect(call_filter).to eq :not_filtered
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|||
describe ExternalFeedAggregator do
|
||||
context "#process_feed" do
|
||||
before(:once) do
|
||||
course(active_all: true)
|
||||
course_factory(active_all: true)
|
||||
@feed = external_feed_model
|
||||
end
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ describe Feature do
|
|||
let(:t_site_admin) { Account.site_admin }
|
||||
let(:t_root_account) { account_model }
|
||||
let(:t_sub_account) { account_model parent_account: t_root_account }
|
||||
let(:t_course) { course account: t_sub_account, active_all: true }
|
||||
let(:t_course) { course_factory account: t_sub_account, active_all: true }
|
||||
let(:t_user) { user_with_pseudonym account: t_root_account }
|
||||
|
||||
before do
|
||||
|
|
|
@ -23,7 +23,7 @@ describe ImportedHtmlConverter do
|
|||
|
||||
context ".convert" do
|
||||
before :once do
|
||||
course
|
||||
course_factory
|
||||
@path = "/courses/#{@course.id}/"
|
||||
@migration = @course.content_migrations.create!
|
||||
@converter = @migration.html_converter
|
||||
|
|
|
@ -94,7 +94,7 @@ describe LocaleSelection do
|
|||
@root_account = Account.create
|
||||
@account = Account.create(:parent_account => @root_account)
|
||||
user_factory
|
||||
course
|
||||
course_factory
|
||||
@course.account = @account
|
||||
@course.save
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
|
|||
|
||||
describe Lti::ContentItemResponse do
|
||||
|
||||
let_once(:context) { course(active_all: true) }
|
||||
let_once(:context) { course_factory(active_all: true) }
|
||||
let_once(:teacher) { course_with_teacher(course: context, active_all: true).user }
|
||||
let_once(:assign1) { context.assignments.create!(name: "A1") }
|
||||
let_once(:assign2) { context.assignments.create!(name: "A2") }
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue