@@ -142,7 +142,7 @@ module PackStats # rubocop:disable RSpec/DescribedClassModuleWrapping
142142 end
143143 end
144144
145- context 'in app that does not use package protectiosn with a simple package owned by one team' do
145+ context 'in app that does not use package protection with a simple package owned by one team' do
146146 include_context 'only one team'
147147
148148 before do
@@ -981,7 +981,7 @@ module PackStats # rubocop:disable RSpec/DescribedClassModuleWrapping
981981 expect ( metrics ) . to include_metric GaugeMetric . new ( name : 'modularization.by_package.public_files.count' , count : 0 , tags : Tags . for ( [ 'package:packs/only_package' , 'app:MyApp' , 'team:Unknown' , 'max_enforcements:true' ] ) ) end
982982 end
983983
984- context 'in app with architectural enforcements' do
984+ context 'in app with layer enforcements' do
985985 before do
986986 write_file ( 'config/teams/Foo Team.yml' , <<~CONTENTS )
987987 name: Foo Team
@@ -1048,6 +1048,53 @@ module PackStats # rubocop:disable RSpec/DescribedClassModuleWrapping
10481048 expect ( metrics ) . to include_metric GaugeMetric . for ( 'by_team.violations.by_other_team.count' , 1 , Tags . for ( [ 'app:MyApp' , 'team:Bar Team' , 'other_team:Foo Team' , 'violation_type:visibility' ] ) )
10491049 end
10501050 end
1051+
1052+ context 'in app with folder_privacy enforcements' do
1053+ before do
1054+ write_file ( 'config/teams/Foo Team.yml' , <<~CONTENTS )
1055+ name: Foo Team
1056+ CONTENTS
1057+
1058+ write_file ( 'config/teams/Bar Team.yml' , <<~CONTENTS )
1059+ name: Bar Team
1060+ CONTENTS
1061+
1062+ write_file ( 'packs/my_pack/package.yml' , <<~CONTENTS )
1063+ enforce_dependencies: false
1064+ enforce_privacy: false
1065+ enforce_folder_privacy: true
1066+ enforce_visibility: true
1067+ layer: utilities
1068+ metadata:
1069+ owner: Bar Team
1070+ CONTENTS
1071+
1072+ write_file ( 'packs/other_pack/package.yml' , <<~CONTENTS )
1073+ enforce_dependencies: false
1074+ metadata:
1075+ owner: Foo Team
1076+ CONTENTS
1077+
1078+ write_file ( 'packs/my_pack/package_todo.yml' , <<~CONTENTS )
1079+ ---
1080+ packs/other_pack:
1081+ "SomeConstant":
1082+ violations:
1083+ - folder_privacy
1084+ - visibility
1085+ files:
1086+ - some_file.rb
1087+ CONTENTS
1088+
1089+ end
1090+
1091+ it 'emits the right metrics' do
1092+ expect ( metrics ) . to include_metric GaugeMetric . for ( 'all_packages.packwerk_checkers.strict.count' , 0 , Tags . for ( [ 'app:MyApp' , 'violation_type:folder_privacy' ] ) )
1093+ expect ( metrics ) . to include_metric GaugeMetric . for ( 'all_packages.packwerk_checkers.true.count' , 1 , Tags . for ( [ 'app:MyApp' , 'violation_type:folder_privacy' ] ) )
1094+ expect ( metrics ) . to include_metric GaugeMetric . for ( 'all_packages.violations.count' , 1 , Tags . for ( [ 'app:MyApp' , 'violation_type:folder_privacy' ] ) )
1095+ expect ( metrics ) . to include_metric GaugeMetric . for ( 'by_team.violations.count' , 1 , Tags . for ( [ 'app:MyApp' , 'team:Bar Team' , 'violation_type:folder_privacy' ] ) )
1096+ end
1097+ end
10511098 end
10521099 end
10531100end
0 commit comments