From 7da47a7b5cb089005589e87b367915cbf281f00b Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Wed, 17 Aug 2022 00:27:02 +0200 Subject: [PATCH] Improve tests based on expectations Amends and improves da0a682f --- spec/concerns/lti_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/concerns/lti_spec.rb b/spec/concerns/lti_spec.rb index fad78988..8da3aebb 100644 --- a/spec/concerns/lti_spec.rb +++ b/spec/concerns/lti_spec.rb @@ -81,21 +81,23 @@ describe Lti do context 'without a return URL' do before do allow(controller).to receive(:params).and_return({}) - allow(controller).to receive(:redirect_to).with(:root) end it 'redirects to the root URL' do + expect(controller).to receive(:redirect_to).with(:root) controller.send(:return_to_consumer) end it 'displays alerts' do message = I18n.t('sessions.oauth.failure') controller.send(:return_to_consumer, lti_errormsg: message) + expect(controller.instance_variable_get(:@flash)[:danger]).to eq(obtain_message(message)) end it 'displays notices' do - message = I18n.t('sessions.oauth.success') + message = I18n.t('sessions.destroy_through_lti.success_without_outcome') controller.send(:return_to_consumer, lti_msg: message) + expect(controller.instance_variable_get(:@flash)[:info]).to eq(obtain_message(message)) end end end