File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -363,6 +363,30 @@ def test_info_custom_mapping
363
363
assert_equal 'bar' , info [ :login ]
364
364
end
365
365
366
+ def test_info_boolean_mapping_false
367
+ strategy . options . attribute_map = { admin : 'isAdmin' }
368
+
369
+ info = strategy . info
370
+
371
+ assert_equal user_info . name , info [ :name ]
372
+ assert_equal user_info . email , info [ :email ]
373
+ assert_equal false , info [ :admin ]
374
+ end
375
+
376
+ def test_info_boolean_mapping_true
377
+ azure_userinfo = ::OpenIDConnect ::ResponseObject ::UserInfo . new (
378
+ sub : SecureRandom . hex ( 16 ) ,
379
+ name : Faker ::Name . name ,
380
+ isAdmin : true
381
+ )
382
+ strategy . stubs ( :user_info ) . returns ( azure_userinfo )
383
+ strategy . options . attribute_map = { admin : 'isAdmin' }
384
+
385
+ info = strategy . info
386
+
387
+ assert_equal true , info [ :admin ]
388
+ end
389
+
366
390
def test_info_mail_unique_mapping
367
391
azure_userinfo = ::OpenIDConnect ::ResponseObject ::UserInfo . new (
368
392
sub : SecureRandom . hex ( 16 ) ,
Original file line number Diff line number Diff line change 1
- class StrategyTestCase < MiniTest ::Test
1
+ class StrategyTestCase < Minitest ::Test
2
2
class DummyApp
3
3
def call ( env ) ; end
4
4
end
@@ -28,7 +28,8 @@ def user_info
28
28
phone_number : Faker ::PhoneNumber . phone_number ,
29
29
website : Faker ::Internet . url ,
30
30
# custom claim
31
- foobar : 'bar'
31
+ foobar : 'bar' ,
32
+ isAdmin : false
32
33
)
33
34
end
34
35
You can’t perform that action at this time.
0 commit comments