From 06d9c4356ee7cd835fd017a9fdea73bcb7ac3a83 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Thu, 11 Jan 2018 11:50:04 +0100 Subject: [PATCH] FC ParticulierClientSpec: simplier spec --- .../france_connect_particulier_client_spec.rb | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/spec/models/france_connect_particulier_client_spec.rb b/spec/models/france_connect_particulier_client_spec.rb index a93a6eb34..b73825d7d 100644 --- a/spec/models/france_connect_particulier_client_spec.rb +++ b/spec/models/france_connect_particulier_client_spec.rb @@ -2,16 +2,14 @@ require 'spec_helper' describe FranceConnectParticulierClient do describe '.initialize' do - it 'create an openid client' do - expect(described_class).to be < OpenIDConnect::Client - end + subject { FranceConnectParticulierClient.new(code) } + context 'when given code in params' do let(:code) { 'plop' } - subject { described_class.new(code) } - it 'set authorisation code' do - expect_any_instance_of(described_class).to receive(:authorization_code=).with(code) - described_class.new(code) - end + + before { allow_any_instance_of(FranceConnectParticulierClient).to receive(:authorization_code=) } + + it { is_expected.to have_received(:authorization_code=).with(code) } end end end