diff options
Diffstat (limited to 'spec/models/user_spec.rb')
| -rw-r--r-- | spec/models/user_spec.rb | 9 | 
1 files changed, 8 insertions, 1 deletions
| diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 16fbed27a..c20e80ca1 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -12,7 +12,8 @@ describe User, :type => :model do            :username          => 'john.doe',            :email             => 'john.doe@af83.com',            :organisation_code => '0083', -          :organisation_name => 'af83' +          :organisation_name => 'af83', +          :functional_scope  => "[\"STIF:CODIFLIGNE:Line:C00840\", \"STIF:CODIFLIGNE:Line:C00086\"]"          }          ticket.user    = "john.doe"          ticket.success = true @@ -32,6 +33,12 @@ describe User, :type => :model do          expect(Organisation.find_by(code: ticket.extra_attributes[:organisation_code])).to be_truthy        end +      it 'should store organisation functional_scope' do +        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 } | 
