fix undefined `learning_outcome_links` within a group context
closes OUT-3735 flag=none test-plan: - Enable the outcome_alignment_non_scoring_content FF - Within a course, create a group (under People) - Navigate to the group and create a page within it - Visit the newly created page and make sure no errors occur Change-Id: I23e3dbb126e3177a6e037250c81307d5eb44fb2e Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/241455 Reviewed-by: Augusto Callejas <acallejas@instructure.com> Reviewed-by: Michael Brewer-Davis <mbd@instructure.com> Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> QA-Review: Michael Brewer-Davis <mbd@instructure.com> Product-Review: Michael Brewer-Davis <mbd@instructure.com>
This commit is contained in:
parent
0469b0227a
commit
f356c25e39
|
@ -18,6 +18,11 @@
|
|||
|
||||
module CanvasOutcomesHelper
|
||||
def set_outcomes_alignment_js_env(artifact, context, props)
|
||||
context =
|
||||
case context
|
||||
when Group then context.context
|
||||
else context
|
||||
end
|
||||
# don't show for contexts without alignmments
|
||||
return if context.learning_outcome_links.empty?
|
||||
|
||||
|
|
|
@ -88,6 +88,27 @@ describe CanvasOutcomesHelper do
|
|||
|
||||
it_behaves_like 'valid js_env settings'
|
||||
end
|
||||
|
||||
context 'within a Group' do
|
||||
before do
|
||||
outcome_model(context: @course)
|
||||
@group = @course.groups.create(:name => "some group")
|
||||
end
|
||||
|
||||
it 'sets js_env with the group.context values' do
|
||||
expect(subject).to receive(:extract_domain_jwt).and_return ['domain', 'jwt']
|
||||
expect(subject).to receive(:js_env).with({
|
||||
canvas_outcomes: {
|
||||
artifact_type: 'canvas.page',
|
||||
artifact_id: wiki_page.id,
|
||||
context_uuid: @course.uuid,
|
||||
host: 'http://domain',
|
||||
jwt: 'jwt'
|
||||
}
|
||||
})
|
||||
subject.set_outcomes_alignment_js_env(wiki_page, @group, {})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue