spec: Fix flakey update assignment spec

flag=none

Instead of depending on a particular ordering
of the assignment override results, search for
each specific override before testing.

test plan:
  - spec doesn't show up in FSC

Change-Id: I8d0367008f69f945374f50dab188f11bdf2ec46d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/243620
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Reviewed-by: Pat Renner <prenner@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Augusto Callejas <acallejas@instructure.com>
This commit is contained in:
Augusto Callejas 2020-07-28 07:18:42 -10:00
parent 590f43aa32
commit 47c5c604d8
1 changed files with 6 additions and 4 deletions

View File

@ -204,10 +204,12 @@ describe Mutations::UpdateAssignment do
result_overrides = assert_no_errors_and_get_overrides(result)
expect(result_overrides.length).to eq 3
expect(Assignment.find(@assignment_id).active_assignment_overrides.length).to eq 3
# for whatever reason, the update get returned in reverse order. not going to fight it unless asked
group_override_id = assert_group_override(result_overrides[0], @group.id)
assert_section_override(result_overrides[1], section.id)
adhoc_override_id = assert_adhoc_override(result_overrides[2], [@student.id])
group_override = result_overrides.find { |ro| ro['title'] == @group.name }
group_override_id = assert_group_override(group_override, @group.id)
section_override = result_overrides.find { |ro| ro['title'] == section.name }
assert_section_override(section_override, section.id)
adhoc_override = result_overrides.find { |ro| ro['title'] == '1 student' }
adhoc_override_id = assert_adhoc_override(adhoc_override, [@student.id])
result = execute_with_input <<~GQL
id: "#{@assignment_id}"