@@ -653,7 +653,7 @@ class Parent < Person
653653 context 'with specified fields' do
654654 it 'returns only specified fields with only option' do
655655 subject . expose ( :id , :name , :phone )
656- representation = subject . represent ( OpenStruct . new , only : [ :id , : name] , serializable : true )
656+ representation = subject . represent ( OpenStruct . new , only : %i[ id name ] , serializable : true )
657657 expect ( representation ) . to eq ( id : nil , name : nil )
658658 end
659659
@@ -666,7 +666,7 @@ class Parent < Person
666666 it 'returns only fields specified in the only option and not specified in the except option' do
667667 subject . expose ( :id , :name , :phone )
668668 representation = subject . represent ( OpenStruct . new ,
669- only : [ : name, : phone] ,
669+ only : %i[ name phone ] ,
670670 except : [ :phone ] , serializable : true )
671671 expect ( representation ) . to eq ( name : nil )
672672 end
@@ -736,7 +736,7 @@ class Parent < Person
736736 subject . expose ( :id , :name , :phone )
737737 subject . expose ( :user , using : user_entity )
738738
739- representation = subject . represent ( OpenStruct . new ( user : { } ) , only : [ :id , :name , { user : [ : name, : email] } ] , serializable : true )
739+ representation = subject . represent ( OpenStruct . new ( user : { } ) , only : [ :id , :name , { user : %i[ name email ] } ] , serializable : true )
740740 expect ( representation ) . to eq ( id : nil , name : nil , user : { name : nil , email : nil } )
741741 end
742742
@@ -759,7 +759,7 @@ class Parent < Person
759759 subject . expose ( :user , using : user_entity )
760760
761761 representation = subject . represent ( OpenStruct . new ( user : { } ) ,
762- only : [ :id , :name , :phone , user : [ :id , : name, : email] ] ,
762+ only : [ :id , :name , :phone , user : %i[ id name email ] ] ,
763763 except : [ :phone , { user : [ :id ] } ] , serializable : true )
764764 expect ( representation ) . to eq ( id : nil , name : nil , user : { name : nil , email : nil } )
765765 end
@@ -771,7 +771,7 @@ class Parent < Person
771771 subject . expose ( :name )
772772 end
773773
774- representation = subject . represent ( OpenStruct . new , condition : true , only : [ :id , : name] , serializable : true )
774+ representation = subject . represent ( OpenStruct . new , condition : true , only : %i[ id name ] , serializable : true )
775775 expect ( representation ) . to eq ( id : nil , name : nil )
776776 end
777777
@@ -781,7 +781,7 @@ class Parent < Person
781781 subject . expose ( :name , :mobile_phone )
782782 end
783783
784- representation = subject . represent ( OpenStruct . new , condition : true , except : [ : phone, : mobile_phone] , serializable : true )
784+ representation = subject . represent ( OpenStruct . new , condition : true , except : %i[ phone mobile_phone ] , serializable : true )
785785 expect ( representation ) . to eq ( id : nil , name : nil )
786786 end
787787
@@ -863,7 +863,7 @@ class Parent < Person
863863 subject . expose ( :id )
864864 subject . expose ( :name , as : :title )
865865
866- representation = subject . represent ( OpenStruct . new , condition : true , only : [ :id , : title] , serializable : true )
866+ representation = subject . represent ( OpenStruct . new , condition : true , only : %i[ id title ] , serializable : true )
867867 expect ( representation ) . to eq ( id : nil , title : nil )
868868 end
869869
@@ -890,7 +890,7 @@ class Parent < Person
890890 subject . expose ( :nephew , using : nephew_entity )
891891
892892 representation = subject . represent ( OpenStruct . new ( user : { } ) ,
893- only : [ :id , : name, : user] , except : [ :nephew ] , serializable : true )
893+ only : %i[ id name user ] , except : [ :nephew ] , serializable : true )
894894 expect ( representation ) . to eq ( id : nil , name : nil , user : { id : nil , name : nil , email : nil } )
895895 end
896896 end
@@ -1341,8 +1341,8 @@ class NoPathCharacterEntity < Grape::Entity
13411341 it 'allows to pass different :only and :except params using the same instance' do
13421342 fresh_class . expose :a , :b , :c
13431343 presenter = fresh_class . new ( a : 1 , b : 2 , c : 3 )
1344- expect ( presenter . serializable_hash ( only : [ :a , : b] ) ) . to eq ( a : 1 , b : 2 )
1345- expect ( presenter . serializable_hash ( only : [ :b , : c] ) ) . to eq ( b : 2 , c : 3 )
1344+ expect ( presenter . serializable_hash ( only : %i[ a b ] ) ) . to eq ( a : 1 , b : 2 )
1345+ expect ( presenter . serializable_hash ( only : %i[ b c ] ) ) . to eq ( b : 2 , c : 3 )
13461346 end
13471347 end
13481348 end
0 commit comments