Marked more locations that might require to be changed when we switch from session to LtiParameters Object
This commit is contained in:
@ -11,7 +11,6 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
def current_user
|
def current_user
|
||||||
#Todo replace session with lti_parameter
|
#Todo replace session with lti_parameter
|
||||||
::NewRelic::Agent.add_custom_parameters({ external_user_id: session[:external_user_id], session_user_id: session[:user_id] })
|
|
||||||
@current_user ||= ExternalUser.find_by(id: session[:external_user_id]) || login_from_session || login_from_other_sources
|
@current_user ||= ExternalUser.find_by(id: session[:external_user_id]) || login_from_session || login_from_other_sources
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ module Lti
|
|||||||
private :build_tool_provider
|
private :build_tool_provider
|
||||||
|
|
||||||
def clear_lti_session_data
|
def clear_lti_session_data
|
||||||
|
#Todo replace session with lti_parameter
|
||||||
session.delete(:consumer_id)
|
session.delete(:consumer_id)
|
||||||
session.delete(:external_user_id)
|
session.delete(:external_user_id)
|
||||||
session.delete(:lti_parameters)
|
session.delete(:lti_parameters)
|
||||||
|
@ -17,6 +17,7 @@ describe Lti do
|
|||||||
|
|
||||||
describe '#clear_lti_session_data' do
|
describe '#clear_lti_session_data' do
|
||||||
it 'clears the session' do
|
it 'clears the session' do
|
||||||
|
#Todo replace session with lti_parameter
|
||||||
expect(controller.session).to receive(:delete).with(:consumer_id)
|
expect(controller.session).to receive(:delete).with(:consumer_id)
|
||||||
expect(controller.session).to receive(:delete).with(:external_user_id)
|
expect(controller.session).to receive(:delete).with(:external_user_id)
|
||||||
expect(controller.session).to receive(:delete).with(:lti_parameters)
|
expect(controller.session).to receive(:delete).with(:lti_parameters)
|
||||||
@ -163,11 +164,13 @@ describe Lti do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe '#store_lti_session_data' do
|
describe '#store_lti_session_data' do
|
||||||
|
#Todo replace session with lti_parameter
|
||||||
let(:parameters) { {} }
|
let(:parameters) { {} }
|
||||||
before(:each) { controller.instance_variable_set(:@current_user, FactoryGirl.create(:external_user)) }
|
before(:each) { controller.instance_variable_set(:@current_user, FactoryGirl.create(:external_user)) }
|
||||||
after(:each) { controller.send(:store_lti_session_data, consumer: FactoryGirl.build(:consumer), parameters: parameters) }
|
after(:each) { controller.send(:store_lti_session_data, consumer: FactoryGirl.build(:consumer), parameters: parameters) }
|
||||||
|
|
||||||
it 'stores data in the session' do
|
it 'stores data in the session' do
|
||||||
|
#Todo replace session with lti_parameter
|
||||||
expect(controller.session).to receive(:[]=).with(:consumer_id, anything)
|
expect(controller.session).to receive(:[]=).with(:consumer_id, anything)
|
||||||
expect(controller.session).to receive(:[]=).with(:external_user_id, anything)
|
expect(controller.session).to receive(:[]=).with(:external_user_id, anything)
|
||||||
expect(controller.session).to receive(:[]=).with(:lti_parameters, kind_of(Hash))
|
expect(controller.session).to receive(:[]=).with(:lti_parameters, kind_of(Hash))
|
||||||
|
@ -94,6 +94,7 @@ describe SessionsController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'stores LTI parameters in the session' do
|
it 'stores LTI parameters in the session' do
|
||||||
|
#Todo replace session with lti_parameter
|
||||||
expect(controller).to receive(:store_lti_session_data)
|
expect(controller).to receive(:store_lti_session_data)
|
||||||
request
|
request
|
||||||
end
|
end
|
||||||
@ -160,6 +161,7 @@ describe SessionsController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'clears the session' do
|
it 'clears the session' do
|
||||||
|
#Todo replace session with lti_parameter
|
||||||
expect(controller).to receive(:clear_lti_session_data)
|
expect(controller).to receive(:clear_lti_session_data)
|
||||||
delete :destroy
|
delete :destroy
|
||||||
end
|
end
|
||||||
@ -183,6 +185,7 @@ describe SessionsController do
|
|||||||
before(:each) { request.call }
|
before(:each) { request.call }
|
||||||
|
|
||||||
it 'clears the session' do
|
it 'clears the session' do
|
||||||
|
#Todo replace session with lti_parameter
|
||||||
expect(controller).to receive(:clear_lti_session_data)
|
expect(controller).to receive(:clear_lti_session_data)
|
||||||
request.call
|
request.call
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user