Separate tap tests into separate, correct files.

This commit is contained in:
Mike McQuaid 2019-03-26 09:49:13 +00:00
parent aa44509be9
commit 1e5cfcc028
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
5 changed files with 66 additions and 79 deletions

View File

@ -0,0 +1,21 @@
require "cmd/shared_examples/args_parse"
describe "Homebrew.tap_info_args" do
it_behaves_like "parseable arguments"
end
describe "brew tap-info", :integration_test do
it "gets information for a given Tap" do
setup_test_tap
expect { brew "tap-info", "homebrew/foo" }
.to output(%r{https://github\.com/Homebrew/homebrew-foo}).to_stdout
.and not_to_output.to_stderr
.and be_a_success
expect { brew "tap-info", "--json=v1", "--installed" }
.to output(%r{https://github\.com/Homebrew/homebrew-foo}).to_stdout
.and not_to_output.to_stderr
.and be_a_success
end
end

View File

@ -0,0 +1,16 @@
require "cmd/shared_examples/args_parse"
describe "Homebrew.tap_args" do
it_behaves_like "parseable arguments"
end
describe "brew tap", :integration_test do
it "taps a given Tap" do
path = setup_test_tap
expect { brew "tap", "--force-auto-update", "--full", "homebrew/bar", path/".git" }
.to output(/Tapped/).to_stdout
.and output(/Cloning/).to_stderr
.and be_a_success
end
end

View File

@ -0,0 +1,16 @@
require "cmd/shared_examples/args_parse"
describe "Homebrew.untap_args" do
it_behaves_like "parseable arguments"
end
describe "brew untap", :integration_test do
it "untaps a given Tap" do
setup_test_tap
expect { brew "untap", "homebrew/foo" }
.to output(/Untapped/).to_stdout
.and not_to_output.to_stderr
.and be_a_success
end
end

View File

@ -1,79 +0,0 @@
require "cmd/shared_examples/args_parse"
describe "Homebrew.tap_args" do
it_behaves_like "parseable arguments"
end
describe "brew tap", :integration_test do
it "taps a given Tap" do
path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
path.mkpath
path.cd do
system "git", "init"
system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo"
FileUtils.touch "readme"
system "git", "add", "--all"
system "git", "commit", "-m", "init"
end
expect { brew "tap" }
.to output(%r{homebrew/foo}).to_stdout
.and not_to_output.to_stderr
.and be_a_success
expect { brew "tap-info" }
.to output(/2 taps/).to_stdout
.and not_to_output.to_stderr
.and be_a_success
expect { brew "tap-info", "homebrew/foo" }
.to output(%r{https://github\.com/Homebrew/homebrew-foo}).to_stdout
.and not_to_output.to_stderr
.and be_a_success
expect { brew "tap-info", "--json=v1", "--installed" }
.to output(%r{https://github\.com/Homebrew/homebrew-foo}).to_stdout
.and not_to_output.to_stderr
.and be_a_success
expect { brew "tap-pin", "homebrew/foo" }
.to output(%r{Pinned homebrew/foo}).to_stdout
.and not_to_output.to_stderr
.and be_a_success
expect { brew "tap", "--list-pinned" }
.to output(%r{homebrew/foo}).to_stdout
.and not_to_output.to_stderr
.and be_a_success
expect { brew "tap-unpin", "homebrew/foo" }
.to output(%r{Unpinned homebrew/foo}).to_stdout
.and not_to_output.to_stderr
.and be_a_success
expect { brew "tap", "homebrew/bar", path/".git" }
.to output(/Tapped/).to_stdout
.and output(/Cloning/).to_stderr
.and be_a_success
expect { brew "untap", "homebrew/bar" }
.to output(/Untapped/).to_stdout
.and not_to_output.to_stderr
.and be_a_success
expect { brew "tap", "--force-auto-update", "homebrew/bar", path/".git" }
.to output(/Tapped/).to_stdout
.and output(/Cloning/).to_stderr
.and be_a_success
expect { brew "untap", "homebrew/bar" }
.to output(/Untapped/).to_stdout
.and not_to_output.to_stderr
.and be_a_success
expect { brew "tap", "homebrew/bar", path/".git", "-q", "--full" }
.to be_a_success
.and not_to_output.to_stdout
.and not_to_output.to_stderr
end
end

View File

@ -184,6 +184,19 @@ RSpec.shared_context "integration test" do
fi.finish
end
def setup_test_tap
path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
path.mkpath
path.cd do
system "git", "init"
system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo"
FileUtils.touch "readme"
system "git", "add", "--all"
system "git", "commit", "-m", "init"
end
path
end
def setup_remote_tap(name)
Tap.fetch(name).tap do |tap|
next if tap.installed?