diff --git a/Library/Homebrew/test/cmd/tap-info_spec.rb b/Library/Homebrew/test/cmd/tap-info_spec.rb new file mode 100644 index 0000000000..63be08da46 --- /dev/null +++ b/Library/Homebrew/test/cmd/tap-info_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cmd/tap_spec.rb b/Library/Homebrew/test/cmd/tap_spec.rb new file mode 100644 index 0000000000..d635c903be --- /dev/null +++ b/Library/Homebrew/test/cmd/tap_spec.rb @@ -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 diff --git a/Library/Homebrew/test/cmd/untap_spec.rb b/Library/Homebrew/test/cmd/untap_spec.rb new file mode 100644 index 0000000000..caef63c58b --- /dev/null +++ b/Library/Homebrew/test/cmd/untap_spec.rb @@ -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 diff --git a/Library/Homebrew/test/dev-cmd/tap_spec.rb b/Library/Homebrew/test/dev-cmd/tap_spec.rb deleted file mode 100644 index 86fd6e0398..0000000000 --- a/Library/Homebrew/test/dev-cmd/tap_spec.rb +++ /dev/null @@ -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 diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb index 1f6844b3d4..902204e1d8 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb @@ -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?