spec: change a bunch of before(:all)s to before(:once)
Change-Id: If5437f5e0125c544936f526e7ab4880c62b1e7b3 Reviewed-on: https://gerrit.instructure.com/65757 Reviewed-by: Simon Williams <simon@instructure.com> Tested-by: Jenkins Product-Review: James Williams <jamesw@instructure.com> QA-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
parent
5de2a36d32
commit
448fcb0f31
|
@ -141,7 +141,7 @@ describe Quizzes::QuizSubmissionQuestionsController, :type => :request do
|
||||||
|
|
||||||
|
|
||||||
describe 'GET /quiz_submissions/:quiz_submission_id/questions [index]' do
|
describe 'GET /quiz_submissions/:quiz_submission_id/questions [index]' do
|
||||||
before :all do
|
before :once do
|
||||||
course_with_student(:active_all => true)
|
course_with_student(:active_all => true)
|
||||||
@quiz = @course.quizzes.create!({
|
@quiz = @course.quizzes.create!({
|
||||||
title: 'test quiz',
|
title: 'test quiz',
|
||||||
|
@ -164,9 +164,10 @@ describe Quizzes::QuizSubmissionQuestionsController, :type => :request do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "with data" do
|
describe "with data" do
|
||||||
before :all do
|
before :once do
|
||||||
create_question_set
|
create_question_set
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should list all items' do
|
it 'should list all items' do
|
||||||
Quizzes::QuizSubmission.any_instance.stubs(:quiz_questions).returns([@qq1,@qq2])
|
Quizzes::QuizSubmission.any_instance.stubs(:quiz_questions).returns([@qq1,@qq2])
|
||||||
json = api_index
|
json = api_index
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require_relative '../../../spec_helper'
|
require_relative '../../../spec_helper'
|
||||||
|
|
||||||
describe Api::V1::QuizSubmissionQuestion do
|
describe Api::V1::QuizSubmissionQuestion do
|
||||||
before :all do
|
before :once do
|
||||||
course_with_student(active_all: true)
|
course_with_student(active_all: true)
|
||||||
@quiz = Quizzes::Quiz.create!(title: "quiz", context: @course)
|
@quiz = Quizzes::Quiz.create!(title: "quiz", context: @course)
|
||||||
@quiz_submission = @quiz.generate_submission(@student)
|
@quiz_submission = @quiz.generate_submission(@student)
|
||||||
|
|
|
@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
||||||
require 'db/migrate/20130617152008_fix_imported_wiki_page_workflow.rb'
|
require 'db/migrate/20130617152008_fix_imported_wiki_page_workflow.rb'
|
||||||
|
|
||||||
describe 'DataFixup::FixImportedWikiPageWorkflow' do
|
describe 'DataFixup::FixImportedWikiPageWorkflow' do
|
||||||
before :all do
|
before :once do
|
||||||
course
|
course
|
||||||
@wiki_pages = []
|
@wiki_pages = []
|
||||||
5.times do |n|
|
5.times do |n|
|
||||||
|
|
|
@ -3,7 +3,7 @@ require_relative '../../../app/models/assignment/filter_with_overrides_by_due_at
|
||||||
|
|
||||||
describe Assignment::FilterWithOverridesByDueAtForStudent do
|
describe Assignment::FilterWithOverridesByDueAtForStudent do
|
||||||
describe '#filter_assignments' do
|
describe '#filter_assignments' do
|
||||||
before :all do
|
before :once do
|
||||||
@course = Course.create!
|
@course = Course.create!
|
||||||
@assignment = @course.assignments.create!
|
@assignment = @course.assignments.create!
|
||||||
group = @course.grading_period_groups.create!
|
group = @course.grading_period_groups.create!
|
||||||
|
@ -23,7 +23,7 @@ describe Assignment::FilterWithOverridesByDueAtForStudent do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'the assignment has one override and the override applies to the student' do
|
context 'the assignment has one override and the override applies to the student' do
|
||||||
before :all do
|
before :once do
|
||||||
@assignment.only_visible_to_overrides = true
|
@assignment.only_visible_to_overrides = true
|
||||||
@override = @assignment.assignment_overrides.create!
|
@override = @assignment.assignment_overrides.create!
|
||||||
@override.assignment_override_students.create!(user: @student)
|
@override.assignment_override_students.create!(user: @student)
|
||||||
|
@ -59,7 +59,7 @@ describe Assignment::FilterWithOverridesByDueAtForStudent do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'given that override does not have a due at' do
|
context 'given that override does not have a due at' do
|
||||||
before :all do
|
before :once do
|
||||||
@override.due_at = nil
|
@override.due_at = nil
|
||||||
@override.save!
|
@override.save!
|
||||||
end
|
end
|
||||||
|
@ -87,7 +87,7 @@ describe Assignment::FilterWithOverridesByDueAtForStudent do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'the assignment has one override and the override does not apply to the student' do
|
context 'the assignment has one override and the override does not apply to the student' do
|
||||||
before :all do
|
before :once do
|
||||||
@assignment.assignment_overrides.create!
|
@assignment.assignment_overrides.create!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ describe Assignment::FilterWithOverridesByDueAtForStudent do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'the assignment has two overrides that apply to the student' do
|
context 'the assignment has two overrides that apply to the student' do
|
||||||
before :all do
|
before :once do
|
||||||
@student_override = @assignment.assignment_overrides.create!
|
@student_override = @assignment.assignment_overrides.create!
|
||||||
@student_override.assignment_override_students.create!(user: @student)
|
@student_override.assignment_override_students.create!(user: @student)
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ describe Assignment::FilterWithOverridesByDueAtForStudent do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'neither override has a due at' do
|
context 'neither override has a due at' do
|
||||||
before :all do
|
before :once do
|
||||||
@student_override.due_at = nil
|
@student_override.due_at = nil
|
||||||
@student_override.save!
|
@student_override.save!
|
||||||
@section_override.due_at = nil
|
@section_override.due_at = nil
|
||||||
|
|
|
@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/gradebook2_common')
|
||||||
|
|
||||||
describe 'Canvadoc' do
|
describe 'Canvadoc' do
|
||||||
include_context "in-process server selenium tests"
|
include_context "in-process server selenium tests"
|
||||||
before :all do
|
before :once do
|
||||||
PluginSetting.create! :name => 'canvadocs',
|
PluginSetting.create! :name => 'canvadocs',
|
||||||
:settings => {"api_key" => "blahblahblahblahblah",
|
:settings => {"api_key" => "blahblahblahblahblah",
|
||||||
"base_url" => "http://example.com",
|
"base_url" => "http://example.com",
|
||||||
|
|
|
@ -312,7 +312,7 @@ describe "content migrations", :non_parallel do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "course copy" do
|
context "course copy" do
|
||||||
before :all do
|
before :once do
|
||||||
#the "true" param is important, it forces the cache clear
|
#the "true" param is important, it forces the cache clear
|
||||||
# without it this spec group fails if
|
# without it this spec group fails if
|
||||||
# you run it with the whole suite
|
# you run it with the whole suite
|
||||||
|
|
|
@ -4,9 +4,8 @@ require File.expand_path(File.dirname(__FILE__) + '/helpers/discussions_common')
|
||||||
describe "discussion assignments" do
|
describe "discussion assignments" do
|
||||||
include_context "in-process server selenium tests"
|
include_context "in-process server selenium tests"
|
||||||
|
|
||||||
before :all do
|
before :once do
|
||||||
Account.default
|
course_with_teacher(:active_all => true)
|
||||||
course_with_teacher_logged_in
|
|
||||||
@course.assignment_groups.create!(:name => "Assignment Group")
|
@course.assignment_groups.create!(:name => "Assignment Group")
|
||||||
@category1 = @course.group_categories.create!(:name => "category 1")
|
@category1 = @course.group_categories.create!(:name => "category 1")
|
||||||
@category1.configure_self_signup(true, false)
|
@category1.configure_self_signup(true, false)
|
||||||
|
@ -15,9 +14,12 @@ describe "discussion assignments" do
|
||||||
@g1.save!
|
@g1.save!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
before :each do
|
||||||
|
user_session(@teacher)
|
||||||
|
end
|
||||||
|
|
||||||
context "create group discussion" do
|
context "create group discussion" do
|
||||||
before do
|
before do
|
||||||
user_session(@teacher)
|
|
||||||
get "/courses/#{@course.id}/discussion_topics"
|
get "/courses/#{@course.id}/discussion_topics"
|
||||||
expect_new_page_load{f("#new-discussion-btn").click}
|
expect_new_page_load{f("#new-discussion-btn").click}
|
||||||
f("#discussion-title").send_keys("New Discussion Title")
|
f("#discussion-title").send_keys("New Discussion Title")
|
||||||
|
@ -59,7 +61,6 @@ describe "discussion assignments" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should allow the student to reply and teacher to see the unread count", priority: "1", test_id: 150519 do
|
it "should allow the student to reply and teacher to see the unread count", priority: "1", test_id: 150519 do
|
||||||
user_session(@teacher)
|
|
||||||
get "/courses/#{@course.id}/discussion_topics/#{@discussion_topic.id}"
|
get "/courses/#{@course.id}/discussion_topics/#{@discussion_topic.id}"
|
||||||
expect(f('.new-and-total-badge .new-items').text).to include ""
|
expect(f('.new-and-total-badge .new-items').text).to include ""
|
||||||
user_session(@student1)
|
user_session(@student1)
|
||||||
|
|
|
@ -238,7 +238,7 @@ describe "groups" do
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------------------------------------------
|
||||||
describe "conferences page" do
|
describe "conferences page" do
|
||||||
before(:all) do
|
before(:once) do
|
||||||
PluginSetting.create!(name: "wimba", settings: {"domain" => "wimba.instructure.com"})
|
PluginSetting.create!(name: "wimba", settings: {"domain" => "wimba.instructure.com"})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,7 @@ describe "groups" do
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------------------------------------------
|
||||||
describe "conferences page" do
|
describe "conferences page" do
|
||||||
before(:all) do
|
before(:once) do
|
||||||
PluginSetting.create!(name: "wimba", settings: {"domain" => "wimba.instructure.com"})
|
PluginSetting.create!(name: "wimba", settings: {"domain" => "wimba.instructure.com"})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,15 @@ describe "Notifications" do
|
||||||
include_context "in-process server selenium tests"
|
include_context "in-process server selenium tests"
|
||||||
|
|
||||||
context "admin" do
|
context "admin" do
|
||||||
before(:all) do
|
before(:once) do
|
||||||
course_with_student(active_all: true)
|
course_with_student(active_all: true)
|
||||||
site_admin_logged_in
|
|
||||||
setup_comm_channel(@student)
|
setup_comm_channel(@student)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
before :each do
|
||||||
|
site_admin_logged_in
|
||||||
|
end
|
||||||
|
|
||||||
it "should send a notification to users that appointment groups are available", priority: "1", test_id: 186566 do
|
it "should send a notification to users that appointment groups are available", priority: "1", test_id: 186566 do
|
||||||
note_name = 'Appointment Group Published'
|
note_name = 'Appointment Group Published'
|
||||||
setup_notification(@student, name: note_name)
|
setup_notification(@student, name: note_name)
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe 'viewing a quiz with variable due dates on the quizzes index page' do
|
||||||
include_context 'in-process server selenium tests'
|
include_context 'in-process server selenium tests'
|
||||||
|
|
||||||
context 'as an observer linked to two students in different sections' do
|
context 'as an observer linked to two students in different sections' do
|
||||||
before(:all) { prepare_vdd_scenario_for_first_observer }
|
before(:once) { prepare_vdd_scenario_for_first_observer }
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
skip('Entire spec context is buggy. Bug tickets created: CNVS-22794 and CNVS-22793')
|
skip('Entire spec context is buggy. Bug tickets created: CNVS-22794 and CNVS-22793')
|
||||||
|
@ -48,7 +48,7 @@ describe 'viewing a quiz with variable due dates on the quizzes index page' do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'as an observer linked to a single student' do
|
context 'as an observer linked to a single student' do
|
||||||
before(:all) { prepare_vdd_scenario_for_second_observer }
|
before(:once) { prepare_vdd_scenario_for_second_observer }
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
user_session(@observer2)
|
user_session(@observer2)
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe 'viewing a quiz with variable due dates on the quizzes index page' do
|
||||||
include_context 'in-process server selenium tests'
|
include_context 'in-process server selenium tests'
|
||||||
|
|
||||||
context 'as a student in Section A' do
|
context 'as a student in Section A' do
|
||||||
before(:all) { prepare_vdd_scenario_for_first_student }
|
before(:once) { prepare_vdd_scenario_for_first_student }
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
user_session(@student1)
|
user_session(@student1)
|
||||||
|
@ -24,7 +24,7 @@ describe 'viewing a quiz with variable due dates on the quizzes index page' do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'as a student in Section B' do
|
context 'as a student in Section B' do
|
||||||
before(:all) { prepare_vdd_scenario_for_second_student }
|
before(:once) { prepare_vdd_scenario_for_second_student }
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
user_session(@student2)
|
user_session(@student2)
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe 'viewing a quiz with variable due dates on the quizzes index page' do
|
||||||
include_context 'in-process server selenium tests'
|
include_context 'in-process server selenium tests'
|
||||||
|
|
||||||
context 'as a TA in both sections' do
|
context 'as a TA in both sections' do
|
||||||
before(:all) { prepare_vdd_scenario_for_ta }
|
before(:once) { prepare_vdd_scenario_for_ta }
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
user_session(@ta1)
|
user_session(@ta1)
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe 'viewing a quiz with variable due dates on the quizzes index page' do
|
||||||
include_context 'in-process server selenium tests'
|
include_context 'in-process server selenium tests'
|
||||||
|
|
||||||
context 'as a teacher in both sections' do
|
context 'as a teacher in both sections' do
|
||||||
before(:all) { prepare_vdd_scenario_for_teacher }
|
before(:once) { prepare_vdd_scenario_for_teacher }
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
user_session(@teacher1)
|
user_session(@teacher1)
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe 'viewing a quiz with variable due dates on the quiz show page' do
|
||||||
include_context 'in-process server selenium tests'
|
include_context 'in-process server selenium tests'
|
||||||
|
|
||||||
context 'as an observer linked to two students in different sections' do
|
context 'as an observer linked to two students in different sections' do
|
||||||
before(:all) { prepare_vdd_scenario_for_first_observer }
|
before(:once) { prepare_vdd_scenario_for_first_observer }
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
user_session(@observer1)
|
user_session(@observer1)
|
||||||
|
@ -28,7 +28,7 @@ describe 'viewing a quiz with variable due dates on the quiz show page' do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'as an observer linked to a single student' do
|
context 'as an observer linked to a single student' do
|
||||||
before(:all) { prepare_vdd_scenario_for_second_observer }
|
before(:once) { prepare_vdd_scenario_for_second_observer }
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
user_session(@observer2)
|
user_session(@observer2)
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe 'viewing a quiz with variable due dates on the quiz show page' do
|
||||||
include_context 'in-process server selenium tests'
|
include_context 'in-process server selenium tests'
|
||||||
|
|
||||||
context 'as a student in Section A' do
|
context 'as a student in Section A' do
|
||||||
before(:all) { prepare_vdd_scenario_for_first_student }
|
before(:once) { prepare_vdd_scenario_for_first_student }
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
user_session(@student1)
|
user_session(@student1)
|
||||||
|
@ -28,7 +28,7 @@ describe 'viewing a quiz with variable due dates on the quiz show page' do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'as a student in Section B' do
|
context 'as a student in Section B' do
|
||||||
before(:all) { prepare_vdd_scenario_for_second_student }
|
before(:once) { prepare_vdd_scenario_for_second_student }
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
user_session(@student2)
|
user_session(@student2)
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe 'viewing a quiz with variable due dates on the quiz show page' do
|
||||||
include_context 'in-process server selenium tests'
|
include_context 'in-process server selenium tests'
|
||||||
|
|
||||||
context 'as a TA in both sections' do
|
context 'as a TA in both sections' do
|
||||||
before(:all) { prepare_vdd_scenario_for_ta }
|
before(:once) { prepare_vdd_scenario_for_ta }
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
user_session(@ta1)
|
user_session(@ta1)
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe 'viewing a quiz with variable due dates on the quiz show page' do
|
||||||
include_context 'in-process server selenium tests'
|
include_context 'in-process server selenium tests'
|
||||||
|
|
||||||
context 'as a teacher in both sections' do
|
context 'as a teacher in both sections' do
|
||||||
before(:all) { prepare_vdd_scenario_for_teacher }
|
before(:once) { prepare_vdd_scenario_for_teacher }
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
user_session(@teacher1)
|
user_session(@teacher1)
|
||||||
|
|
Loading…
Reference in New Issue