From 32f12d8a3db8cae6cf29c9c85aeb9d899aecf814 Mon Sep 17 00:00:00 2001 From: Xinhui Date: Mon, 14 Nov 2016 10:55:18 +0100 Subject: Fix organisation functional_scope not updated Refs #1941 --- spec/models/user_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spec/models/user_spec.rb') diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index bb43be63e..7d0a548c1 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -39,6 +39,13 @@ describe User, :type => :model do expect(org.sso_attributes['functional_scope']).to eq "[\"STIF:CODIFLIGNE:Line:C00840\", \"STIF:CODIFLIGNE:Line:C00086\"]" end + it 'should update organisation functional_scope' do + create :organisation, code: ticket.extra_attributes[:organisation_code], sso_attributes: {functional_scope: "[\"STIF:CODIFLIGNE:Line:C00840\"]"} + User.authenticate_with_cas_ticket(ticket) + org = Organisation.find_by(code: ticket.extra_attributes[:organisation_code]) + expect(org.sso_attributes['functional_scope']).to eq "[\"STIF:CODIFLIGNE:Line:C00840\", \"STIF:CODIFLIGNE:Line:C00086\"]" + end + it 'should not create a new organisation if organisation is already present' do ticket.extra_attributes[:organisation_code] = create(:organisation).code expect{User.authenticate_with_cas_ticket(ticket)}.not_to change{ Organisation.count } -- cgit v1.2.3