diff options
Diffstat (limited to 'spec/bundler')
-rw-r--r-- | spec/bundler/bundler/source/git/git_proxy_spec.rb | 16 | ||||
-rw-r--r-- | spec/bundler/commands/exec_spec.rb | 10 | ||||
-rw-r--r-- | spec/bundler/commands/help_spec.rb | 16 | ||||
-rw-r--r-- | spec/bundler/quality_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/support/path.rb | 6 |
5 files changed, 27 insertions, 23 deletions
diff --git a/spec/bundler/bundler/source/git/git_proxy_spec.rb b/spec/bundler/bundler/source/git/git_proxy_spec.rb index 4744e0cd4c..35702d7763 100644 --- a/spec/bundler/bundler/source/git/git_proxy_spec.rb +++ b/spec/bundler/bundler/source/git/git_proxy_spec.rb @@ -11,21 +11,21 @@ RSpec.describe Bundler::Source::Git::GitProxy do context "with configured credentials" do it "adds username and password to URI" do Bundler.settings.temporary(uri => "u:p") do - expect(subject).to receive(:git_retry).with(match("https://u:[email protected]/rubygems/rubygems.git")) + expect(subject).to receive(:git_retry).with("clone", "https://u:[email protected]/rubygems/rubygems.git", any_args) subject.checkout end end it "adds username and password to URI for host" do Bundler.settings.temporary("github.com" => "u:p") do - expect(subject).to receive(:git_retry).with(match("https://u:[email protected]/rubygems/rubygems.git")) + expect(subject).to receive(:git_retry).with("clone", "https://u:[email protected]/rubygems/rubygems.git", any_args) subject.checkout end end it "does not add username and password to mismatched URI" do Bundler.settings.temporary("https://u:[email protected]/rubygems/rubygems-mismatch.git" => "u:p") do - expect(subject).to receive(:git_retry).with(match(uri)) + expect(subject).to receive(:git_retry).with("clone", uri, any_args) subject.checkout end end @@ -34,7 +34,7 @@ RSpec.describe Bundler::Source::Git::GitProxy do Bundler.settings.temporary("github.com" => "u:p") do original = "https://orig:[email protected]/rubygems/rubygems.git" subject = described_class.new(Pathname("path"), original, "HEAD") - expect(subject).to receive(:git_retry).with(match(original)) + expect(subject).to receive(:git_retry).with("clone", original, any_args) subject.checkout end end @@ -129,12 +129,12 @@ RSpec.describe Bundler::Source::Git::GitProxy do context "when given a SHA as a revision" do let(:revision) { "abcd" * 10 } - let(:command) { "reset --hard #{revision}" } + let(:command) { ["reset", "--hard", revision] } it "fails gracefully when resetting to the revision fails" do - expect(subject).to receive(:git_retry).with(start_with("clone ")) { destination.mkpath } - expect(subject).to receive(:git_retry).with(start_with("fetch "), :dir => destination) - expect(subject).to receive(:git).with(command, :dir => destination).and_raise(Bundler::Source::Git::GitCommandError.new(command, cache, destination)) + expect(subject).to receive(:git_retry).with("clone", any_args) { destination.mkpath } + expect(subject).to receive(:git_retry).with("fetch", any_args, :dir => destination) + expect(subject).to receive(:git).with(*command, :dir => destination).and_raise(Bundler::Source::Git::GitCommandError.new(command, cache, destination)) expect(subject).not_to receive(:git) expect { subject.copy_to(destination, submodules) }. diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb index 1449bb642e..5d43586116 100644 --- a/spec/bundler/commands/exec_spec.rb +++ b/spec/bundler/commands/exec_spec.rb @@ -448,35 +448,35 @@ RSpec.describe "bundle exec" do with_fake_man do bundle "#{exec} --help cat" end - expect(out).to include(%(["#{root}/man/bundle-exec.1"])) + expect(out).to include(%(["#{man_dir}/bundle-exec.1"])) end it "shows bundle-exec's man page when --help is before exec" do with_fake_man do bundle "--help #{exec}" end - expect(out).to include(%(["#{root}/man/bundle-exec.1"])) + expect(out).to include(%(["#{man_dir}/bundle-exec.1"])) end it "shows bundle-exec's man page when -h is before exec" do with_fake_man do bundle "-h #{exec}" end - expect(out).to include(%(["#{root}/man/bundle-exec.1"])) + expect(out).to include(%(["#{man_dir}/bundle-exec.1"])) end it "shows bundle-exec's man page when --help is after exec" do with_fake_man do bundle "#{exec} --help" end - expect(out).to include(%(["#{root}/man/bundle-exec.1"])) + expect(out).to include(%(["#{man_dir}/bundle-exec.1"])) end it "shows bundle-exec's man page when -h is after exec" do with_fake_man do bundle "#{exec} -h" end - expect(out).to include(%(["#{root}/man/bundle-exec.1"])) + expect(out).to include(%(["#{man_dir}/bundle-exec.1"])) end end end diff --git a/spec/bundler/commands/help_spec.rb b/spec/bundler/commands/help_spec.rb index 03d34ef692..f72763900e 100644 --- a/spec/bundler/commands/help_spec.rb +++ b/spec/bundler/commands/help_spec.rb @@ -5,14 +5,14 @@ RSpec.describe "bundle help" do with_fake_man do bundle "help gemfile" end - expect(out).to eq(%(["#{root}/man/gemfile.5"])) + expect(out).to eq(%(["#{man_dir}/gemfile.5"])) end it "prefixes bundle commands with bundle- when finding the man files" do with_fake_man do bundle "help install" end - expect(out).to eq(%(["#{root}/man/bundle-install.1"])) + expect(out).to eq(%(["#{man_dir}/bundle-install.1"])) end it "simply outputs the human readable file when there is no man on the path" do @@ -45,28 +45,28 @@ RSpec.describe "bundle help" do with_fake_man do bundle "install --help" end - expect(out).to eq(%(["#{root}/man/bundle-install.1"])) + expect(out).to eq(%(["#{man_dir}/bundle-install.1"])) end it "is called when the --help flag is used before the command" do with_fake_man do bundle "--help install" end - expect(out).to eq(%(["#{root}/man/bundle-install.1"])) + expect(out).to eq(%(["#{man_dir}/bundle-install.1"])) end it "is called when the -h flag is used before the command" do with_fake_man do bundle "-h install" end - expect(out).to eq(%(["#{root}/man/bundle-install.1"])) + expect(out).to eq(%(["#{man_dir}/bundle-install.1"])) end it "is called when the -h flag is used after the command" do with_fake_man do bundle "install -h" end - expect(out).to eq(%(["#{root}/man/bundle-install.1"])) + expect(out).to eq(%(["#{man_dir}/bundle-install.1"])) end it "has helpful output when using --help flag for a non-existent command" do @@ -80,11 +80,11 @@ RSpec.describe "bundle help" do with_fake_man do bundle "--help" end - expect(out).to eq(%(["#{root}/man/bundle.1"])) + expect(out).to eq(%(["#{man_dir}/bundle.1"])) with_fake_man do bundle "-h" end - expect(out).to eq(%(["#{root}/man/bundle.1"])) + expect(out).to eq(%(["#{man_dir}/bundle.1"])) end end diff --git a/spec/bundler/quality_spec.rb b/spec/bundler/quality_spec.rb index 808f0502a4..405c786842 100644 --- a/spec/bundler/quality_spec.rb +++ b/spec/bundler/quality_spec.rb @@ -249,7 +249,7 @@ RSpec.describe "The library itself" do end it "does not use require internally, but require_relative" do - exempt = %r{templates/|man/|vendor/} + exempt = %r{templates/|\.5|\.1|vendor/} all_bad_requires = [] lib_tracked_files.each do |filename| next if filename =~ exempt diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb index 305ea0a876..56d3c71f3c 100644 --- a/spec/bundler/support/path.rb +++ b/spec/bundler/support/path.rb @@ -63,6 +63,10 @@ module Spec @spec_dir ||= source_root.join(ruby_core? ? "spec/bundler" : "spec") end + def man_dir + @man_dir ||= lib_dir.join("bundler/man") + end + def tracked_files @tracked_files ||= git_ls_files(tracked_files_glob) end @@ -236,7 +240,7 @@ module Spec end def man_tracked_files_glob - ruby_core? ? "man/bundle* man/gemfile*" : "man" + ruby_core? ? "man/bundle* man/gemfile*" : "lib/bundler/man/bundle*.1 lib/bundler/man/gemfile*.5" end def git_root |