From 29dacb4686bbf0497f27a73c2024f4af688099f2 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Mon, 11 Apr 2022 14:33:40 +0200 Subject: [PATCH] remove env dependence in spec --- .../agent_connect/agent_controller_spec.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/spec/controllers/agent_connect/agent_controller_spec.rb b/spec/controllers/agent_connect/agent_controller_spec.rb index ff88d764c..79bea11d2 100644 --- a/spec/controllers/agent_connect/agent_controller_spec.rb +++ b/spec/controllers/agent_connect/agent_controller_spec.rb @@ -1,10 +1,18 @@ describe AgentConnect::AgentController, type: :controller do describe '#login' do - before { get :login } + let(:uri) { 'https://agent-connect.fr' } + let(:state) { 'state' } + let(:nonce) { 'nonce' } + + before do + expect(AgentConnectService).to receive(:authorization_uri).and_return([uri, state, nonce]) + get :login + end it do - expect(state_cookie).not_to be_nil - expect(nonce_cookie).not_to be_nil + expect(state_cookie).to eq(state) + expect(nonce_cookie).to eq(nonce) + expect(response).to redirect_to(uri) end end