spec: fix flaky specs frd

followup to 3ef932cf9a

Change-Id: I1a6aa1ecc6f143242167dd3f22324b4f409c609f
Reviewed-on: https://gerrit.instructure.com/109167
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
This commit is contained in:
Jon Jensen 2017-04-19 16:40:56 -06:00
parent c5a66aa4ad
commit 8976bf760a
1 changed files with 14 additions and 5 deletions

View File

@ -5,8 +5,6 @@ module WeightingSetup
include GradebookSetup
def weighted_grading_setup
now = Time.zone.now
enrollment = add_teacher_and_student
enrollment.workflow_state = 'active'
enrollment.save!
@ -16,7 +14,7 @@ module WeightingSetup
@term_name = "First Term"
create_weighted_grading_periods(now)
create_weighted_grading_periods
associate_course_to_term(@term_name)
@ -34,14 +32,25 @@ module WeightingSetup
@a4.grade_student(@student, grade: 16, grader: @teacher)
end
def create_weighted_grading_periods(now)
def create_weighted_grading_periods()
# :sigh: ... in the case of SRGB, the grading period dropdown behavior
# is "interesting"... specifically 1. only the first change event
# records your preference, 2. if its value doesn't change, no
# preference is recorded and 3. if no preference is recorded, the
# selected value can change from one page load to the next (say, if a
# period becomes current due to crossing a minute boundary)
#
# so play it safe and make sure neither period will be current during
# the specs. also why does SRGB need a page refresh to work at all?
# :noideadog: (╯°□°)╯︵ ┻━┻
backend_group_helper = Factories::GradingPeriodGroupHelper.new
@gpg = backend_group_helper.create_for_account_with_term(Account.default, @term_name)
@gpg.update_attributes(display_totals_for_all_grading_periods: true)
backend_period_helper = Factories::GradingPeriodHelper.new
@gp1 = backend_period_helper.create_for_group(@gpg, {
start_date: now, end_date: 2.weeks.from_now, title: 'grading period one'
start_date: 1.hour.from_now, end_date: 2.weeks.from_now, title: 'grading period one'
})
@gp2 = backend_period_helper.create_for_group(@gpg, {