aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/user_spec.rb
diff options
context:
space:
mode:
authorXinhui2016-11-14 10:55:18 +0100
committerXinhui2016-11-14 10:55:18 +0100
commit32f12d8a3db8cae6cf29c9c85aeb9d899aecf814 (patch)
tree7f05e2ca18001ea4d482026e78a7c62ccb93714d /spec/models/user_spec.rb
parentf0a63658e609eef1f1e3967ac0729e5543974203 (diff)
downloadchouette-core-32f12d8a3db8cae6cf29c9c85aeb9d899aecf814.tar.bz2
Fix organisation functional_scope not updated
Refs #1941
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r--spec/models/user_spec.rb7
1 files changed, 7 insertions, 0 deletions
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 }