ignore deleted overrides in has_overrides?
test plan: * have an overriden assignment * delete the overrides * should not return "has_overrides in the API closes #CORE-3 Change-Id: I14c131226e606bb7493586b417bce2447016bdb8 Reviewed-on: https://gerrit.instructure.com/130170 Tested-by: Jenkins Reviewed-by: Jeremy Stanley <jeremy@instructure.com> QA-Review: Jeremy Putnam <jeremyp@instructure.com> Product-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
parent
085f16c9b9
commit
0ec135477e
|
@ -60,7 +60,12 @@ module DatesOverridable
|
|||
end
|
||||
|
||||
def has_overrides?
|
||||
assignment_overrides.loaded? ? assignment_overrides.any? : assignment_overrides.exists?
|
||||
if current_version?
|
||||
assignment_overrides.loaded? ? assignment_overrides.any?(&:active?) : assignment_overrides.active.exists?
|
||||
else
|
||||
# the old version's overrides might have be deleted too but it's probably more trouble than it's worth to check here
|
||||
assignment_overrides.loaded? ? assignment_overrides.any? : assignment_overrides.exists?
|
||||
end
|
||||
end
|
||||
|
||||
def has_active_overrides?
|
||||
|
|
|
@ -205,6 +205,11 @@ shared_examples_for "an object whose dates are overridable" do
|
|||
it { is_expected.to be_truthy }
|
||||
end
|
||||
|
||||
context "when it does but it's deleted" do
|
||||
before { override.destroy }
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
||||
context "when it doesn't" do
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue