Add a variable expansions iso8601

Canvas.assignment.unlockAt.iso8601 Canvas.assignment.lockAt.iso8601 Canvas.assignment.dueAt.iso8601

fixes PLAT-1211

test-plan:
install the test tool with Canvas.assignment.unlockAt.iso8601 Canvas.assignment.lockAt.iso8601 Canvas.assignment.dueAt.iso8601 setup as a custom variable
launch the tool
it should return back the above date varibles in iso8601 format.

Change-Id: I6a816e8318cb70d50a0cf39f2138f4e395f39676
Reviewed-on: https://gerrit.instructure.com/61806
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Josh Orr <jgorr@instructure.com>
This commit is contained in:
Josh Orr 2015-08-25 15:07:33 -06:00
parent 894b1c9db4
commit f30e329d8c
2 changed files with 36 additions and 2 deletions

View File

@ -289,19 +289,33 @@ module Lti
register_expansion 'Canvas.assignment.pointsPossible', [],
-> { @assignment.points_possible },
ASSIGNMENT_GUARD
#deprecated in favor of ISO8601
register_expansion 'Canvas.assignment.unlockAt', [],
-> { @assignment.unlock_at },
ASSIGNMENT_GUARD
#deprecated in favor of ISO8601
register_expansion 'Canvas.assignment.lockAt', [],
-> { @assignment.lock_at },
ASSIGNMENT_GUARD
#deprecated in favor of ISO8601
register_expansion 'Canvas.assignment.dueAt', [],
-> { @assignment.due_at },
ASSIGNMENT_GUARD
register_expansion 'Canvas.assignment.unlockAt.iso8601', [],
-> { @assignment.unlock_at.utc.iso8601 },
ASSIGNMENT_GUARD
register_expansion 'Canvas.assignment.lockAt.iso8601', [],
-> { @assignment.lock_at.utc.iso8601 },
ASSIGNMENT_GUARD
register_expansion 'Canvas.assignment.dueAt.iso8601', [],
-> { @assignment.due_at.utc.iso8601 },
ASSIGNMENT_GUARD
register_expansion 'LtiLink.custom.url', [],
-> { @controller.show_lti_tool_settings_url(@tool_setting_link_id) },
-> { @tool_setting_link_id }

View File

@ -17,7 +17,6 @@
#
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
module Lti
describe VariableExpander do
let(:root_account) { Account.new }
@ -382,6 +381,27 @@ module Lti
expect(exp_hash[:test]).to eq right_now.to_s
end
it 'has substitution for $Canvas.assignment.unlockAt.iso8601' do
assignment.stubs(:unlock_at).returns(right_now)
exp_hash = {test: '$Canvas.assignment.unlockAt.iso8601'}
subject.expand_variables!(exp_hash)
expect(exp_hash[:test]).to eq right_now.utc.iso8601.to_s
end
it 'has substitution for $Canvas.assignment.lockAt.iso8601' do
assignment.stubs(:lock_at).returns(right_now)
exp_hash = {test: '$Canvas.assignment.lockAt.iso8601'}
subject.expand_variables!(exp_hash)
expect(exp_hash[:test]).to eq right_now.utc.iso8601.to_s
end
it 'has substitution for $Canvas.assignment.dueAt.iso8601' do
assignment.stubs(:due_at).returns(right_now)
exp_hash = {test: '$Canvas.assignment.dueAt.iso8601'}
subject.expand_variables!(exp_hash)
expect(exp_hash[:test]).to eq right_now.utc.iso8601.to_s
end
end
context 'user is logged in' do