summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-08-15 16:59:08 +0200
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-08-16 08:43:50 +0200
commit028dc46f5ae617463013898a8155b2eeed2bd797 (patch)
tree9f71b081b44200b95e32c8484496110265e2086a
parent314c64cd07ccc5541506923b1922097257b8d4c9 (diff)
downloadbundler-028dc46f5ae617463013898a8155b2eeed2bd797.tar.gz
Extract a `lib_tracked_files` path helper
-rw-r--r--spec/quality_spec.rb4
-rw-r--r--spec/support/path.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb
index 922a99480c..85d0084e9a 100644
--- a/spec/quality_spec.rb
+++ b/spec/quality_spec.rb
@@ -170,7 +170,6 @@ RSpec.describe "The library itself" do
error_messages = []
exempt = /vendor|vcr_cassettes/
Dir.chdir(root) do
- lib_tracked_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib`
lib_tracked_files.split("\x0").each do |filename|
next if filename =~ exempt
error_messages << check_for_expendable_words(filename)
@@ -200,7 +199,6 @@ RSpec.describe "The library itself" do
Dir.chdir(root) do
key_pattern = /([a-z\._-]+)/i
- lib_tracked_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib`
lib_tracked_files.split("\x0").each do |filename|
each_line(filename) do |line, number|
line.scan(/Bundler\.settings\[:#{key_pattern}\]/).flatten.each {|s| all_settings[s] << "referenced at `#{filename}:#{number.succ}`" }
@@ -267,7 +265,6 @@ RSpec.describe "The library itself" do
lib/bundler/vlad.rb
lib/bundler/templates/gems.rb
]
- lib_tracked_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib`
files_to_require = lib_tracked_files.split("\x0").grep(/\.rb$/) - exclusions
files_to_require.reject! {|f| f.start_with?("lib/bundler/vendor") }
files_to_require.map! {|f| f.chomp(".rb") }
@@ -289,7 +286,6 @@ RSpec.describe "The library itself" do
Dir.chdir(root) do
exempt = %r{templates/|vendor/}
all_bad_requires = []
- lib_tracked_files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib`
lib_tracked_files.split("\x0").each do |filename|
next if filename =~ exempt
each_line(filename) do |line, number|
diff --git a/spec/support/path.rb b/spec/support/path.rb
index 70ce645c0a..3b18cd2da8 100644
--- a/spec/support/path.rb
+++ b/spec/support/path.rb
@@ -29,6 +29,10 @@ module Spec
@tracked_files ||= ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler` : `git ls-files -z`
end
+ def lib_tracked_files
+ @lib_tracked_files ||= ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb` : `git ls-files -z -- lib`
+ end
+
def tmp(*path)
root.join("tmp", *path)
end