Merge pull request #2145 from reitermarkus/spec-tap
Convert `brew tap` test to spec.
This commit is contained in:
commit
1d81375978
75
Library/Homebrew/test/dev-cmd/tap_spec.rb
Normal file
75
Library/Homebrew/test/dev-cmd/tap_spec.rb
Normal file
@ -0,0 +1,75 @@
|
||||
describe "brew tap", :integration_test do
|
||||
it "taps a given Tap" do
|
||||
path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
|
||||
path.mkpath
|
||||
path.cd do
|
||||
shutup 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
|
||||
end
|
||||
|
||||
expect { brew "tap" }
|
||||
.to output(%r{homebrew/foo}).to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
.and be_a_success
|
||||
|
||||
expect { brew "tap", "--list-official" }
|
||||
.to output(%r{homebrew/science}).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", "homebrew/bar", path/".git", "-q", "--full" }
|
||||
.to be_a_success
|
||||
.and not_to_output.to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
|
||||
expect { brew "untap", "homebrew/bar" }
|
||||
.to output(/Untapped/).to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
.and be_a_success
|
||||
end
|
||||
end
|
||||
@ -1,34 +1,4 @@
|
||||
require "testing_env"
|
||||
require "testing_env"
|
||||
|
||||
class IntegrationCommandTestTap < IntegrationCommandTestCase
|
||||
def test_tap
|
||||
path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
|
||||
path.mkpath
|
||||
path.cd do
|
||||
shutup 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
|
||||
end
|
||||
|
||||
assert_match "homebrew/foo", cmd("tap")
|
||||
assert_match "homebrew/science", cmd("tap", "--list-official")
|
||||
assert_match "2 taps", cmd("tap-info")
|
||||
assert_match "https://github.com/Homebrew/homebrew-foo", cmd("tap-info", "homebrew/foo")
|
||||
assert_match "https://github.com/Homebrew/homebrew-foo", cmd("tap-info", "--json=v1", "--installed")
|
||||
assert_match "Pinned homebrew/foo", cmd("tap-pin", "homebrew/foo")
|
||||
assert_match "homebrew/foo", cmd("tap", "--list-pinned")
|
||||
assert_match "Unpinned homebrew/foo", cmd("tap-unpin", "homebrew/foo")
|
||||
assert_match "Tapped", cmd("tap", "homebrew/bar", path/".git")
|
||||
assert_match "Untapped", cmd("untap", "homebrew/bar")
|
||||
assert_equal "", cmd("tap", "homebrew/bar", path/".git", "-q", "--full")
|
||||
assert_match "Untapped", cmd("untap", "homebrew/bar")
|
||||
end
|
||||
end
|
||||
|
||||
class TapTest < Homebrew::TestCase
|
||||
include FileUtils
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user