aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-12-24 17:33:43 +0100
committerSamuel Giddins <segiddins@segiddins.me>2016-12-26 14:53:47 -0600
commitd3e08cd95e4180b4500273caca0e140e00a4b29c (patch)
treeec55c92b6c69f52c0fa17bd45d47dca6abb0a9c2 /spec
parente83da282fa1449570d9dced3b634860e9168dc54 (diff)
downloadbundler-d3e08cd95e4180b4500273caca0e140e00a4b29c.tar.gz
[Quality] Add a spec for documentation of settings
Diffstat (limited to 'spec')
-rw-r--r--spec/quality_spec.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb
index 5f73228b..d5b77d67 100644
--- a/spec/quality_spec.rb
+++ b/spec/quality_spec.rb
@@ -191,6 +191,52 @@ describe "The library itself" do
expect(error_messages.compact).to be_well_formed
end
+ it "documents all used settings" do
+ exemptions = %w(
+ auto_install
+ cache_all
+ cache_all_platforms
+ clean
+ console
+ disable_checksum_validation
+ disable_exec_load
+ disable_local_branch_check
+ disable_shared_gems
+ jobs
+ major_deprecations
+ no_install
+ no_prune
+ shebang
+ silence_root_warning
+ specific_platform
+ ssl_verify_mode
+ system_bindir
+ user_agent
+ warned_version
+ )
+
+ all_settings = {}
+ documented_settings = exemptions
+
+ Dir.chdir(File.expand_path("../../lib", __FILE__)) do
+ key_pattern = /([a-z\._-]+)/i
+ `git ls-files -z`.split("\x0").each do |filename|
+ File.readlines(filename).each_with_index do |line, number|
+ line.scan(/Bundler\.settings\[:#{key_pattern}\]/).flatten.each {|s| (all_settings[s] ||= []) << "referenced at `lib/#{filename}:#{number}`" }
+ end
+ end
+ documented_settings = File.read("../man/bundle-config.ronn").scan(/^* `#{key_pattern}`/).flatten
+ end
+
+ documented_settings.each {|s| all_settings.delete(s) }
+ exemptions.each {|s| all_settings.delete(s) }
+ error_messages = all_settings.map do |setting, refs|
+ "The `#{setting}` setting is undocumented\n\t- #{refs.join("\n\t- ")}"
+ end
+
+ expect(error_messages.sort).to be_well_formed
+ end
+
it "can still be built" do
Dir.chdir(root) do
begin