@@ -422,7 +422,7 @@ class Parent < Person
422
422
423
423
it 'adds the collection: true option if called with a collection' do
424
424
representation = subject . represent ( 4 . times . map { Object . new } )
425
- representation . each { |r | r . options [ :collection ] . should be_true }
425
+ representation . each { |r | r . options [ :collection ] . should be true }
426
426
end
427
427
428
428
it 'returns a serialized hash of a single object if serializable: true' do
@@ -909,7 +909,7 @@ class UserEntity < Grape::Entity
909
909
rep = subject . send ( :value_for , :friends )
910
910
rep . should be_kind_of Array
911
911
rep . size . should == 2
912
- rep . all? { |r | r . is_a? ( EntitySpec ::UserEntity ) } . should be_true
912
+ rep . all? { |r | r . is_a? ( EntitySpec ::UserEntity ) } . should be true
913
913
end
914
914
915
915
it 'class' do
@@ -920,7 +920,7 @@ class UserEntity < Grape::Entity
920
920
rep = subject . send ( :value_for , :friends )
921
921
rep . should be_kind_of Array
922
922
rep . size . should == 2
923
- rep . all? { |r | r . is_a? ( EntitySpec ::UserEntity ) } . should be_true
923
+ rep . all? { |r | r . is_a? ( EntitySpec ::UserEntity ) } . should be true
924
924
end
925
925
end
926
926
end
@@ -972,54 +972,54 @@ class UserEntity < Grape::Entity
972
972
it 'only passes through hash :if exposure if all attributes match' do
973
973
exposure_options = { if : { condition1 : true , condition2 : true } }
974
974
975
- subject . send ( :conditions_met? , exposure_options , { } ) . should be_false
976
- subject . send ( :conditions_met? , exposure_options , condition1 : true ) . should be_false
977
- subject . send ( :conditions_met? , exposure_options , condition1 : true , condition2 : true ) . should be_true
978
- subject . send ( :conditions_met? , exposure_options , condition1 : false , condition2 : true ) . should be_false
979
- subject . send ( :conditions_met? , exposure_options , condition1 : true , condition2 : true , other : true ) . should be_true
975
+ subject . send ( :conditions_met? , exposure_options , { } ) . should be false
976
+ subject . send ( :conditions_met? , exposure_options , condition1 : true ) . should be false
977
+ subject . send ( :conditions_met? , exposure_options , condition1 : true , condition2 : true ) . should be true
978
+ subject . send ( :conditions_met? , exposure_options , condition1 : false , condition2 : true ) . should be false
979
+ subject . send ( :conditions_met? , exposure_options , condition1 : true , condition2 : true , other : true ) . should be true
980
980
end
981
981
982
982
it 'looks for presence/truthiness if a symbol is passed' do
983
983
exposure_options = { if : :condition1 }
984
984
985
- subject . send ( :conditions_met? , exposure_options , { } ) . should be_false
986
- subject . send ( :conditions_met? , exposure_options , condition1 : true ) . should be_true
987
- subject . send ( :conditions_met? , exposure_options , condition1 : false ) . should be_false
988
- subject . send ( :conditions_met? , exposure_options , condition1 : nil ) . should be_false
985
+ subject . send ( :conditions_met? , exposure_options , { } ) . should be false
986
+ subject . send ( :conditions_met? , exposure_options , condition1 : true ) . should be true
987
+ subject . send ( :conditions_met? , exposure_options , condition1 : false ) . should be false
988
+ subject . send ( :conditions_met? , exposure_options , condition1 : nil ) . should be false
989
989
end
990
990
991
991
it 'looks for absence/falsiness if a symbol is passed' do
992
992
exposure_options = { unless : :condition1 }
993
993
994
- subject . send ( :conditions_met? , exposure_options , { } ) . should be_true
995
- subject . send ( :conditions_met? , exposure_options , condition1 : true ) . should be_false
996
- subject . send ( :conditions_met? , exposure_options , condition1 : false ) . should be_true
997
- subject . send ( :conditions_met? , exposure_options , condition1 : nil ) . should be_true
994
+ subject . send ( :conditions_met? , exposure_options , { } ) . should be true
995
+ subject . send ( :conditions_met? , exposure_options , condition1 : true ) . should be false
996
+ subject . send ( :conditions_met? , exposure_options , condition1 : false ) . should be true
997
+ subject . send ( :conditions_met? , exposure_options , condition1 : nil ) . should be true
998
998
end
999
999
1000
1000
it 'only passes through proc :if exposure if it returns truthy value' do
1001
1001
exposure_options = { if : lambda { |_ , opts | opts [ :true ] } }
1002
1002
1003
- subject . send ( :conditions_met? , exposure_options , true : false ) . should be_false
1004
- subject . send ( :conditions_met? , exposure_options , true : true ) . should be_true
1003
+ subject . send ( :conditions_met? , exposure_options , true : false ) . should be false
1004
+ subject . send ( :conditions_met? , exposure_options , true : true ) . should be true
1005
1005
end
1006
1006
1007
1007
it 'only passes through hash :unless exposure if any attributes do not match' do
1008
1008
exposure_options = { unless : { condition1 : true , condition2 : true } }
1009
1009
1010
- subject . send ( :conditions_met? , exposure_options , { } ) . should be_true
1011
- subject . send ( :conditions_met? , exposure_options , condition1 : true ) . should be_false
1012
- subject . send ( :conditions_met? , exposure_options , condition1 : true , condition2 : true ) . should be_false
1013
- subject . send ( :conditions_met? , exposure_options , condition1 : false , condition2 : true ) . should be_false
1014
- subject . send ( :conditions_met? , exposure_options , condition1 : true , condition2 : true , other : true ) . should be_false
1015
- subject . send ( :conditions_met? , exposure_options , condition1 : false , condition2 : false ) . should be_true
1010
+ subject . send ( :conditions_met? , exposure_options , { } ) . should be true
1011
+ subject . send ( :conditions_met? , exposure_options , condition1 : true ) . should be false
1012
+ subject . send ( :conditions_met? , exposure_options , condition1 : true , condition2 : true ) . should be false
1013
+ subject . send ( :conditions_met? , exposure_options , condition1 : false , condition2 : true ) . should be false
1014
+ subject . send ( :conditions_met? , exposure_options , condition1 : true , condition2 : true , other : true ) . should be false
1015
+ subject . send ( :conditions_met? , exposure_options , condition1 : false , condition2 : false ) . should be true
1016
1016
end
1017
1017
1018
1018
it 'only passes through proc :unless exposure if it returns falsy value' do
1019
1019
exposure_options = { unless : lambda { |_ , options | options [ :true ] == true } }
1020
1020
1021
- subject . send ( :conditions_met? , exposure_options , true : false ) . should be_true
1022
- subject . send ( :conditions_met? , exposure_options , true : true ) . should be_false
1021
+ subject . send ( :conditions_met? , exposure_options , true : false ) . should be true
1022
+ subject . send ( :conditions_met? , exposure_options , true : true ) . should be false
1023
1023
end
1024
1024
end
1025
1025
0 commit comments