From c5122b3002ecf2bcc77c2efcae75f288b44be261 Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Wed, 30 Aug 2017 20:39:34 -0500 Subject: Warn in the quality spec when the exemption list is out of date --- spec/quality_spec.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb index 1a40769bac..7a34269831 100644 --- a/spec/quality_spec.rb +++ b/spec/quality_spec.rb @@ -172,7 +172,6 @@ RSpec.describe "The library itself" do auto_config_jobs cache_command_is_package console_command - default_cli_command deployment_means_frozen forget_cli_options gem.coc @@ -180,12 +179,11 @@ RSpec.describe "The library itself" do inline lockfile_uses_separate_rubygems_sources use_gem_version_promoter_for_major_updates - warned_version viz_command ] all_settings = Hash.new {|h, k| h[k] = [] } - documented_settings = exemptions + documented_settings = [] Bundler::Settings::BOOL_KEYS.each {|k| all_settings[k] << "in Bundler::Settings::BOOL_KEYS" } Bundler::Settings::NUMBER_KEYS.each {|k| all_settings[k] << "in Bundler::Settings::NUMBER_KEYS" } @@ -201,8 +199,14 @@ RSpec.describe "The library itself" do documented_settings = File.read("man/bundle-config.ronn")[/LIST OF AVAILABLE KEYS.*/m].scan(/^\* `#{key_pattern}`/).flatten end - documented_settings.each {|s| all_settings.delete(s) } - exemptions.each {|s| all_settings.delete(s) } + documented_settings.each do |s| + all_settings.delete(s) + expect(exemptions.delete(s)).to be_nil, "setting #{s} was exempted but was actually documented" + end + + exemptions.each do |s| + expect(all_settings.delete(s)).to be_truthy, "setting #{s} was exempted but unused" + end error_messages = all_settings.map do |setting, refs| "The `#{setting}` setting is undocumented\n\t- #{refs.join("\n\t- ")}\n" end -- cgit v1.2.1