`
-
SpeedGrader.setup()
- ENV.anonymous_moderated_marking_enabled = true
sinon.stub(EG, 'submitSelectedProvisionalGrade')
sinon.spy(EG, 'setActiveProvisionalGradeFields')
@@ -3176,7 +3063,6 @@ QUnit.module('SpeedGrader', function() {
window.location.hash = ''
fixtures.innerHTML = ''
- fakeENV.teardown()
})
test('assigns anonymous grader names based on sorted anonymous grader ID', () => {
diff --git a/spec/lib/api/v1/submission_spec.rb b/spec/lib/api/v1/submission_spec.rb
index 7285162e376..cb19e09b350 100644
--- a/spec/lib/api/v1/submission_spec.rb
+++ b/spec/lib/api/v1/submission_spec.rb
@@ -35,11 +35,16 @@ describe Api::V1::Submission do
let(:user) { User.create! }
let(:course) { Course.create! }
let(:assignment) { course.assignments.create! }
+ let(:teacher) {
+ teacher = User.create!
+ course.enroll_teacher(teacher)
+ teacher
+ }
let(:session) { {} }
let(:context) { nil }
let(:params) { { includes: [field]} }
let(:submission) { assignment.submissions.create!(user: user) }
- let(:provisional_grade) { submission.provisional_grades.create!(scorer: User.create!) }
+ let(:provisional_grade) { submission.provisional_grades.create!(scorer: teacher) }
describe 'speedgrader_url' do
it "links to the speed grader for a student's submission" do
diff --git a/spec/lib/data_fixup/backfill_anonymous_grading_data_spec.rb b/spec/lib/data_fixup/backfill_anonymous_grading_data_spec.rb
index e1bcda04907..45a62e79b03 100644
--- a/spec/lib/data_fixup/backfill_anonymous_grading_data_spec.rb
+++ b/spec/lib/data_fixup/backfill_anonymous_grading_data_spec.rb
@@ -52,41 +52,14 @@ describe DataFixup::BackfillAnonymousGradingData do
@course.enable_feature!(:anonymous_grading)
end
- context "when the base Anonymous Moderated Marking flag is off" do
- before(:once) do
- @root_account.disable_feature!(:anonymous_moderated_marking)
- end
-
- it "does not cause Anonymous Marking for the course to register as enabled" do
- # Note that technically this *does* flip on the Anonymous Marking
- # feature flag for the course, but because it depends on the base
- # AMM flag, any check for whether it's enabled while that flag is
- # off will return false. This is confusing but is the "correct"
- # behavior for these purposes.
- do_backfill
- expect(@course).not_to be_feature_enabled(:anonymous_marking)
- end
-
- it "sets assignments to be anonymously graded" do
- do_backfill
- expect(assignment_anonymously_graded).to be true
- end
+ it "enables Anonymous Marking for the course" do
+ do_backfill
+ expect(@course).to be_feature_enabled(:anonymous_marking)
end
- context "when the base Anonymous Moderated Marking flag is on" do
- before(:once) do
- @root_account.enable_feature!(:anonymous_moderated_marking)
- end
-
- it "enables Anonymous Marking for the course" do
- do_backfill
- expect(@course).to be_feature_enabled(:anonymous_marking)
- end
-
- it "sets assignments to be anonymously graded" do
- do_backfill
- expect(assignment_anonymously_graded).to be true
- end
+ it "sets assignments to be anonymously graded" do
+ do_backfill
+ expect(assignment_anonymously_graded).to be true
end
end
end
diff --git a/spec/lib/features/anonymous_moderated_marking_spec.rb b/spec/lib/features/anonymous_moderated_marking_spec.rb
deleted file mode 100644
index 7ad7dac1446..00000000000
--- a/spec/lib/features/anonymous_moderated_marking_spec.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-#
-# Copyright (C) 2018 - present Instructure, Inc.
-#
-# This file is part of Canvas.
-#
-# Canvas is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Affero General Public License as published by the Free
-# Software Foundation, version 3 of the License.
-#
-# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Affero General Public License along
-# with this program. If not, see .
-#
-
-require_relative '../../spec_helper.rb'
-
-describe 'anonymous moderated marking' do
- let(:root_account) { account_model }
- let(:course) { course_factory(account: root_account, active_all: true) }
- let(:anonymous_grading_feature) { Feature.definitions['anonymous_marking'] }
-
- describe 'anonymous grading flag' do
- context 'when the base AMM flag is not enabled' do
- it 'is not allowed on the account level' do
- expect(root_account).not_to be_feature_allowed(:anonymous_marking)
- end
-
- it 'is not visible on the account level' do
- expect(anonymous_grading_feature.visible_on.call(root_account)).to be_falsey
- end
-
- it 'is not allowed on the course level' do
- expect(course).not_to be_feature_allowed(:anonymous_marking)
- end
-
- it 'is not visible on the course level' do
- expect(anonymous_grading_feature.visible_on.call(course)).to be_falsey
- end
- end
-
- context 'when the base AMM flag is enabled' do
- before(:each) do
- root_account.enable_feature!(:anonymous_moderated_marking)
- end
-
- it 'is visible on the account level' do
- expect(anonymous_grading_feature.visible_on.call(root_account)).to be_truthy
- end
-
- it 'is visible on the course level' do
- expect(anonymous_grading_feature.visible_on.call(course)).to be_truthy
- end
-
- it 'is allowed on the course level if allowed on the account level' do
- root_account.allow_feature!(:anonymous_marking)
- expect(course).to be_feature_allowed(:anonymous_marking)
- end
-
- it 'is enabled on the course level if enabled on the account level' do
- root_account.enable_feature!(:anonymous_marking)
- expect(course).to be_feature_enabled(:anonymous_marking)
- end
- end
- end
-end
diff --git a/spec/lib/moderation_spec.rb b/spec/lib/moderation_spec.rb
index c474b91e54c..1f11176cfd1 100644
--- a/spec/lib/moderation_spec.rb
+++ b/spec/lib/moderation_spec.rb
@@ -33,23 +33,16 @@ describe Moderation do
@student = User.create!
end
- it "does not create selections if anonymous moderated marking is not enabled" do
+ it "does not create selections if moderated grading is false" do
expect{ test_moderation.create_moderation_selections_for_assignment(@assignment.id, [@student.id], []) }.
not_to change{ @assignment.moderated_grading_selections.count }
end
- it "does not create selections if anonymous moderated marking is enabled and moderated grading is false" do
- @course.root_account.enable_feature!(:anonymous_moderated_marking)
- expect{ test_moderation.create_moderation_selections_for_assignment(@assignment.id, [@student.id], []) }.
- not_to change{ @assignment.moderated_grading_selections.count }
- end
-
- context "with anonymous moderated marking enabled and moderated grading on" do
+ context "with moderated grading on" do
before :once do
@student2 = User.create!
@student3 = User.create!
- @course.root_account.enable_feature!(:anonymous_moderated_marking)
@assignment.update!(moderated_grading: true, grader_count: 1)
end
diff --git a/spec/models/assignment/speed_grader_spec.rb b/spec/models/assignment/speed_grader_spec.rb
index 59359bf6ee1..a726536d457 100644
--- a/spec/models/assignment/speed_grader_spec.rb
+++ b/spec/models/assignment/speed_grader_spec.rb
@@ -151,8 +151,11 @@ describe Assignment::SpeedGrader do
it "excludes provisional comments" do
setup_assignment_with_homework
+ @assignment.moderated_grading = true
+ @assignment.grader_count = 2
+ @assignment.save!
@submission = @assignment.submissions.first
- @comment = @submission.add_comment(:comment => 'comment', :provisional => true)
+ @comment = @submission.add_comment(comment: 'comment', author: @teacher, provisional: true)
json = Assignment::SpeedGrader.new(@assignment, @user).json
expect(json[:submissions].first[:submission_comments]).to be_empty
end
@@ -616,8 +619,6 @@ describe Assignment::SpeedGrader do
let(:submission_json) { json['submissions'][0] }
before :once do
- course.account.enable_feature!(:anonymous_moderated_marking)
-
course.enroll_student(student, section: section).accept!
assignment.update_submission(student, comment: 'comment by student', commenter: student)
@@ -919,11 +920,6 @@ describe Assignment::SpeedGrader do
expect(ras.count).to eq 1
expect(ras[0]['assessor_id']).to eq @ta.id.to_s
end
-
- it "determines whether the student needs a provisional grade" do
- expect(@json['context']['students'][0]['needs_provisional_grade']).to be_falsey
- expect(@json['context']['students'][1]['needs_provisional_grade']).to be_truthy # other student
- end
end
describe "for moderator" do
@@ -1202,8 +1198,6 @@ describe Assignment::SpeedGrader do
let(:grader_json) { Assignment::SpeedGrader.new(assignment, ta, avatars: true, grading_role: :grader).json }
before :once do
- course.account.enable_feature!(:anonymous_moderated_marking)
-
course.enroll_student(student_1, section: section_1).accept!
course.enroll_student(student_2, section: section_2).accept!
@@ -1503,8 +1497,6 @@ describe Assignment::SpeedGrader do
let(:submission_json) { json['submissions'][0] }
before :once do
- course.account.enable_feature!(:anonymous_moderated_marking)
-
course.enroll_student(student, section: section).accept!
assignment.update_submission(student, comment: 'comment by student', commenter: student)
diff --git a/spec/models/assignment_spec.rb b/spec/models/assignment_spec.rb
index 1d5b878d864..794cd52fd1d 100644
--- a/spec/models/assignment_spec.rb
+++ b/spec/models/assignment_spec.rb
@@ -183,7 +183,7 @@ describe Assignment do
assignment = @course.assignments.new(assignment_valid_attributes)
expect(DueDateCacher).to receive(:recompute).with(assignment, update_grades: true)
- assignment.update!(moderated_grading: !assignment.moderated_grading)
+ assignment.update!(moderated_grading: !assignment.moderated_grading, grader_count: 2)
end
it 'invokes DueDateCacher if called in a before_save context' do
@@ -244,40 +244,23 @@ describe Assignment do
)
end
- context 'when Anonymous Moderated Marking is enabled' do
- before(:once) do
- @course.root_account.enable_feature!(:anonymous_moderated_marking)
- end
-
- it 'returns false if the user is not the final grader and not an admin' do
- assistant = User.create!
- @course.enroll_ta(assistant, enrollment_state: 'active')
- expect(@assignment.permits_moderation?(assistant)).to be false
- end
-
- it 'returns true if the user is the final grader' do
- expect(@assignment.permits_moderation?(@teacher)).to be true
- end
-
- it 'returns true if the user is an admin with "select final grader for moderation" privileges' do
- expect(@assignment.permits_moderation?(account_admin_user)).to be true
- end
-
- it 'returns false if the user is an admin without "select final grader for moderation" privileges' do
- @course.account.role_overrides.create!(role: admin_role, enabled: false, permission: :select_final_grade)
- expect(@assignment.permits_moderation?(account_admin_user)).to be false
- end
+ it 'returns false if the user is not the final grader and not an admin' do
+ assistant = User.create!
+ @course.enroll_ta(assistant, enrollment_state: 'active')
+ expect(@assignment.permits_moderation?(assistant)).to be false
end
- context 'when Anonymous Moderated Marking is disabled' do
- it 'returns true if the user has moderate grades privileges' do
- expect(@assignment.permits_moderation?(@teacher)).to be true
- end
+ it 'returns true if the user is the final grader' do
+ expect(@assignment.permits_moderation?(@teacher)).to be true
+ end
- it 'returns false if the user does not have moderate grades privileges' do
- @course.root_account.role_overrides.create!(permission: 'moderate_grades', enabled: false, role: teacher_role)
- expect(@assignment.permits_moderation?(@teacher)).to be false
- end
+ it 'returns true if the user is an admin with "select final grader for moderation" privileges' do
+ expect(@assignment.permits_moderation?(account_admin_user)).to be true
+ end
+
+ it 'returns false if the user is an admin without "select final grader for moderation" privileges' do
+ @course.account.role_overrides.create!(role: admin_role, enabled: false, permission: :select_final_grade)
+ expect(@assignment.permits_moderation?(account_admin_user)).to be false
end
end
@@ -314,9 +297,8 @@ describe Assignment do
end
end
- context 'when Anonymous Moderated Marking is enabled' do
+ context 'when the assignment is anonymously graded' do
before(:once) do
- @course.root_account.enable_feature!(:anonymous_moderated_marking)
assignment.update!(anonymous_grading: true)
end
@@ -521,10 +503,6 @@ describe Assignment do
end
end
end
-
- context 'when Anonymous Moderated Marking is disabled' do
- it_behaves_like "grader anonymity does not apply"
- end
end
describe '#can_view_other_grader_comments?' do
@@ -560,75 +538,57 @@ describe Assignment do
end
end
- context 'when Anonymous Moderated Marking is enabled' do
- before(:once) do
- @course.root_account.enable_feature!(:anonymous_moderated_marking)
+ context 'when the assignment is not moderated' do
+ before :once do
+ assignment.update!(moderated_grading: false)
end
- context 'when the assignment is not moderated' do
- before :once do
- assignment.update!(moderated_grading: false)
- end
+ it_behaves_like "grader comment hiding does not apply"
+ end
- it_behaves_like "grader comment hiding does not apply"
+ context 'when grader comments are visible to other graders' do
+ before :once do
+ assignment.update!(
+ grader_comments_visible_to_graders: true,
+ grader_names_visible_to_final_grader: true
+ )
end
- context 'when the assignment is not anonymously graded' do
- before :once do
- assignment.update!(anonymous_grading: false)
- end
+ it_behaves_like "grader comment hiding does not apply"
- it_behaves_like "grader comment hiding does not apply"
+ it 'returns true when the user is not the final grader and not an admin' do
+ expect(assignment.can_view_other_grader_comments?(ta)).to be true
end
- context 'when grader comments are visible to other graders' do
- before :once do
- assignment.update!(
- grader_comments_visible_to_graders: true,
- grader_names_visible_to_final_grader: true
- )
- end
-
- it_behaves_like "grader comment hiding does not apply"
-
- it 'returns true when the user is not the final grader and not an admin' do
- expect(assignment.can_view_other_grader_comments?(ta)).to be true
- end
-
- it 'returns true when the user is the final grader' do
- expect(assignment.can_view_other_grader_comments?(@teacher)).to be true
- end
-
- it 'returns true when the user is an admin' do
- expect(assignment.can_view_other_grader_comments?(admin)).to be true
- end
+ it 'returns true when the user is the final grader' do
+ expect(assignment.can_view_other_grader_comments?(@teacher)).to be true
end
- context 'when grader comments are hidden to other graders' do
- before :once do
- assignment.update!(
- grader_comments_visible_to_graders: false,
- grader_names_visible_to_final_grader: true
- )
- end
-
- it 'returns false when the user is not the final grader and not an admin' do
- expect(assignment.can_view_other_grader_comments?(ta)).to be false
- end
-
- it 'returns true when the user is the final grader' do
- # The final grader must always be able to see grader comments.
- expect(assignment.can_view_other_grader_comments?(@teacher)).to be true
- end
-
- it 'returns true when the user is an admin' do
- expect(assignment.can_view_other_grader_comments?(admin)).to be true
- end
+ it 'returns true when the user is an admin' do
+ expect(assignment.can_view_other_grader_comments?(admin)).to be true
end
end
- context 'when Anonymous Moderated Marking is disabled' do
- it_behaves_like "grader comment hiding does not apply"
+ context 'when grader comments are hidden to other graders' do
+ before :once do
+ assignment.update!(
+ grader_comments_visible_to_graders: false,
+ grader_names_visible_to_final_grader: true
+ )
+ end
+
+ it 'returns false when the user is not the final grader and not an admin' do
+ expect(assignment.can_view_other_grader_comments?(ta)).to be false
+ end
+
+ it 'returns true when the user is the final grader' do
+ # The final grader must always be able to see grader comments.
+ expect(assignment.can_view_other_grader_comments?(@teacher)).to be true
+ end
+
+ it 'returns true when the user is an admin' do
+ expect(assignment.can_view_other_grader_comments?(admin)).to be true
+ end
end
end
@@ -665,32 +625,22 @@ describe Assignment do
end
end
- context 'when Anonymous Moderated Marking is enabled' do
- before(:once) do
- @course.root_account.enable_feature!(:anonymous_moderated_marking)
+ context 'when the assignment is not anonymously graded' do
+ before :once do
+ assignment.update!(anonymous_grading: false)
end
- context 'when the assignment is not anonymously graded' do
- before :once do
- assignment.update!(anonymous_grading: false)
- end
-
- it_behaves_like "student anonymity does not apply"
- end
-
- context 'when the assignment is anonymously graded' do
- it 'returns false when the user is not an admin' do
- expect(assignment.can_view_student_names?(@teacher)).to be false
- end
-
- it 'returns false when the user is an admin' do
- expect(assignment.can_view_student_names?(admin)).to be false
- end
- end
+ it_behaves_like "student anonymity does not apply"
end
- context 'when Anonymous Moderated Marking is disabled' do
- it_behaves_like "student anonymity does not apply"
+ context 'when the assignment is anonymously graded' do
+ it 'returns false when the user is not an admin' do
+ expect(assignment.can_view_student_names?(@teacher)).to be false
+ end
+
+ it 'returns false when the user is an admin' do
+ expect(assignment.can_view_student_names?(admin)).to be false
+ end
end
end
@@ -1388,9 +1338,8 @@ describe Assignment do
end
end
- context 'for a moderated assignment with Anonymous Moderated Marking enabled' do
+ context 'for a moderated assignment' do
before(:once) do
- @course.root_account.enable_feature!(:anonymous_moderated_marking)
student_in_course
teacher_in_course
@first_teacher = @teacher
@@ -1623,10 +1572,8 @@ describe Assignment do
expect(comment).not_to be_hidden
end
- context 'for moderated assignments with Anonymous Moderated Marking enabled' do
+ context 'for moderated assignments' do
before(:once) do
- @assignment.root_account.enable_feature!(:anonymous_moderated_marking)
-
teacher_in_course
@first_teacher = @teacher
@@ -2288,40 +2235,34 @@ describe Assignment do
expect(@assignment.muted?).to eql false
end
- context 'when Anonymous Moderated Marking is enabled' do
- before(:once) do
- @course.root_account.enable_feature!(:anonymous_moderated_marking)
- end
+ it 'does not mute non-anonymous, non-moderated assignments when created' do
+ assignment = @course.assignments.create!
+ expect(assignment).not_to be_muted
+ end
- it 'does not mute non-anonymous, non-moderated assignments when created' do
- assignment = @course.assignments.create!
- expect(assignment).not_to be_muted
- end
+ it 'mutes anonymous assignments when created' do
+ assignment = @course.assignments.create!(anonymous_grading: true)
+ expect(assignment).to be_muted
+ end
- it 'mutes anonymous assignments when created' do
- assignment = @course.assignments.create!(anonymous_grading: true)
- expect(assignment).to be_muted
- end
+ it 'mutes moderated assignments when created' do
+ assignment = @course.assignments.create!(moderated_grading: true, grader_count: 1)
+ expect(assignment).to be_muted
+ end
- it 'mutes moderated assignments when created' do
- assignment = @course.assignments.create!(moderated_grading: true, grader_count: 1)
- expect(assignment).to be_muted
- end
+ it 'mutes assignments when they are update from non-anonymous to anonymous' do
+ assignment = @course.assignments.create!
+ expect { assignment.update!(anonymous_grading: true) }.to change {
+ assignment.muted?
+ }.from(false).to(true)
+ end
- it 'mutes assignments when they are update from non-anonymous to anonymous' do
- assignment = @course.assignments.create!
- expect { assignment.update!(anonymous_grading: true) }.to change {
- assignment.muted?
- }.from(false).to(true)
- end
-
- it 'does not mute assignments when they are updated from anonymous to non-anonymous' do
- assignment = @course.assignments.create!(anonymous_grading: true)
- assignment.update!(muted: false)
- expect { assignment.update!(anonymous_grading: false) }.not_to change {
- assignment.muted?
- }.from(false)
- end
+ it 'does not mute assignments when they are updated from anonymous to non-anonymous' do
+ assignment = @course.assignments.create!(anonymous_grading: true)
+ assignment.update!(muted: false)
+ expect { assignment.update!(anonymous_grading: false) }.not_to change {
+ assignment.muted?
+ }.from(false)
end
end
@@ -2335,9 +2276,8 @@ describe Assignment do
expect(@assignment.unmute!).to be_falsey
end
- context "when Anonymous Moderated Marking is enabled and assignment is anonymously graded" do
+ context "when assignment is anonymously graded" do
before :once do
- @course.root_account.enable_feature! :anonymous_moderated_marking
@assignment.update_attributes(moderated_grading: true, anonymous_grading: true, grader_count: 1)
@assignment.mute!
end
@@ -2374,9 +2314,8 @@ describe Assignment do
end
end
- context "when Anonymous Moderated Marking is enabled and assignment is anonymously graded and not moderated" do
+ context "when assignment is anonymously graded and not moderated" do
before :once do
- @course.account.enable_feature! :anonymous_moderated_marking
@assignment.update_attributes(moderated_grading: false, anonymous_grading: true)
@assignment.mute!
end
@@ -2391,9 +2330,8 @@ describe Assignment do
end
end
- context "when Anonymous Moderated Marking is enabled and assignment is not anonymously graded" do
+ context "when assignment is not anonymously graded" do
before :once do
- @course.account.enable_feature! :anonymous_moderated_marking
@assignment.update_attributes(moderated_grading: true, anonymous_grading: false, grader_count: 1)
@assignment.mute!
end
@@ -2407,23 +2345,6 @@ describe Assignment do
expect(@assignment.unmute!).to eq(true)
end
end
-
- context "when Anonymous Moderated Marking is disabled and assignment is anonymously graded" do
- before :once do
- @course.account.disable_feature! :anonymous_moderated_marking
- @assignment.update_attributes(moderated_grading: true, anonymous_grading: true, grader_count: 1)
- @assignment.mute!
- end
-
- it "unmutes the assignment" do
- @assignment.unmute!
- expect(@assignment).not_to be_muted
- end
-
- it "returns true" do
- expect(@assignment.unmute!).to eq(true)
- end
- end
end
describe "infer_times" do
@@ -3169,37 +3090,34 @@ describe Assignment do
end
describe "to update" do
- context "when Anonymous Moderated Marking is enabled" do
- before(:each) do
- @course.root_account.enable_feature!(:anonymous_moderated_marking)
- @course.enable_feature!(:moderated_grading)
+ before(:each) do
+ @course.enable_feature!(:moderated_grading)
- @moderator = teacher_in_course(course: @course, active_all: true).user
- @non_moderator = teacher_in_course(course: @course, active_all: true).user
+ @moderator = teacher_in_course(course: @course, active_all: true).user
+ @non_moderator = teacher_in_course(course: @course, active_all: true).user
- @moderated_assignment = @course.assignments.create!(
- moderated_grading: true,
- grader_count: 3,
- final_grader: @moderator
- )
- end
+ @moderated_assignment = @course.assignments.create!(
+ moderated_grading: true,
+ grader_count: 3,
+ final_grader: @moderator
+ )
+ end
- it "allows the designated moderator to update a moderated assignment" do
- expect(@moderated_assignment.grants_right?(@moderator, :update)).to eq(true)
- end
+ it "allows the designated moderator to update a moderated assignment" do
+ expect(@moderated_assignment.grants_right?(@moderator, :update)).to eq(true)
+ end
- it "does not allow non-moderators to update a moderated assignment" do
- expect(@moderated_assignment.grants_right?(@non_moderator, :update)).to eq(false)
- end
+ it "does not allow non-moderators to update a moderated assignment" do
+ expect(@moderated_assignment.grants_right?(@non_moderator, :update)).to eq(false)
+ end
- it "allows an admin to update a moderated assignment" do
- expect(@moderated_assignment.grants_right?(@admin, :update)).to eq(true)
- end
+ it "allows an admin to update a moderated assignment" do
+ expect(@moderated_assignment.grants_right?(@admin, :update)).to eq(true)
+ end
- it "allows a teacher to update a moderated assignment with no moderator selected" do
- @moderated_assignment.update!(final_grader: nil)
- expect(@moderated_assignment.grants_right?(@non_moderator, :update)).to eq(true)
- end
+ it "allows a teacher to update a moderated assignment with no moderator selected" do
+ @moderated_assignment.update!(final_grader: nil)
+ expect(@moderated_assignment.grants_right?(@non_moderator, :update)).to eq(true)
end
end
end
@@ -5812,6 +5730,7 @@ describe Assignment do
assignment_model(course: @course)
@assignment.grade_student @student, score: 0, grader: @teacher
@assignment.moderated_grading = true
+ @assignment.grader_count = 1
expect(@assignment.save).to eq false
expect(@assignment.errors[:moderated_grading]).to be_present
end
@@ -5820,6 +5739,7 @@ describe Assignment do
assignment_model(course: @course)
@assignment.peer_reviews = true
@assignment.moderated_grading = true
+ @assignment.grader_count = 1
expect(@assignment.save).to eq false
expect(@assignment.errors[:moderated_grading]).to be_present
end
@@ -5828,12 +5748,13 @@ describe Assignment do
assignment_model(course: @course)
@assignment.group_category = @course.group_categories.create!(name: "groups")
@assignment.moderated_grading = true
+ @assignment.grader_count = 1
expect(@assignment.save).to eq false
expect(@assignment.errors[:moderated_grading]).to be_present
end
it "does not allow turning off if graded submissions exist" do
- assignment_model(course: @course, moderated_grading: true)
+ assignment_model(course: @course, moderated_grading: true, grader_count: 2, final_grader: @teacher)
expect(@assignment).to be_moderated_grading
@assignment.grade_student @student, score: 0, grader: @teacher
@assignment.moderated_grading = false
@@ -5842,7 +5763,7 @@ describe Assignment do
end
it "does not allow turning off if provisional grades exist" do
- assignment_model(course: @course, moderated_grading: true)
+ assignment_model(course: @course, moderated_grading: true, grader_count: 2)
expect(@assignment).to be_moderated_grading
submission = @assignment.submit_homework @student, body: "blah"
submission.find_or_create_provisional_grade!(@teacher, score: 0)
@@ -5854,6 +5775,7 @@ describe Assignment do
it "does not allow turning on for an ungraded assignment" do
assignment_model(course: @course, submission_types: 'not_graded')
@assignment.moderated_grading = true
+ @assignment.grader_count = 1
expect(@assignment.save).to eq false
expect(@assignment.errors[:moderated_grading]).to be_present
end
@@ -5861,6 +5783,7 @@ describe Assignment do
it "does not allow creating a new ungraded assignment with moderated grading" do
a = @course.assignments.build
a.moderated_grading = true
+ a.grader_count = 1
a.submission_types = 'not_graded'
expect(a).not_to be_valid
end
@@ -5953,17 +5876,18 @@ describe Assignment do
describe '.remove_user_as_final_grader_immediately' do
it 'removes the user as final grader in all assignments in the given course' do
- 2.times { @course.assignments.create!(moderated_grading: true, final_grader: @teacher) }
- another_teacher = User.create!
+ 2.times { @course.assignments.create!(moderated_grading: true, grader_count: 2, final_grader: @teacher) }
+ og_teacher = @teacher
+ another_teacher = teacher_in_course(course: @course, active_all: true).user
@course.enroll_teacher(another_teacher, active_all: true)
- @course.assignments.create!(moderated_grading: true, final_grader: another_teacher)
- expect { Assignment.remove_user_as_final_grader_immediately(@teacher.id, @course.id) }.to change {
+ @course.assignments.create!(moderated_grading: true, grader_count: 2, final_grader: another_teacher)
+ expect { Assignment.remove_user_as_final_grader_immediately(og_teacher.id, @course.id) }.to change {
@course.assignments.order(:created_at).pluck(:final_grader_id)
- }.from([@teacher.id, @teacher.id, another_teacher.id]).to([nil, nil, another_teacher.id])
+ }.from([og_teacher.id, og_teacher.id, another_teacher.id]).to([nil, nil, another_teacher.id])
end
it 'includes soft-deleted assignments when removing the user as final grader' do
- assignment = @course.assignments.create!(moderated_grading: true, final_grader: @teacher)
+ assignment = @course.assignments.create!(moderated_grading: true, grader_count: 2, final_grader: @teacher)
assignment.destroy
expect { Assignment.remove_user_as_final_grader_immediately(@teacher.id, @course.id) }.to change {
assignment.reload.final_grader_id
@@ -6044,7 +5968,6 @@ describe Assignment do
describe '#available_moderators' do
before(:once) do
@course = Course.create!
- @course.root_account.enable_feature!(:anonymous_moderated_marking)
@first_teacher = User.create!
@second_teacher = User.create!
[@first_teacher, @second_teacher].each { |user| @course.enroll_teacher(user, enrollment_state: 'active') }
@@ -6149,36 +6072,24 @@ describe Assignment do
@assignment.moderation_graders.create!(user: second_teacher, anonymous_id: '12345')
end
- it 'returns false if anonymous moderated marking is off' do
- @assignment.moderation_graders.create!(user: @ta, anonymous_id: '54321')
+ it 'returns false if all provisional grader slots are not filled' do
expect(@assignment.moderated_grader_limit_reached?).to eq false
end
- context 'when anonymous moderated marking is enabled' do
- before :once do
- @course.root_account.enable_feature!(:anonymous_moderated_marking)
- end
+ it 'returns true if all provisional grader slots are filled' do
+ @assignment.moderation_graders.create!(user: @ta, anonymous_id: '54321')
+ expect(@assignment.moderated_grader_limit_reached?).to eq true
+ end
- it 'returns false if all provisional grader slots are not filled' do
- expect(@assignment.moderated_grader_limit_reached?).to eq false
- end
+ it 'ignores grades issued by the final grader when determining if slots are filled' do
+ @assignment.moderation_graders.create!(user: @teacher, anonymous_id: '00000')
+ expect(@assignment.moderated_grader_limit_reached?).to eq false
+ end
- it 'returns true if all provisional grader slots are filled' do
- @assignment.moderation_graders.create!(user: @ta, anonymous_id: '54321')
- expect(@assignment.moderated_grader_limit_reached?).to eq true
- end
-
- it 'ignores grades issued by the final grader when determining if slots are filled' do
- @assignment.moderation_graders.create!(user: @teacher, anonymous_id: '00000')
- expect(@assignment.moderated_grader_limit_reached?).to eq false
- end
-
-
- it 'returns false if moderated grading is off' do
- @assignment.moderation_graders.create!(user: @ta, anonymous_id: '54321')
- @assignment.moderated_grading = false
- expect(@assignment.moderated_grader_limit_reached?).to eq false
- end
+ it 'returns false if moderated grading is off' do
+ @assignment.moderation_graders.create!(user: @ta, anonymous_id: '54321')
+ @assignment.moderated_grading = false
+ expect(@assignment.moderated_grader_limit_reached?).to eq false
end
end
@@ -6197,7 +6108,6 @@ describe Assignment do
moderated_grading: true
)
@assignment.moderation_graders.create!(user: @second_teacher, anonymous_id: '12345')
- @course.root_account.enable_feature!(:anonymous_moderated_marking)
end
shared_examples 'grader permissions are checked' do
@@ -6287,7 +6197,6 @@ describe Assignment do
describe 'Anonymous Moderated Marking setting validation' do
before(:once) do
- @course.account.enable_feature!(:anonymous_moderated_marking)
assignment_model(course: @course)
end
diff --git a/spec/models/assignments/needs_grading_count_query_spec.rb b/spec/models/assignments/needs_grading_count_query_spec.rb
index 623d1d62e40..994f87d3459 100644
--- a/spec/models/assignments/needs_grading_count_query_spec.rb
+++ b/spec/models/assignments/needs_grading_count_query_spec.rb
@@ -127,8 +127,13 @@ module Assignments
context "moderated grading count" do
before do
- @assignment = @course.assignments.create(:title => "some assignment",
- :submission_types => ['online_text_entry'], :moderated_grading => true, :points_possible => 3)
+ @assignment = @course.assignments.create(
+ title: "some assignment",
+ submission_types: ['online_text_entry'],
+ moderated_grading: true,
+ grader_count: 2,
+ points_possible: 3
+ )
@students = []
3.times do
student = student_in_course(:course => @course, :active_all => true).user
@@ -136,8 +141,8 @@ module Assignments
@students << student
end
- @ta1 = ta_in_course(:course => course_factory, :active_all => true).user
- @ta2 = ta_in_course(:course => course_factory, :active_all => true).user
+ @ta1 = ta_in_course(:course => @course, :active_all => true).user
+ @ta2 = ta_in_course(:course => @course, :active_all => true).user
end
it "should only include students with no marks when unmoderated" do
@@ -151,12 +156,10 @@ module Assignments
expect(querier.count).to eq 2
@students[1].submissions.first.find_or_create_provisional_grade!(@ta1)
- expect(querier.count).to eq 1
+ expect(querier.count).to eq 2
end
it "should only include students without two marks when moderated" do
- @students.each{|s| @assignment.moderated_grading_selections.create!(:student => s)}
-
querier = NeedsGradingCountQuery.new(@assignment, @teacher)
expect(querier.count).to eq 3
diff --git a/spec/models/content_migration/course_copy_assignments_spec.rb b/spec/models/content_migration/course_copy_assignments_spec.rb
index 18ecc01fcc4..37503d72840 100644
--- a/spec/models/content_migration/course_copy_assignments_spec.rb
+++ b/spec/models/content_migration/course_copy_assignments_spec.rb
@@ -243,14 +243,6 @@ describe ContentMigration do
expect(new_assignment.group_category.name).to eq "Project Groups"
end
- it "should copy moderated_grading setting" do
- assignment_model(:course => @copy_from, :points_possible => 40,
- :submission_types => 'file_upload', :grading_type => 'points', :moderated_grading => true)
- run_course_copy
- new_assignment = @copy_to.assignments.where(migration_id: mig_id(@assignment)).first
- expect(new_assignment).to be_moderated_grading
- end
-
it "should not copy peer_reviews_assigned" do
assignment_model(:course => @copy_from, :points_possible => 40, :submission_types => 'file_upload', :grading_type => 'points')
@assignment.peer_reviews_assigned = true
diff --git a/spec/models/course_spec.rb b/spec/models/course_spec.rb
index 1fa0b0a8166..b15ad0e8435 100644
--- a/spec/models/course_spec.rb
+++ b/spec/models/course_spec.rb
@@ -154,18 +154,12 @@ describe Course do
describe '#moderators' do
before(:once) do
@course = Course.create!
- @course.root_account.enable_feature!(:anonymous_moderated_marking)
@teacher = User.create!
@course.enroll_teacher(@teacher)
@ta = User.create!
@course.enroll_ta(@ta)
end
- it 'returns an empty list if the root account has Anonymous Moderated Marking disabled' do
- @course.root_account.disable_feature!(:anonymous_moderated_marking)
- expect(@course.moderators).to be_empty
- end
-
it 'includes active teachers' do
expect(@course.moderators).to include @teacher
end
diff --git a/spec/models/enrollment_spec.rb b/spec/models/enrollment_spec.rb
index 12c8de73696..dfc30583b0a 100644
--- a/spec/models/enrollment_spec.rb
+++ b/spec/models/enrollment_spec.rb
@@ -201,7 +201,6 @@ describe Enrollment do
context 'when the user is a final grader' do
before(:once) do
- @course.root_account.enable_feature!(:anonymous_moderated_marking)
@teacher = User.create!
@another_teacher = User.create!
@course.enroll_teacher(@teacher, enrollment_state: 'active', allow_multiple_enrollments: true)
@@ -210,7 +209,7 @@ describe Enrollment do
@course.assignments.create!(moderated_grading: true, final_grader: @another_teacher, grader_count: 2)
end
- it 'removes the user as final grader from all course assignments if Anonymous Moderated Marking is enabled' do
+ it 'removes the user as final grader from all course assignments' do
expect { @course.enrollments.find_by!(user: @teacher).destroy }.to change {
@course.assignments.order(:created_at).pluck(:final_grader_id)
}.from([nil, @teacher.id, @teacher.id, @another_teacher.id]).to([nil, nil, nil, @another_teacher.id])
diff --git a/spec/models/lti/lti_outbound_adapter_spec.rb b/spec/models/lti/lti_outbound_adapter_spec.rb
index cc7b5c9d141..2dca9f53806 100644
--- a/spec/models/lti/lti_outbound_adapter_spec.rb
+++ b/spec/models/lti/lti_outbound_adapter_spec.rb
@@ -359,7 +359,6 @@ describe Lti::LtiOutboundAdapter do
url: tool.url
)
)
- allow_any_instance_of(Account).to receive(:feature_enabled?).with(:anonymous_moderated_marking).and_return(false)
end
it 'builds the expected encrypted JWT with the correct course data' do
diff --git a/spec/models/moderated_grading/provisional_grade_spec.rb b/spec/models/moderated_grading/provisional_grade_spec.rb
index 1c422902133..2f006d40594 100644
--- a/spec/models/moderated_grading/provisional_grade_spec.rb
+++ b/spec/models/moderated_grading/provisional_grade_spec.rb
@@ -238,9 +238,8 @@ describe ModeratedGrading::ProvisionalGrade do
expect(sub.graded_anonymously).to eq true
end
- context 'for a moderated assignment with Anonymous Moderated Marking enabled' do
+ context 'for a moderated assignment' do
before(:each) do
- course.root_account.enable_feature!(:anonymous_moderated_marking)
assignment.update!(moderated_grading: true, grader_count: 2)
end
diff --git a/spec/models/role_override_spec.rb b/spec/models/role_override_spec.rb
index 059be17427e..a92af89a916 100644
--- a/spec/models/role_override_spec.rb
+++ b/spec/models/role_override_spec.rb
@@ -537,16 +537,6 @@ describe RoleOverride do
it 'is available to account admins, account memberships, teachers, and TAs' do
expect(permission[:available_to]).to match_array %w(AccountAdmin AccountMembership TeacherEnrollment TaEnrollment)
end
-
- it 'is allowed when Anonymous Moderated Marking is enabled for the account' do
- @account.root_account.enable_feature!(:anonymous_moderated_marking)
- expect(permission[:account_allows].call(@account)).to be true
- end
-
- it 'is not allowed when Anonymous Moderated Marking is disabled for the account' do
- @account.root_account.disable_feature!(:anonymous_moderated_marking)
- expect(permission[:account_allows].call(@account)).to be false
- end
end
describe 'view_audit_trail' do
@@ -559,16 +549,6 @@ describe RoleOverride do
it 'is available to teachers, TAs, admins and account memberships' do
expect(permission[:available_to]).to match_array %w(TeacherEnrollment AccountAdmin AccountMembership)
end
-
- it 'is allowed when Anonymous Moderated Marking is enabled for the account' do
- @account.root_account.enable_feature!(:anonymous_moderated_marking)
- expect(permission[:account_allows].call(@account)).to be true
- end
-
- it 'is not allowed when Anonymous Moderated Marking is disabled for the account' do
- @account.root_account.disable_feature!(:anonymous_moderated_marking)
- expect(permission[:account_allows].call(@account)).to be false
- end
end
end
diff --git a/spec/models/submission_spec.rb b/spec/models/submission_spec.rb
index 17636329d21..9d452f13d99 100644
--- a/spec/models/submission_spec.rb
+++ b/spec/models/submission_spec.rb
@@ -188,41 +188,23 @@ describe Submission do
submission_spec_model(assignment: @assignment)
end
- context 'with Anonymous Moderated Marking enabled' do
- before(:once) do
- @assignment.root_account.enable_feature!(:anonymous_moderated_marking)
- @submission.assignment.reload
- end
-
- it 'may not be graded if grades are not published' do
- expect(@submission.grants_right?(@teacher, :grade)).to eq false
- end
-
- it 'sets an error message indicating moderation is in progress if grades are not published' do
- @submission.grants_right?(@teacher, :grade)
- expect(@submission.grading_error_message).to eq 'This assignment is currently being moderated'
- end
-
- it 'may be graded if grades are not published but grade_posting_in_progress is true' do
- @submission.grade_posting_in_progress = true
- expect(@submission.grants_right?(@teacher, :grade)).to eq true
- end
-
- it 'may be graded when grades for the assignment are published' do
- @submission.assignment.update!(grades_published_at: Time.zone.now)
- expect(@submission.grants_right?(@teacher, :grade)).to eq true
- end
+ it 'may not be graded if grades are not published' do
+ expect(@submission.grants_right?(@teacher, :grade)).to eq false
end
- context 'with Anonymous Moderated Marking disabled' do
- it 'may be graded when grades for the assignment are not published' do
- expect(@submission.grants_right?(@teacher, :grade)).to eq true
- end
+ it 'sets an error message indicating moderation is in progress if grades are not published' do
+ @submission.grants_right?(@teacher, :grade)
+ expect(@submission.grading_error_message).to eq 'This assignment is currently being moderated'
+ end
- it 'may be graded when grades for the assignment are published' do
- @submission.assignment.update!(grades_published_at: Time.zone.now)
- expect(@submission.grants_right?(@teacher, :grade)).to eq true
- end
+ it 'may be graded if grades are not published but grade_posting_in_progress is true' do
+ @submission.grade_posting_in_progress = true
+ expect(@submission.grants_right?(@teacher, :grade)).to eq true
+ end
+
+ it 'may be graded when grades for the assignment are published' do
+ @submission.assignment.update!(grades_published_at: Time.zone.now)
+ expect(@submission.grants_right?(@teacher, :grade)).to eq true
end
end
end
@@ -3630,9 +3612,10 @@ describe Submission do
describe 'find_or_create_provisional_grade!' do
before(:once) do
- submission_spec_model
+ @assignment.grader_count = 1
@assignment.moderated_grading = true
@assignment.save!
+ submission_spec_model
@teacher2 = User.create(name: "some teacher 2")
@context.enroll_teacher(@teacher2)
@@ -3701,7 +3684,7 @@ describe Submission do
end
it "raises an exception if grade is not final and student does not need a provisional grade" do
- @submission.find_or_create_provisional_grade!(@teacher)
+ @assignment.grade_student(@student, grade: 2, grader: @teacher, provisional: true)
expect{ @submission.find_or_create_provisional_grade!(@teacher2, final: false) }
.to raise_error(Assignment::GradeError, "Student already has the maximum number of provisional grades")
@@ -3727,6 +3710,7 @@ describe Submission do
context "moderated" do
before(:once) do
+ @assignment.grader_count = 1
@assignment.moderated_grading = true
@assignment.save!
@submission.reload
@@ -3742,7 +3726,6 @@ describe Submission do
context "student in moderation set" do
it "returns the student alone" do
- @assignment.moderated_grading_selections.create!(student: @student)
expect(@submission.moderated_grading_whitelist).to eq([@student.moderated_grading_ids])
end
end
@@ -3763,7 +3746,7 @@ describe Submission do
context "student in moderation set" do
before(:once) do
- @sel = @assignment.moderated_grading_selections.create!(student: @student)
+ @sel = @assignment.moderated_grading_selections.find_by(student: @student)
end
it "returns nil if no provisional grade was published" do
@@ -4072,16 +4055,10 @@ describe Submission do
describe "#can_view_details" do
before :each do
- @assignment.root_account.enable_feature!(:anonymous_moderated_marking)
@assignment.update!(anonymous_grading: true, muted: true)
@submission = @assignment.submit_homework(@student, submission_type: 'online_text_entry', body: 'a body')
end
- it "returns true if anonymous_moderated_marking is not enabled" do
- @assignment.root_account.disable_feature!(:anonymous_moderated_marking)
- expect(@submission.can_view_details?(@student)).to be true
- end
-
it "returns true for submitting student if assignment anonymous grading and muted" do
expect(@submission.can_view_details?(@student)).to be true
end
@@ -4700,6 +4677,9 @@ describe Submission do
else
assignment.submissions.find_by!(user: user)
end
+ unless assignment.grades_published? || @submission.grade_posting_in_progress || assignment.permits_moderation?(user)
+ opts.delete(:grade)
+ end
@submission.update!(opts)
@submission
end
diff --git a/spec/models/user_learning_object_scopes_spec.rb b/spec/models/user_learning_object_scopes_spec.rb
index dd6602cfc2c..7dc1ca8ee1c 100644
--- a/spec/models/user_learning_object_scopes_spec.rb
+++ b/spec/models/user_learning_object_scopes_spec.rb
@@ -752,6 +752,7 @@ describe UserLearningObjectScopes do
end
end
@course2.assignments.first.update_attribute(:moderated_grading, true)
+ @course2.assignments.first.update_attribute(:grader_count, 2)
end
it "should not count assignments with no provisional grades" do
diff --git a/spec/presenters/grade_summary_assignment_presenter_spec.rb b/spec/presenters/grade_summary_assignment_presenter_spec.rb
index ce3062007f6..fe63a39a348 100644
--- a/spec/presenters/grade_summary_assignment_presenter_spec.rb
+++ b/spec/presenters/grade_summary_assignment_presenter_spec.rb
@@ -167,7 +167,6 @@ describe GradeSummaryAssignmentPresenter do
describe "#show_submission_details_link?" do
before :each do
- @assignment.root_account.enable_feature!(:anonymous_moderated_marking)
@submission_stub = double()
allow(@submission_stub).to receive(:originality_reports_for_display)
end
diff --git a/spec/requests/gradebooks_spec.rb b/spec/requests/gradebooks_spec.rb
index 4a3d1f22760..3cedef1acf6 100644
--- a/spec/requests/gradebooks_spec.rb
+++ b/spec/requests/gradebooks_spec.rb
@@ -62,22 +62,6 @@ describe 'Access Different Gradebooks Environments', type: :request do
end
end
- describe 'anonymous_moderated_marking_enabled' do
- it 'is false when the root account does not have anonymous_moderated_marking enabled' do
- get speed_grader_course_gradebook_path(course_id: @course.id), params: { assignment_id: @assignment.id }
- js_env = js_env_from_response(response)
-
- expect(js_env.fetch('anonymous_moderated_marking_enabled')).to be false
- end
-
- it 'is true when the root account has anonymous_moderated_marking enabled' do
- @course.root_account.enable_feature!(:anonymous_moderated_marking)
- get speed_grader_course_gradebook_path(course_id: @course.id), params: { assignment_id: @assignment.id }
- js_env = js_env_from_response(response)
- expect(js_env.fetch('anonymous_moderated_marking_enabled')).to be true
- end
- end
-
describe 'show_help_menu_item' do
it 'is false when the root account does not have a support URL configured' do
get speed_grader_course_gradebook_path(course_id: @course.id), params: { assignment_id: @assignment.id }
@@ -109,7 +93,6 @@ describe 'Access Different Gradebooks Environments', type: :request do
context 'for a moderated assignment with no grades published' do
before(:once) do
- @course.root_account.enable_feature!(:anonymous_moderated_marking)
@assignment.update!(
final_grader: @teacher,
grader_count: 2,
@@ -133,6 +116,7 @@ describe 'Access Different Gradebooks Environments', type: :request do
it 'is set to :grader for a moderated assignment whose grades have been published' do
@assignment.update!(
moderated_grading: true,
+ grader_count: 2,
grades_published_at: Time.zone.now
)
expect(js_env.fetch('grading_role')).to eq 'grader'
@@ -187,27 +171,4 @@ describe 'Access Different Gradebooks Environments', type: :request do
end
end
end
-
- describe 'GET #show' do
- describe 'js_env' do
- describe 'anonymous_moderated_marking_enabled' do
- before(:each) do
- user_session(@teacher)
- end
-
- it 'is false when the root account does not have anonymous_moderated_marking enabled' do
- get course_gradebook_path(course_id: @course.id)
- js_env = js_env_from_response(response)
- expect(js_env.dig('GRADEBOOK_OPTIONS', 'anonymous_moderated_marking_enabled')).to be false
- end
-
- it 'is true when the root account has anonymous_moderated_marking enabled' do
- @course.root_account.enable_feature!(:anonymous_moderated_marking)
- get course_gradebook_path(course_id: @course.id)
- js_env = js_env_from_response(response)
- expect(js_env.dig('GRADEBOOK_OPTIONS', 'anonymous_moderated_marking_enabled')).to be true
- end
- end
- end
- end
end
diff --git a/spec/selenium/assignments/assignments_anonymous_moderated_spec.rb b/spec/selenium/assignments/assignments_anonymous_moderated_spec.rb
index e9f5aa83c03..7715398fdba 100644
--- a/spec/selenium/assignments/assignments_anonymous_moderated_spec.rb
+++ b/spec/selenium/assignments/assignments_anonymous_moderated_spec.rb
@@ -22,8 +22,6 @@ describe 'Anonymous Moderated Marking' do
include_context 'in-process server selenium tests'
before(:each) do
- Account.default.enable_feature!(:anonymous_moderated_marking)
-
# create a course with a teacher
course_with_teacher(course_name: 'Course1')
end
diff --git a/spec/selenium/assignments/assignments_group_spec.rb b/spec/selenium/assignments/assignments_group_spec.rb
index d5eb4582701..da757f61189 100644
--- a/spec/selenium/assignments/assignments_group_spec.rb
+++ b/spec/selenium/assignments/assignments_group_spec.rb
@@ -187,7 +187,7 @@ describe "assignment groups" do
replace_content(f("#ag_#{ag.id}_assignment_name"), "Disappear")
fj('.create_assignment:visible').click
wait_for_ajaximations
-
+ refresh_page
expect(fj("#assignment_group_#{ag.id} .assignment:eq(1) .ig-title").text).to match "Disappear"
f("#assignment_group_#{ag.id} .al-trigger").click
@@ -264,6 +264,7 @@ describe "assignment groups" do
replace_content(f("#ag_#{ag.id}_assignment_points"), assignment_points)
fj('.create_assignment:visible').click
wait_for_ajaximations
+ refresh_page
# Checks for correct values in back end.
a = ag.reload.assignments.last
diff --git a/spec/selenium/assignments/assignments_moderated_spec.rb b/spec/selenium/assignments/assignments_moderated_spec.rb
index 0df79d7e013..8547fbe6129 100644
--- a/spec/selenium/assignments/assignments_moderated_spec.rb
+++ b/spec/selenium/assignments/assignments_moderated_spec.rb
@@ -22,10 +22,12 @@ describe "moderated grading assignments" do
include_context "in-process server selenium tests"
before do
+ Account.default.enable_feature!(:moderated_grading)
@course = course_model
@course.offer!
@assignment = @course.assignments.create!(submission_types: 'online_text_entry', title: 'Test Assignment')
@assignment.update_attribute :moderated_grading, true
+ @assignment.update_attribute :grader_count, 2
@assignment.update_attribute :workflow_state, 'published'
@student = User.create!
@course.enroll_student(@student)
@@ -33,35 +35,9 @@ describe "moderated grading assignments" do
@course.enroll_ta(@user)
end
- it "publishes grades from the moderate screen" do
- sub = @assignment.submit_homework(@student, :submission_type => 'online_text_entry', :body => 'hallo')
- sub.find_or_create_provisional_grade!(@user, score: 80)
-
- course_with_teacher_logged_in course: @course
- get "/courses/#{@course.id}/assignments/#{@assignment.id}/moderate"
- f('.ModeratedGrading__Header-PublishBtn').click
- driver.switch_to.alert.accept
- assert_flash_notice_message("Success! Grades were published to the grade book")
- end
-
- context "student tray" do
- before(:each) do
- @account = Account.default
- @account.enable_feature!(:student_context_cards)
- end
-
- it "moderated assignment should display student name in tray", priority: "1", test_id: 3022071 do
- course_with_teacher_logged_in course: @course
- get "/courses/#{@course.id}/assignments/#{@assignment.id}/moderate"
- f("a[data-student_id='#{@student.id}']").click
- expect(f(".StudentContextTray-Header__Name h2 a")).to include_text("User")
- end
- end
-
context "with assignment moderation setting" do
before(:each) do
# turn on the moderation flag
- Account.default.enable_feature!(:anonymous_moderated_marking)
Account.default.enable_feature!(:anonymous_marking)
Account.default.enable_feature!(:moderated_grading)
@moderated_assignment = @course.assignments.create!(
@@ -105,7 +81,6 @@ describe "moderated grading assignments" do
context "with moderator selected" do
before(:each) do
# turn on the moderation flag
- Account.default.enable_feature!(:anonymous_moderated_marking)
Account.default.enable_feature!(:anonymous_marking)
# create 2 teachers
diff --git a/spec/selenium/assignments/assignments_quizzes_spec.rb b/spec/selenium/assignments/assignments_quizzes_spec.rb
index a3cf7dde46a..842d104ca04 100644
--- a/spec/selenium/assignments/assignments_quizzes_spec.rb
+++ b/spec/selenium/assignments/assignments_quizzes_spec.rb
@@ -31,6 +31,7 @@ describe "quizzes assignments" do
ag = @course.assignment_groups.create!(:name => "Quiz group")
get "/courses/#{@course.id}/assignments"
build_assignment_with_type("Quiz", :assignment_group_id => ag.id, :name => "New Quiz", :submit => true)
+ refresh_page
expect_new_page_load { f("#assignment_group_#{ag.id}_assignments .ig-title").click }
expect(driver.current_url).to match %r{/courses/\d+/quizzes/\d+}
end
diff --git a/spec/selenium/assignments/assignments_spec.rb b/spec/selenium/assignments/assignments_spec.rb
index d27e82cf588..c83b1c86a4f 100644
--- a/spec/selenium/assignments/assignments_spec.rb
+++ b/spec/selenium/assignments/assignments_spec.rb
@@ -72,6 +72,8 @@ describe "assignments" do
before do
@assignment = @course.assignments.create({name: "Test Moderated Assignment"})
@assignment.update_attribute(:moderated_grading, true)
+ @assignment.update_attribute(:grader_count, 1)
+ @assignment.update_attribute(:final_grader, @teacher)
@assignment.unpublish
end
@@ -814,15 +816,14 @@ describe "assignments" do
@course.start_at = nil
@course.save!
@assignment = @course.assignments.create({name: "Test Moderated Assignment"})
- @assignment.update_attribute(:moderated_grading, true)
+ @assignment.update_attributes(
+ moderated_grading: true,
+ grader_count: 1,
+ final_grader: @teacher
+ )
@assignment.publish
end
- it "should show the moderated grading page for moderated grading assignments", priority: "1", test_id: 609651 do
- get "/courses/#{@course.id}/assignments/#{@assignment.id}/moderate"
- expect(f('#assignment_moderation')).to be_displayed
- end
-
it "should deny access for a regular student to the moderation page", priority: "1", test_id: 609652 do
course_with_student_logged_in({course: @course})
get "/courses/#{@course.id}/assignments/#{@assignment.id}/moderate"
diff --git a/spec/selenium/dashboard_teacher_spec.rb b/spec/selenium/dashboard_teacher_spec.rb
index 5d7918b4e15..dc7e2347b15 100644
--- a/spec/selenium/dashboard_teacher_spec.rb
+++ b/spec/selenium/dashboard_teacher_spec.rb
@@ -128,7 +128,12 @@ describe "dashboard" do
before do
@teacher = @user
@student = student_in_course(:course => @course, :active_all => true).user
- @assignment = @course.assignments.create!(:title => "some assignment", :submission_types => ['online_text_entry'], :moderated_grading => true)
+ @assignment = @course.assignments.create!(
+ title: "some assignment",
+ submission_types: ['online_text_entry'],
+ moderated_grading: true,
+ grader_count: 2
+ )
@assignment.submit_homework(@student, :body => "submission")
end
diff --git a/spec/selenium/grades/gradebook/gradebook_anonymous_moderated_marking_spec.rb b/spec/selenium/grades/gradebook/gradebook_anonymous_moderated_marking_spec.rb
index bdc1a90e443..664f78f8c0b 100644
--- a/spec/selenium/grades/gradebook/gradebook_anonymous_moderated_marking_spec.rb
+++ b/spec/selenium/grades/gradebook/gradebook_anonymous_moderated_marking_spec.rb
@@ -23,7 +23,6 @@ describe 'Original Gradebook' do
include GradebookCommon
before(:each) do
- Account.default.enable_feature!(:anonymous_moderated_marking)
Account.default.enable_feature!(:anonymous_grading)
# create a course with a teacher
@@ -61,7 +60,7 @@ describe 'Original Gradebook' do
student_enrollment2.update!(workflow_state: 'active')
end
- context 'with Anonymous Moderated Marking ON in submission detail' do
+ context 'submission detail' do
before(:each) do
user_session(@teacher1)
Gradebook::MultipleGradingPeriods.visit_gradebook(@anonymous_course)
@@ -77,7 +76,7 @@ describe 'Original Gradebook' do
end
end
- context 'with Anonymous Moderated Marking ON has grade cells', priority: '1', test_id: 3496299 do
+ context 'has grade cells', priority: '1', test_id: 3496299 do
before(:each) do
user_session(@teacher1)
Gradebook::MultipleGradingPeriods.visit_gradebook(@anonymous_course)
@@ -90,11 +89,5 @@ describe 'Original Gradebook' do
class_attribute_fetched = grade_cell_grayed.attribute("class")
expect(class_attribute_fetched).to include "grayed-out cannot_edit"
end
-
- it 'not greyed out with grades visible when assignment is unmuted' do
- refresh_page
- Gradebook::MultipleGradingPeriods.toggle_assignment_mute_option(@anonymous_assignment.id)
- expect(Gradebook::MultipleGradingPeriods.cell_graded?("11", 0, 0)).to be true
- end
end
end
diff --git a/spec/selenium/grades/gradebook/gradebook_grade_edit_spec.rb b/spec/selenium/grades/gradebook/gradebook_grade_edit_spec.rb
index e4f81f4a187..4b7a4604d1c 100644
--- a/spec/selenium/grades/gradebook/gradebook_grade_edit_spec.rb
+++ b/spec/selenium/grades/gradebook/gradebook_grade_edit_spec.rb
@@ -249,7 +249,6 @@ describe "editing grades" do
context "for a moderated assignment" do
before(:each) do
# turn on the moderation flag
- Account.default.enable_feature!(:anonymous_moderated_marking)
Account.default.enable_feature!(:anonymous_marking)
# create 1 teacher
diff --git a/spec/selenium/grades/gradezilla/gradebook_anonymous_moderated_spec.rb b/spec/selenium/grades/gradezilla/gradebook_anonymous_moderated_spec.rb
index 7880ed9abdf..0b302cb17a8 100644
--- a/spec/selenium/grades/gradezilla/gradebook_anonymous_moderated_spec.rb
+++ b/spec/selenium/grades/gradezilla/gradebook_anonymous_moderated_spec.rb
@@ -23,8 +23,6 @@ describe 'Anonymous Moderated Marking' do
include_context 'in-process server selenium tests'
before(:each) do
- Account.default.enable_feature!(:anonymous_moderated_marking)
-
# create a course with a teacher
course_with_teacher(course_name: 'Course1', active_all: true)
end
diff --git a/spec/selenium/grades/gradezilla/gradebook_assignment_column_options_spec.rb b/spec/selenium/grades/gradezilla/gradebook_assignment_column_options_spec.rb
index e8a7358516d..bc151eb8c73 100644
--- a/spec/selenium/grades/gradezilla/gradebook_assignment_column_options_spec.rb
+++ b/spec/selenium/grades/gradezilla/gradebook_assignment_column_options_spec.rb
@@ -133,8 +133,7 @@ describe "Gradezilla - Assignment Column" do
context "with anonymous assignment" do
before(:each) do
- # enable anonymous flags at account level
- Account.default.enable_feature!(:anonymous_moderated_marking)
+ # enable anonymous flag at account level
Account.default.enable_feature!(:anonymous_marking)
# re-use the course and student setup from the describe block up-above
diff --git a/spec/selenium/grades/gradezilla/gradebook_grade_edit_spec.rb b/spec/selenium/grades/gradezilla/gradebook_grade_edit_spec.rb
index 2d0b90dcad8..f6b2bc3b9b8 100644
--- a/spec/selenium/grades/gradezilla/gradebook_grade_edit_spec.rb
+++ b/spec/selenium/grades/gradezilla/gradebook_grade_edit_spec.rb
@@ -273,7 +273,6 @@ describe "Gradezilla editing grades" do
context "for a moderated assignment" do
before(:each) do
# turn on the moderation flag
- Account.default.enable_feature!(:anonymous_moderated_marking)
Account.default.enable_feature!(:anonymous_marking)
now = Time.zone.now
diff --git a/spec/selenium/grades/moderation/moderated_marking_spec.rb b/spec/selenium/grades/moderation/moderated_marking_spec.rb
index a8188312571..e1fe0c019a0 100644
--- a/spec/selenium/grades/moderation/moderated_marking_spec.rb
+++ b/spec/selenium/grades/moderation/moderated_marking_spec.rb
@@ -25,7 +25,6 @@ describe 'Moderated Marking' do
include_context 'in-process server selenium tests'
before(:each) do
- Account.default.enable_feature!(:anonymous_moderated_marking)
Account.default.enable_feature!(:moderated_grading)
# create a course with two teachers
diff --git a/spec/selenium/grades/pages/speedgrader_page.rb b/spec/selenium/grades/pages/speedgrader_page.rb
index 85018f9b194..427bf758998 100644
--- a/spec/selenium/grades/pages/speedgrader_page.rb
+++ b/spec/selenium/grades/pages/speedgrader_page.rb
@@ -45,7 +45,15 @@ class Speedgrader
end
def settings_link
- f('#settings_link')
+ f('#speedgrader-settings button')
+ end
+
+ def options_link
+ fxpath('//span[text() = "Options"]')
+ end
+
+ def keyboard_shortcuts_link
+ fxpath('//ul[@role = "menu"]//span[text() = "Keyboard Shortcuts"]')
end
def hide_students_chkbox
@@ -194,8 +202,16 @@ class Speedgrader
settings_link.click
end
+ def click_options_link
+ options_link.click
+ end
+
+ def click_keyboard_shortcuts_link
+ keyboard_shortcuts_link.click
+ end
+
def select_hide_student_names
- hide_students_chkbox
+ hide_students_chkbox.click
end
def click_next_student_btn
diff --git a/spec/selenium/grades/speedgrader/speedgrader_anonymous_moderated_marking_spec.rb b/spec/selenium/grades/speedgrader/speedgrader_anonymous_moderated_marking_spec.rb
index 19229d783ce..c15f393ab33 100644
--- a/spec/selenium/grades/speedgrader/speedgrader_anonymous_moderated_marking_spec.rb
+++ b/spec/selenium/grades/speedgrader/speedgrader_anonymous_moderated_marking_spec.rb
@@ -19,12 +19,11 @@ require_relative "../../common"
require_relative "../../helpers/speed_grader_common"
require_relative "../pages/speedgrader_page"
-describe "SpeedGrader with Anonymous Moderated Marking enabled" do
+describe "SpeedGrader with Anonymous Marking enabled" do
include_context "in-process server selenium tests"
include SpeedGraderCommon
before do
- Account.default.enable_feature!(:anonymous_moderated_marking)
Account.default.enable_feature!(:anonymous_marking)
course_with_teacher_logged_in
outcome_with_rubric
diff --git a/spec/selenium/grades/speedgrader/speedgrader_comments_spec.rb b/spec/selenium/grades/speedgrader/speedgrader_comments_spec.rb
index 32869051766..bd4e1d84b34 100644
--- a/spec/selenium/grades/speedgrader/speedgrader_comments_spec.rb
+++ b/spec/selenium/grades/speedgrader/speedgrader_comments_spec.rb
@@ -164,8 +164,9 @@ describe "speed grader" do
get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
expect(f("#avatar_image")).to be_displayed
- f("#settings_link").click
- f('#hide_student_names').click
+ Speedgrader.click_settings_link
+ Speedgrader.click_options_link
+ Speedgrader.select_hide_student_names
expect_new_page_load { fj('.ui-dialog-buttonset .ui-button:visible:last').click }
expect(f("#avatar_image")).not_to be_displayed
diff --git a/spec/selenium/grades/speedgrader/speedgrader_discussion_submissions_spec.rb b/spec/selenium/grades/speedgrader/speedgrader_discussion_submissions_spec.rb
index 093e93d1647..41f5f993534 100644
--- a/spec/selenium/grades/speedgrader/speedgrader_discussion_submissions_spec.rb
+++ b/spec/selenium/grades/speedgrader/speedgrader_discussion_submissions_spec.rb
@@ -84,8 +84,9 @@ describe "speed grader - discussion submissions" do
it "hides the name of student on discussion iframe", priority: "2", test_id: 283746 do
Speedgrader.visit(@course.id, @assignment.id)
- f("#settings_link").click
- f('#hide_student_names').click
+ Speedgrader.click_settings_link
+ Speedgrader.click_options_link
+ Speedgrader.select_hide_student_names
expect_new_page_load { fj('.ui-dialog-buttonset .ui-button:visible:last').click }
# check for correct submissions in speed grader iframe
@@ -106,8 +107,9 @@ describe "speed grader - discussion submissions" do
Speedgrader.visit(@course.id, @assignment.id)
- f("#settings_link").click
- f('#hide_student_names').click
+ Speedgrader.click_settings_link
+ Speedgrader.click_options_link
+ Speedgrader.select_hide_student_names
expect_new_page_load { fj('.ui-dialog-buttonset .ui-button:visible:last').click }
# check for correct submissions in speed grader iframe
@@ -126,8 +128,9 @@ describe "speed grader - discussion submissions" do
it "hides avatars on entries on both discussion links", priority: "2", test_id: 283748 do
Speedgrader.visit(@course.id, @assignment.id)
- f("#settings_link").click
- f('#hide_student_names').click
+ Speedgrader.click_settings_link
+ Speedgrader.click_options_link
+ Speedgrader.select_hide_student_names
expect_new_page_load { fj('.ui-dialog-buttonset .ui-button:visible:last').click }
# check for correct submissions in speed grader iframe
diff --git a/spec/selenium/grades/speedgrader/speedgrader_moderated_grading_spec.rb b/spec/selenium/grades/speedgrader/speedgrader_moderated_grading_spec.rb
index 254437837a7..ca2a7b474d8 100644
--- a/spec/selenium/grades/speedgrader/speedgrader_moderated_grading_spec.rb
+++ b/spec/selenium/grades/speedgrader/speedgrader_moderated_grading_spec.rb
@@ -24,13 +24,16 @@ describe "speed grader" do
include SpeedGraderCommon
before(:once) do
- course_factory(active_all: true)
- outcome_with_rubric
- @assignment = @course.assignments.new(:name => 'assignment with rubric', :points_possible => 10)
- @assignment.moderated_grading = true
- @assignment.save!
- @association = @rubric.associate_with(@assignment, @course, :purpose => 'grading', :use_for_grading => true)
- student_submission
+ @course = course_factory(active_all: true)
+ outcome_with_rubric(course: @course)
+ @assignment = @course.assignments.create!(
+ name: 'assignment with rubric',
+ points_possible: 10,
+ moderated_grading: true,
+ grader_count: 1
+ )
+ @association = @rubric.associate_with(@assignment, @course, purpose: 'grading', use_for_grading: true)
+ @submission = student_submission(assignment: @assignment)
end
before do
@@ -66,8 +69,8 @@ describe "speed grader" do
replace_content f('#grading-box-extended'), "8", tab_out: true
wait_for_ajaximations
end
- @submission.reload
- expect(@submission.updated_at.to_i).to eq time.to_i # should get touched
+ provisional_grade = @submission.provisional_grades.find_by!(scorer: @user)
+ expect(provisional_grade.grade).to eq '8'
time2 = 10.minutes.from_now
Timecop.freeze(time2) do
@@ -117,571 +120,6 @@ describe "speed grader" do
end
include_examples "moderated grading"
-
- it "should be able to see a ta's provisional grade in read-only mode" do
- other_ta = course_with_ta(:course => @course, :active_all => true).user
- @submission.find_or_create_provisional_grade!(other_ta, score: 7)
- @submission.add_comment(commenter: other_ta, comment: 'wat', provisional: true)
-
- get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
- tab = f('#moderation_tabs li')
- expect(tab).to be_displayed
- expect(tab).to include_text("1st Reviewer")
- expect(tab).to include_text("7/8")
-
- expect(f('#moderation_tabs')).to_not include_text("Add Review")
-
- grade = f('#grading-box-extended')
- expect(grade['readonly']).to be_present
- expect(grade['value']).to eq "7"
- expect(f('#discussion span.comment').text).to be_include 'wat'
- expect(f('#add_a_comment')).to_not be_displayed
- end
-
- it "should be able to two ta's provisional grades in read-only mode" do
- @assignment.moderated_grading_selections.create!(:student => @student)
-
- other_ta1 = course_with_ta(:course => @course, :active_all => true).user
- @submission.find_or_create_provisional_grade!(other_ta1, score: 7)
- @submission.add_comment(commenter: other_ta1, comment: 'wat', provisional: true)
-
- other_ta2 = course_with_ta(:course => @course, :active_all => true).user
- pg2 = @submission.find_or_create_provisional_grade!(other_ta2, score: 6)
- @submission.add_comment(commenter: other_ta2, comment: 'woo', provisional: true)
-
- get "/" # when run by itself this test works, but when run in conjunction with the others
- # if we don't navigate to speedgrader from a different page, the anchor won't work locally
-
- anchor_tag = CGI.escape("{\"student_id\":#{@student.id},\"provisional_grade_id\":#{pg2.id}}")
- get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}##{anchor_tag}"
- f('#speedgrader_iframe')
-
- tab = f('#moderation_tabs li.ui-state-active')
- expect(tab).to be_displayed
- expect(tab).to include_text("2nd Reviewer")
- expect(tab).to include_text("6/8")
-
- #open dropdown, make sure that the "Create 2nd Mark" link is not shown
- f('#moderation_bar #new_mark_dropdown_link').click
- wait_for_ajaximations
- expect(f('#new_mark_link')).to_not be_displayed
-
- grade = f('#grading-box-extended')
- expect(grade['readonly']).to be_present
- expect(grade['value']).to eq "6"
- expect(f('#discussion span.comment').text).to be_include 'woo'
- expect(f('#add_a_comment')).to_not be_displayed
-
- f('#moderation_tabs li').click # switch to first tab
- wait_for_ajaximations
- tab = f('#moderation_tabs li.ui-state-active')
- expect(tab).to be_displayed
- expect(tab).to include_text("1st Reviewer")
- expect(tab).to include_text("7/8")
-
- expect(grade['value']).to eq "7"
- expect(f('#discussion span.comment').text).to be_include 'wat'
- expect(f('#discussion span.comment').text).to_not be_include 'woo'
- end
-
- it "should allow a second mark to be explicitly created by the moderator when student is selected for moderation" do
- other_ta = course_with_ta(:course => @course, :active_all => true).user
- @submission.find_or_create_provisional_grade!(other_ta, score: 7)
- @assignment.moderated_grading_selections.create!(:student => @student)
-
- get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
- expect(f("#students_selectmenu-button")).to have_class("not_graded")
-
- new_mark_dd = f('#moderation_bar #new_mark_dropdown_link')
- expect(new_mark_dd).to include_text("Add Review")
- new_mark_dd.click
- wait_for_ajaximations
-
- new_mark_link = f('#new_mark_link')
- expect(new_mark_link).to be_displayed
- expect(new_mark_link).to include_text("Add 2nd Review")
- new_mark_link.click
-
- wait_for_ajaximations
-
- # should be editable now
- expect(f('#grading-box-extended')['disabled']).to be_nil
- expect(f('#add_a_comment')).to be_displayed
-
- replace_content f('#grading-box-extended'), "8", tab_out: true
-
- submit_comment "srsly"
-
- @submission.reload
- expect(@submission.score).to be_nil
-
- pg = @submission.provisional_grade(@teacher)
- expect(pg.score.to_i).to eql 8
- expect(pg.submission_comments.map(&:comment)).to be_include 'srsly'
-
- tab = f('#moderation_tabs li.ui-state-active')
- expect(tab).to include_text("2nd Reviewer")
- expect(tab).to include_text("8/8") # should sync tab state
-
- ff('#moderation_tabs li')[0].click # switch from 1st to 2nd mark - should preserve new comments + grade
- wait_for_ajaximations
- ff('#moderation_tabs li')[1].click
-
- grade = f('#grading-box-extended')
- expect(grade['disabled']).to be_nil
- expect(grade['value']).to eq "8"
- expect(f('#discussion span.comment').text).to be_include 'srsly'
- end
-
- it "should work with new rubric assessments on a second mark" do
- other_ta = course_with_ta(:course => @course, :active_all => true).user
- @submission.find_or_create_provisional_grade!(other_ta, score: 7)
- @assignment.moderated_grading_selections.create!(:student => @student)
-
- get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
- f('#moderation_bar #new_mark_dropdown_link').click
- wait_for_ajaximations
- f('#new_mark_link').click
- wait_for_ajaximations
-
- comment = "some silly comment"
- add_rubric_assessment(2, comment)
-
- ra = @association.rubric_assessments.first
- expect(ra.artifact).to be_a(ModeratedGrading::ProvisionalGrade)
- expect(ra.artifact.score).to eq 2
- expect(ra.data[0][:comments]).to eq comment
-
- pg = @submission.provisional_grade(@teacher)
- expect(pg.score.to_i).to eql 2
-
- tab = f('#moderation_tabs li.ui-state-active')
- expect(tab).to include_text("2nd Reviewer")
- expect(tab).to include_text("2/8") # should sync tab state
-
- ff('#moderation_tabs li')[0].click # switch from 1st to 2nd mark - should preserve new comments + grade
- wait_for_ajaximations
- expect(f('#rubric_summary_container')).to_not include_text(comment)
- ff('#moderation_tabs li')[1].click
- wait_for_ajaximations
-
- grade = f('#grading-box-extended')
- expect(grade['disabled']).to be_nil
- expect(grade['value']).to eq "2"
- expect(f('#rubric_summary_container')).to include_text(comment)
- end
-
- it "should be able to see and edit a final mark given by another teacher" do
- other_ta = course_with_ta(:course => @course, :active_all => true).user
- @submission.find_or_create_provisional_grade!(other_ta, score: 7)
- @assignment.moderated_grading_selections.create!(:student => @student)
-
- other_teacher = course_with_teacher(:course => @course, :active_all => true).user
- final_pg = @submission.find_or_create_provisional_grade!(other_teacher, score: 3, final: true)
-
- get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
- tabs = ff('#moderation_tabs > ul > li')
- expect(tabs[1]).to_not be_displayed # no second mark
- expect(tabs[1]).to have_class 'ui-state-disabled'
- final_tab = tabs[2]
- expect(final_tab).to be_displayed
- expect(final_tab).to include_text("Moderator")
- expect(final_tab).to include_text("3/8")
- final_tab.click
- wait_for_ajaximations
-
- grade = f('#grading-box-extended')
- expect(grade['disabled']).to be_nil
- expect(grade['value']).to eq "3"
- replace_content grade, "8", tab_out: true
-
- submit_comment "srsly"
-
- @submission.reload
- expect(@submission.score).to be_nil
-
- # shouldn't have created a prov grade for teacher
- expect(@submission.provisional_grade(@moderator)).to be_a(ModeratedGrading::NullProvisionalGrade)
-
- final_pg.reload
- expect(final_pg.score.to_i).to eql 8
- expect(final_pg.submission_comments.map(&:comment)).to be_include 'srsly'
- expect(final_tab).to include_text("8/8") # should sync tab state
- end
-
- it "should be able to add a rubric assessment to a final mark given by another teacher" do
- other_ta = course_with_ta(:course => @course, :active_all => true).user
- @submission.find_or_create_provisional_grade!(other_ta, score: 7)
- @assignment.moderated_grading_selections.create!(:student => @student)
-
- other_teacher = course_with_teacher(:course => @course, :active_all => true).user
- final_pg = @submission.find_or_create_provisional_grade!(other_teacher, score: 2, final: true)
-
- get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
- tabs = ff('#moderation_tabs > ul > li')
- final_tab = tabs[2]
- final_tab.click
- wait_for_ajaximations
-
- comment = "some silly comment"
- add_rubric_assessment(3, comment)
-
- @submission.reload
- expect(@submission.score).to be_nil
-
- # shouldn't have created a prov grade for teacher
- expect(@submission.provisional_grade(@moderator)).to be_a(ModeratedGrading::NullProvisionalGrade)
-
- final_pg.reload
- expect(final_pg.score.to_i).to eql 3
- expect(final_tab).to include_text("3/8") # should sync tab state
-
- ra = @association.rubric_assessments.first
- expect(ra.artifact).to eq final_pg
- expect(ra.data[0][:comments]).to eq comment
- end
-
- it "should be able to create a new final mark" do
- other_ta = course_with_ta(:course => @course, :active_all => true).user
- @submission.find_or_create_provisional_grade!(other_ta, score: 7)
- @assignment.moderated_grading_selections.create!(:student => @student)
-
- get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
- f('#moderation_bar #new_mark_dropdown_link').click
- wait_for_ajaximations
- new_mark_final = f('#new_mark_final_link')
- expect(new_mark_final).to be_displayed
- new_mark_final.click
- wait_for_ajaximations
-
- comment = "some silly comment"
- add_rubric_assessment(3, comment)
-
- @submission.reload
- expect(@submission.score).to be_nil
-
- # shouldn't have created a prov grade for teacher
- expect(@submission.provisional_grade(@moderator)).to be_a(ModeratedGrading::NullProvisionalGrade)
-
- final_pg = @submission.find_or_create_provisional_grade!(@moderator, final: true)
- expect(final_pg.score.to_i).to eql 3
- expect(ff('#moderation_tabs > ul > li')[2]).to include_text("3/8") # should sync tab state
-
- ra = @association.rubric_assessments.first
- expect(ra.artifact).to eq final_pg
- expect(ra.data[0][:comments]).to eq comment
- end
-
- it "should be able to copy a 1st mark to the final mark" do
- other_ta = course_with_ta(:course => @course, :active_all => true).user
- @submission.find_or_create_provisional_grade!(other_ta, score: 7)
- @assignment.moderated_grading_selections.create!(:student => @student)
-
- get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
- f('#moderation_bar #new_mark_dropdown_link').click
- wait_for_ajaximations
- expect(f('#new_mark_copy_link2')).to_not be_displayed # since there is no 2nd mark to copy yet
- copy_link = f('#new_mark_copy_link1')
- expect(copy_link).to be_displayed
- copy_link.click
- wait_for_ajaximations
-
- @submission.reload
- expect(@submission.score).to be_nil
- expect(@submission.provisional_grade(@moderator)).to be_a(ModeratedGrading::NullProvisionalGrade)
-
- final_pg = @submission.find_or_create_provisional_grade!(@moderator, final: true)
- expect(final_pg.score.to_i).to eql 7
- expect(ff('#moderation_tabs > ul > li')[2]).to include_text("7/8")
- end
-
- it "should be able to copy a 2nd mark to the final mark" do
- other_ta = course_with_ta(:course => @course, :active_all => true).user
- @submission.find_or_create_provisional_grade!(other_ta, score: 7)
- @assignment.moderated_grading_selections.create!(:student => @student)
-
- get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
- f('#moderation_bar #new_mark_dropdown_link').click
- wait_for_ajaximations
- # make a 2nd mark to copy with a rubric assessment and comments - make sure they get copied
- f('#new_mark_link').click
- wait_for_ajaximations
-
- comment = "some silly comment"
- add_rubric_assessment(3, comment)
-
- f('#speedgrader_comment_textarea').send_keys('srsly')
- f('#add_a_comment button[type="submit"]').click
- wait_for_ajaximations
-
- f('#moderation_bar #new_mark_dropdown_link').click
- wait_for_ajaximations
- f('#new_mark_copy_link2').click
- wait_for_ajaximations
-
- final_tab = f('#moderation_tabs li.ui-state-active') # should be active tab
- expect(final_tab).to include_text("Moderator")
- expect(final_tab).to include_text("3/8") # should sync tab state
-
- expect(f('#rubric_summary_container')).to include_text(@rubric.title)
- expect(f('#rubric_summary_container')).to include_text(comment)
-
- final_pg = @submission.find_or_create_provisional_grade!(@moderator, final: true)
- expect(final_pg.score.to_i).to eql 3
- expect(final_pg.submission_comments.map(&:comment)).to be_include 'srsly'
-
- ra = @association.rubric_assessments.detect{|ra_local| ra_local.artifact == final_pg}
- expect(ra.data[0][:comments]).to eq comment
- end
-
- it "should be able to re-copy a mark to the final mark" do
- other_ta = course_with_ta(:course => @course, :active_all => true).user
- @submission.find_or_create_provisional_grade!(other_ta, score: 7)
- @assignment.moderated_grading_selections.create!(:student => @student)
-
- other_teacher = course_with_teacher(:course => @course, :active_all => true).user
- final_pg = @submission.find_or_create_provisional_grade!(other_teacher, score: 2, final: true)
-
- get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
- f('#moderation_bar #new_mark_dropdown_link').click
- wait_for_ajaximations
- f('#new_mark_copy_link1').click
- driver.switch_to.alert.accept # should get a warning that it will overwrite the current final mark
- wait_for_ajaximations
-
- @submission.reload
- expect(@submission.score).to be_nil
- expect(@submission.provisional_grade(@moderator)).to be_a(ModeratedGrading::NullProvisionalGrade)
-
- final_pg.reload
- expect(final_pg.score.to_i).to eql 7
- expect(ff('#moderation_tabs > ul > li')[2]).to include_text("7/8")
- end
-
- context "grade reloading" do
- it "should load the current provisional grades while switching students if it changed in the background" do
- other_ta = course_with_ta(:course => @course, :active_all => true).user
- original_sub = @submission
- student_submission
-
- get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
- f('#speedgrader_iframe')
-
- # doesn't show any tabs because there are no marks
- expect(f('#moderation_tabs')).to_not be_displayed
-
- # go to next student
- f('#next-student-button').click
- wait_for_ajaximations
-
- Timecop.freeze(original_sub.updated_at) do
- # create a mark for the first student, but don't cause the submission's updated_at to change just yet
- original_sub.find_or_create_provisional_grade!(other_ta, score: 7)
- end
-
- # go back
- f('#prev-student-button').click
- wait_for_ajaximations
-
- # should still not have loaded the new provisional grades
- expect(f('#moderation_tabs')).to_not be_displayed
-
- f('#next-student-button').click
- wait_for_ajaximations
-
- Timecop.freeze(5.minutes.from_now) do
- original_sub.touch # now touch the submission as it would have been in the first place
- end
-
- f('#prev-student-button').click
- wait_for_ajaximations
-
- expect(f('#moderation_tabs')).to be_displayed
-
- tab = f('#moderation_tabs li.ui-state-active')
- expect(tab).to include_text("1st Reviewer")
- expect(tab).to include_text("7/8")
-
- grade = f('#grading-box-extended')
- expect(grade['readonly']).to be_present
- expect(grade['value']).to eq "7"
- end
-
- it "should load the current provisional grades selection while switching students if it changed in the background" do
- @other_ta = course_with_ta(:course => @course, :active_all => true).user
- @pg1 = @submission.find_or_create_provisional_grade!(@other_ta, score: 7)
- @selection = @assignment.moderated_grading_selections.create!(:student => @student)
-
- @other_ta2 = course_with_ta(:course => @course, :active_all => true).user
- @pg2 = @submission.find_or_create_provisional_grade!(@other_ta2, score: 6)
-
- @final_pg = @submission.find_or_create_provisional_grade!(@moderator, score: 2, final: true)
-
- @selection.provisional_grade = @pg1
- @selection.save!
-
- original_sub = @submission
- student_submission
-
- get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
- f('#speedgrader_iframe')
-
- icons = ff('#moderation_tabs .selected_icon')
- expect(icons[0]).to be_displayed
- expect(icons[1]).to_not be_displayed
- expect(icons[2]).to_not be_displayed
-
- f('#next-student-button').click
- wait_for_ajaximations
-
- Timecop.freeze(5.minutes.from_now) do
- @selection.provisional_grade = @pg2
- @selection.save!
- original_sub.touch
- end
-
- f('#prev-student-button').click
- wait_for_ajaximations
-
- expect(icons[0]).to_not be_displayed
- expect(icons[1]).to be_displayed
- expect(icons[2]).to_not be_displayed
- end
-
- it "should load the current provisional grade while switching students even if its from the same moderator" do
- # why am I doing this... I guess just because I can
- other_student = course_with_student(:course => @course, :active_all => true).user
-
- get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
- f('#speedgrader_iframe')
-
- f('#next-student-button').click
- wait_for_ajaximations
-
- expect(f('#this_student_does_not_have_a_submission')).to be_displayed
-
- f('#prev-student-button').click
- wait_for_ajaximations
-
- @assignment.grade_student(other_student, grade: 5, grader: @moderator, provisional: true)
-
- f('#next-student-button').click
- wait_for_ajaximations
-
- expect(f('#moderation_tabs')).to_not be_displayed # still should not show any tabs, since they own the one grade
- grade = f('#grading-box-extended')
- expect(grade['disabled']).to be_blank
- expect(grade['value']).to eq "5"
- end
- end
-
- context "moderated grade selection" do
- before :once do
- @other_ta = course_with_ta(:course => @course, :active_all => true).user
- @pg1 = @submission.find_or_create_provisional_grade!(@other_ta, score: 7)
- @selection = @assignment.moderated_grading_selections.create!(:student => @student)
- end
-
- it "should be able to select a provisional grade" do
- @other_ta2 = course_with_ta(:course => @course, :active_all => true).user
- @pg2 = @submission.find_or_create_provisional_grade!(@other_ta2, score: 6)
-
- @final_pg = @submission.find_or_create_provisional_grade!(@moderator, score: 2, final: true)
-
- @selection.provisional_grade = @pg1
- @selection.save!
-
- get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
-
- tabs = ff('#moderation_tabs > ul > li')
- icons = ff('#moderation_tabs .selected_icon')
- buttons = ff('#moderation_tabs button')
-
- # should show the 1st mark as selected on load
- expect(icons[0]).to be_displayed
- expect(icons[1]).to_not be_displayed
- expect(icons[2]).to_not be_displayed
-
- expect(buttons[0]).to_not be_displayed # don't show the select button if already selected
- expect(buttons[1]).to_not be_displayed
-
- tabs[2].click # show the final mark
- wait_for_ajaximations
-
- expect(buttons[2]).to be_displayed
- buttons[2].click
- wait_for_ajaximations
- check_element_has_focus(tabs[2])
-
- expect(buttons[2]).to_not be_displayed
- expect(icons[0]).to_not be_displayed
- expect(icons[2]).to be_displayed # should show the final mark as selected
-
- @selection.reload
- expect(@selection.provisional_grade).to eq @final_pg # should actually be selected
-
- # now repeat for the 2nd mark
- tabs[1].click
- wait_for_ajaximations
-
- expect(buttons[1]).to be_displayed
- buttons[1].click
- wait_for_ajaximations
-
- expect(buttons[1]).to_not be_displayed
- expect(icons[0]).to_not be_displayed
- expect(icons[1]).to be_displayed
- expect(icons[2]).to_not be_displayed
-
- @selection.reload
- expect(@selection.provisional_grade).to eq @pg2 # should actually be selected
- end
-
- it "should be able to select a newly created provisional grade (once it's saved)" do
- get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
- f('#moderation_bar #new_mark_dropdown_link').click
- wait_for_ajaximations
- f('#new_mark_link').click
- wait_for_ajaximations
-
- # should not show the select button until we have a real provisional grade
- mark_tab2 = ff('#moderation_tabs > ul > li')[1]
- mark_tab2_button = mark_tab2.find('button')
- expect(mark_tab2_button).to_not be_displayed
-
- replace_content f('#grading-box-extended'), "8", tab_out: true
- wait_for_ajaximations
-
- expect(mark_tab2_button).to be_displayed
- mark_tab2_button.click # select the provisional grade
- wait_for_ajaximations
-
- expect(mark_tab2_button).to_not be_displayed
- expect(mark_tab2.find('.selected_icon')).to be_displayed
-
- @selection.reload
- expect(@selection.provisional_grade).to eq @submission.provisional_grade(@moderator)
- end
-
- it "should automatically select the copied final grade" do
- @selection.provisional_grade = @pg1
- @selection.save!
-
- get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
-
- f('#moderation_bar #new_mark_dropdown_link').click
- wait_for_ajaximations
- f('#new_mark_copy_link1').click
- wait_for_ajaximations
-
- @selection.reload
- expect(@selection.provisional_grade).to eq @submission.provisional_grade(@moderator, final: true)
-
- icons = ff('#moderation_tabs .selected_icon')
- expect(icons[0]).to_not be_displayed
- expect(icons[2]).to be_displayed
- end
- end
end
context "as a provisional grader" do
@@ -693,6 +131,7 @@ describe "speed grader" do
include_examples "moderated grading"
it "should not lock a provisional grader out if graded by self" do
+ @assignment.moderation_graders.create!(user: @ta, anonymous_id: '12345')
@submission.find_or_create_provisional_grade!(@ta, score: 7)
get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
@@ -700,13 +139,13 @@ describe "speed grader" do
expect(f('#not_gradeable_message')).to_not be_displayed
end
- it "should lock a provisional grader out if graded by someone else (and not up for moderation)" do
+ it "should lock a provisional grader out if graded by someone else" do
other_ta = course_with_ta(:course => @course, :active_all => true).user
+ @assignment.moderation_graders.create!(user: other_ta, anonymous_id: '12345')
@submission.find_or_create_provisional_grade!(other_ta, score: 7)
get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
- expect(f('#grading-box-extended')).to_not be_displayed
- expect(f('#not_gradeable_message')).to be_displayed
+ expect(driver.current_url).to_not match %r{/courses/#{@course.id}/gradebook/speed_grader}
end
it "should lock a provisional grader out if graded by someone else while switching students" do
@@ -725,6 +164,7 @@ describe "speed grader" do
wait_for_ajaximations
# create a mark for the first student
+ @assignment.moderation_graders.create!(user: other_ta, anonymous_id: '12345')
original_sub.find_or_create_provisional_grade!(other_ta, score: 7)
# go back
@@ -736,9 +176,10 @@ describe "speed grader" do
expect(f('#not_gradeable_message')).to be_displayed
end
- it "should not lock a provisional grader out if someone else graded but the student is selected for moderation" do
- @assignment.moderated_grading_selections.create!(:student => @student)
+ it "should not lock a provisional grader out if someone else graded but more grader slots are available" do
+ @assignment.update_attribute :grader_count, 2
other_ta = course_with_ta(:course => @course, :active_all => true).user
+ @assignment.moderation_graders.create!(user: other_ta, anonymous_id: '12345')
@submission.find_or_create_provisional_grade!(other_ta, score: 7)
get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
@@ -746,16 +187,15 @@ describe "speed grader" do
expect(f('#not_gradeable_message')).to_not be_displayed
end
- it "should lock a provisional grader out the student is selected for moderation but two people have marked it" do
- @assignment.moderated_grading_selections.create!(:student => @student)
- other_ta1 = course_with_ta(:course => @course, :active_all => true).user
- @submission.find_or_create_provisional_grade!(other_ta1, score: 7)
- other_ta2 = course_with_ta(:course => @course, :active_all => true).user
- @submission.find_or_create_provisional_grade!(other_ta2, score: 6)
+ it "should not lock a provisional grader out if someone else graded but grader is final grader" do
+ @assignment.update_attribute :final_grader, @ta
+ other_ta = course_with_ta(:course => @course, :active_all => true).user
+ @assignment.moderation_graders.create!(user: other_ta, anonymous_id: '12345')
+ @submission.find_or_create_provisional_grade!(other_ta, score: 7)
get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
- expect(f('#grading-box-extended')).to_not be_displayed
- expect(f('#not_gradeable_message')).to be_displayed
+ expect(f('#grading-box-extended')).to be_displayed
+ expect(f('#not_gradeable_message')).to_not be_displayed
end
end
end
diff --git a/spec/selenium/grades/speedgrader/speedgrader_quiz_submissions_spec.rb b/spec/selenium/grades/speedgrader/speedgrader_quiz_submissions_spec.rb
index 201fa838a68..bd107eb518b 100644
--- a/spec/selenium/grades/speedgrader/speedgrader_quiz_submissions_spec.rb
+++ b/spec/selenium/grades/speedgrader/speedgrader_quiz_submissions_spec.rb
@@ -16,6 +16,7 @@
# with this program. If not, see .
require_relative "../../common"
+require_relative "../pages/speedgrader_page"
describe "speed grader - quiz submissions" do
include_context "in-process server selenium tests"
@@ -65,8 +66,9 @@ describe "speed grader - quiz submissions" do
it "hides student's name from quiz if hide student names is enabled", priority: "1", test_id: 283744 do
get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
- f("#settings_link").click
- f('#hide_student_names').click
+ Speedgrader.click_settings_link
+ Speedgrader.click_options_link
+ Speedgrader.select_hide_student_names
expect_new_page_load { fj('.ui-dialog-buttonset .ui-button:visible:last').click }
wait_for_ajaximations
in_frame 'speedgrader_iframe', '.quizzes-speedgrader' do
diff --git a/spec/selenium/grades/speedgrader/speedgrader_spec.rb b/spec/selenium/grades/speedgrader/speedgrader_spec.rb
index 33b34061a47..6c7b76af1f5 100644
--- a/spec/selenium/grades/speedgrader/speedgrader_spec.rb
+++ b/spec/selenium/grades/speedgrader/speedgrader_spec.rb
@@ -477,16 +477,16 @@ describe 'Speedgrader' do
end
it 'list all students', priority: "1", test_id: 164206 do
- validate_speedgrader_student_list
+ validate_speedgrader_student_list(false)
end
it 'list alias when hide student name is selected', priority: "2", test_id: 164208 do
Speedgrader.click_settings_link
+ Speedgrader.click_options_link
Speedgrader.select_hide_student_names
expect_new_page_load { fj('.ui-dialog-buttonset .ui-button:visible:last').click }
-
- validate_speedgrader_student_list
+ validate_speedgrader_student_list(true)
end
# speedgrader student dropdown shows assignment submission status symbols next to student names
@@ -602,12 +602,12 @@ describe 'Speedgrader' do
it 'opens and closes keyboard shortcut modal via blue info icon', priority: "2", test_id: 759319 do
user_session(teacher)
get "/courses/#{test_course.id}/gradebook/speed_grader?assignment_id=#{assignment.id}"
- keyboard_shortcut_icon = f('#keyboard-shortcut-info-icon')
- keyboard_modal = f('#keyboard_navigation')
- expect(keyboard_shortcut_icon).to be_displayed
+ Speedgrader.click_settings_link
+ expect(Speedgrader.keyboard_shortcuts_link).to be_displayed
# Open shortcut modal
- keyboard_shortcut_icon.click
+ Speedgrader.click_keyboard_shortcuts_link
+ keyboard_modal = f('#keyboard_navigation')
expect(keyboard_modal).to be_displayed
# Close shortcut modal
@@ -704,8 +704,12 @@ describe 'Speedgrader' do
@assignment.grade_student @students[1], grade: grade2, grader: @teacher
end
- def validate_speedgrader_student_list
+ def validate_speedgrader_student_list(hide)
Speedgrader.click_students_dropdown
- (0..2).each{|num| expect(Speedgrader.student_dropdown_menu).to include_text(@students[num].name)}
+ if hide
+ (1..3).each{|num| expect(Speedgrader.student_dropdown_menu).to include_text("Student #{num}")}
+ else
+ (0..2).each{|num| expect(Speedgrader.student_dropdown_menu).to include_text(@students[num].name)}
+ end
end
end
diff --git a/spec/selenium/grades/speedgrader/speedgrader_teacher_spec.rb b/spec/selenium/grades/speedgrader/speedgrader_teacher_spec.rb
index f7fe932fbb6..7703ac276c4 100644
--- a/spec/selenium/grades/speedgrader/speedgrader_teacher_spec.rb
+++ b/spec/selenium/grades/speedgrader/speedgrader_teacher_spec.rb
@@ -20,6 +20,7 @@ require_relative "../../helpers/speed_grader_common"
require_relative "../../helpers/gradebook_common"
require_relative "../../helpers/quizzes_common"
require_relative "../../helpers/groups_common"
+require_relative "../pages/speedgrader_page"
describe "speed grader" do
include_context "in-process server selenium tests"
@@ -183,8 +184,9 @@ describe "speed grader" do
get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
Speedgrader.click_settings_link
+ Speedgrader.click_options_link
click_option('#eg_sort_by', 'submitted_at', :value)
- Speedgrader.select_hide_student_names.click
+ Speedgrader.select_hide_student_names
expect_new_page_load do
Speedgrader.submit_settings_form
@@ -206,6 +208,7 @@ describe "speed grader" do
get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
Speedgrader.click_settings_link
+ Speedgrader.click_options_link
click_option('#eg_sort_by', 'submission_status', :value)
Speedgrader.select_hide_student_names.click
@@ -272,25 +275,29 @@ describe "speed grader" do
get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
# sort by submission date
- f("#settings_link").click
+ Speedgrader.click_settings_link
+ Speedgrader.click_options_link
f('select#eg_sort_by option[value="submitted_at"]').click
expect_new_page_load { fj('.ui-dialog-buttonset .ui-button:visible:last').click }
expect(f('#combo_box_container .ui-selectmenu .ui-selectmenu-item-header')).to include_text @student.name
# hide student names
- f("#settings_link").click
+ Speedgrader.click_settings_link
+ Speedgrader.click_options_link
f('#hide_student_names').click
expect_new_page_load { fj('.ui-dialog-buttonset .ui-button:visible:last').click }
expect(f('#combo_box_container .ui-selectmenu .ui-selectmenu-item-header')).to include_text "Student 1"
# make sure it works a second time too
- f("#settings_link").click
+ Speedgrader.click_settings_link
+ Speedgrader.click_options_link
f('select#eg_sort_by option[value="alphabetically"]').click
expect_new_page_load { fj('.ui-dialog-buttonset .ui-button:visible:last').click }
expect(f('#combo_box_container .ui-selectmenu .ui-selectmenu-item-header')).to include_text "Student 1"
# unselect the hide option
- f("#settings_link").click
+ Speedgrader.click_settings_link
+ Speedgrader.click_options_link
f('#hide_student_names').click
expect_new_page_load { fj('.ui-dialog-buttonset .ui-button:visible:last').click }
expect(f('#combo_box_container .ui-selectmenu .ui-selectmenu-item-header')).to include_text @student.name
diff --git a/spec/selenium/help_dialog_spec.rb b/spec/selenium/help_dialog_spec.rb
index 58994c5cc4f..57e6540d585 100644
--- a/spec/selenium/help_dialog_spec.rb
+++ b/spec/selenium/help_dialog_spec.rb
@@ -119,7 +119,7 @@ describe "help dialog" do
expect(f("#help_tray")).not_to contain_css("a[href='#teacher_feedback']")
end
- it "should show the Help dialog on the speedGrader when help is clicked and feedback is enabled" do
+ it "shows the Help item in the SpeedGrader settings menu when feedback is enabled" do
@course.enroll_student(User.create).accept!
@assignment = @course.assignments.create
@@ -130,14 +130,14 @@ describe "help dialog" do
Setting.set('show_feedback_link', 'true')
get "/courses/#{@course.id}/gradebook/speed_grader?assignment_id=#{@assignment.id}"
wait_for_ajaximations
- trigger = f('#gradebook_header .help_dialog_trigger')
+
+ settings_menu = f('#speedgrader-settings')
+ settings_menu.click
+
+ trigger = f('ul[role=menu] span[name=help][role=menuitem]')
make_full_screen
trigger.location_once_scrolled_into_view
expect(trigger).to be_displayed
- trigger.click
- wait_for_ajaximations
- expect(f("#help-dialog")).to be_displayed
- expect(f("#help-dialog a[href='#create_ticket']")).to be_displayed
end
end
diff --git a/spec/shared_examples/anonymous_moderated_marking/authorization.rb b/spec/shared_examples/anonymous_moderated_marking/authorization.rb
index eee4aa731f8..f53d2243750 100644
--- a/spec/shared_examples/anonymous_moderated_marking/authorization.rb
+++ b/spec/shared_examples/anonymous_moderated_marking/authorization.rb
@@ -16,10 +16,9 @@
# with this program. If not, see .
#
-RSpec.shared_examples 'authorization when Anonymous Moderated Marking is enabled' do |http_verb|
- before(:once) { @course.root_account.enable_feature!(:anonymous_moderated_marking) }
-
+RSpec.shared_examples 'authorization for provisional final grade selection' do |http_verb|
it 'is unauthorized if the user is not the assigned final grader' do
+ @assignment.update_attribute(:final_grader_id, nil)
api_call_as_user(@teacher, http_verb, @path, @params, {}, {}, expected_status: 401)
end
diff --git a/spec/shared_examples/provisional_grades.rb b/spec/shared_examples/provisional_grades.rb
index 4bf52ea5807..e765ca56b2a 100644
--- a/spec/shared_examples/provisional_grades.rb
+++ b/spec/shared_examples/provisional_grades.rb
@@ -22,7 +22,7 @@ RSpec.shared_examples 'a provisional grades status action' do |controller|
course_with_teacher(active_all: true)
ta_in_course(active_all: true)
@student = student_in_course(active_all: true).user
- @assignment = @course.assignments.create!(moderated_grading: true)
+ @assignment = @course.assignments.create!(moderated_grading: true, grader_count: 2)
@submission = @assignment.submit_homework @student, body: 'EHLO'
@path = "/api/v1/courses/#{@course.id}/assignments/#{@assignment.id}/#{controller}/status"
@resource_pair = if controller == :anonymous_provisional_grades
@@ -49,29 +49,6 @@ RSpec.shared_examples 'a provisional grades status action' do |controller|
expect(json.fetch('errors')).to include({'message' => 'user not authorized to perform that action'})
end
- it 'when given a TA, it needs a provisional grade' do
- json = api_call_as_user(@ta, :get, @path, @params, {}, {}, { expected_status: 200 })
- expect(json['needs_provisional_grade']).to be true
- end
-
- it 'when given a TA and a selection exists, it needs a provisional grade' do
- @assignment.moderated_grading_selections.create!(student: @student)
- json = api_call_as_user(@ta, :get, @path, @params, {}, {}, { expected_status: 200 })
- expect(json['needs_provisional_grade']).to be true
- end
-
- it 'when given a TA and a teacher-created provisional grade exists, it does not need a provisional grade' do
- @submission.find_or_create_provisional_grade!(@teacher)
- json = api_call_as_user(@ta, :get, @path, @params, {}, {}, { expected_status: 200 })
- expect(json['needs_provisional_grade']).to be false
- end
-
- it 'when given a TA and a TA-created provisional grade, it does not need a provisional grade' do
- @submission.find_or_create_provisional_grade!(@ta)
- json = api_call_as_user(@ta, :get, @path, @params, {}, {}, { expected_status: 200 })
- expect(json['needs_provisional_grade']).to be false
- end
-
it 'when called as a student, error message is not found' do
@params[@resource_pair.flatten.first] = nil
json = api_call_as_user(@ta, :get, @path, @params, {}, {}, { expected_status: 404 })
@@ -85,7 +62,6 @@ RSpec.shared_examples 'a provisional grades status action' do |controller|
end
before(:once) do
- @assignment.root_account.enable_feature!(:anonymous_moderated_marking)
@assignment.update!(grader_count: 1, final_grader: @teacher)
@ta.update!(name: 'Nobody Important')
diff --git a/spec/shared_examples/update_submission.rb b/spec/shared_examples/update_submission.rb
index a601667b842..356a6647430 100644
--- a/spec/shared_examples/update_submission.rb
+++ b/spec/shared_examples/update_submission.rb
@@ -296,7 +296,7 @@ RSpec.shared_examples 'a submission update action' do |controller|
before :once do
course_with_student(active_all: true)
@assignment = @course.assignments.create!(title: "some assignment",
- submission_types: "online_url,online_upload", moderated_grading: true)
+ submission_types: "online_url,online_upload", moderated_grading: true, grader_count: 2)
@submission = @assignment.submit_homework(@user)
end
@@ -343,7 +343,6 @@ RSpec.shared_examples 'a submission update action' do |controller|
before(:once) do
course_with_student(active_all: true)
teacher_in_course(active_all: true)
- @course.root_account.enable_feature!(:anonymous_moderated_marking)
@assignment = @course.assignments.create!(
title: 'yet another assignment',
diff --git a/spec/views/courses/_to_do_list.html.erb_spec.rb b/spec/views/courses/_to_do_list.html.erb_spec.rb
index 2e08cfd1295..ded9faccd1a 100644
--- a/spec/views/courses/_to_do_list.html.erb_spec.rb
+++ b/spec/views/courses/_to_do_list.html.erb_spec.rb
@@ -135,7 +135,8 @@ describe "courses/_to_do_list.html.erb" do
submission_types: "online_text_entry",
points_possible: 15,
title: "ModerateMe",
- moderated_grading: true)
+ moderated_grading: true,
+ grader_count: 2)
allow_any_instance_of(Assignments::NeedsGradingCountQuery).to receive(:manual_count).and_return(1)
@submission = submission_model(assignment: @assignment, body: "my submission")
@submission.find_or_create_provisional_grade!(@teacher, grade: 5)
diff --git a/spec/views/gradebooks/grade_summary.html.erb_spec.rb b/spec/views/gradebooks/grade_summary.html.erb_spec.rb
index 73f9008df9b..6c1c9d5ac26 100644
--- a/spec/views/gradebooks/grade_summary.html.erb_spec.rb
+++ b/spec/views/gradebooks/grade_summary.html.erb_spec.rb
@@ -84,13 +84,12 @@ describe "/gradebooks/grade_summary" do
expect(response.body).to match(/Test Student scores are not included in grade statistics./)
end
- describe "submission details link when anonymous_moderated_marking enabled" do
+ describe "submission details link" do
before(:each) do
course_with_teacher
student_in_course
@assignment = @course.assignments.create!(title: 'Moderated Assignment', anonymous_grading: true, muted: true)
@assignment.submit_homework @student, :submission_type => "online_text_entry", :body => "o hai"
- @assignment.root_account.enable_feature!(:anonymous_moderated_marking)
@submission_details_url = context_url(@course, :context_assignment_submission_url, @assignment, @student.id)
end