diff options
| author | Martin Afanasjew | 2016-06-14 14:58:11 +0200 |
|---|---|---|
| committer | GitHub | 2016-06-14 14:58:11 +0200 |
| commit | 8a70b000e55dbeadf2372b1c75360ca837219605 (patch) | |
| tree | fabee09941c58f5a84c8f62dcbce5122c28fddab | |
| parent | 86538c9d6ac6fb898a6b2bba30239acc5eabf96c (diff) | |
| download | brew-8a70b000e55dbeadf2372b1c75360ca837219605.tar.bz2 | |
tests: fix problems in 'log with formula' test (#350)
Problems fixed:
- Broken and leaking test if run as part of `brew tests --coverage` due
to the `cmd` call being nested in the `Pathname#cd` block.
- Output during `git clone` operation because of a missing `shutup do`.
- Still incomplete coverage for `cmd/log.rb` because `brew log` is
invoked on the formula in the origin instead of the shallow clone.
- Minor stylistic fixes:
- Superfluous parentheses around `core_tap.path.dirname`.
- Overly long lines.
| -rw-r--r-- | Library/Homebrew/test/test_integration_cmds.rb | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb index 2640e2df6..4147ff87a 100644 --- a/Library/Homebrew/test/test_integration_cmds.rb +++ b/Library/Homebrew/test/test_integration_cmds.rb @@ -717,19 +717,20 @@ class IntegrationCommandTests < Homebrew::TestCase end end - homebrew_core_clone = Pathname.new core_tap.path.dirname/"homebrew-core-clone" - shallow = Pathname.new homebrew_core_clone/".git/shallow" - - (core_tap.path.dirname).cd do - system "git", "clone", "--depth=1", "file://#{core_tap.path}", "homebrew-core-clone" - - assert_match "This is a test commit for Testball", cmd("log", "testball") - assert_predicate shallow, :exist?, "A shallow clone should have been created." + core_tap_url = "file://#{core_tap.path}" + shallow_tap = Tap.fetch("homebrew", "shallow") + shutup do + system "git", "clone", "--depth=1", core_tap_url, shallow_tap.path end + + assert_match "This is a test commit for Testball", + cmd("log", "#{shallow_tap}/testball") + assert_predicate shallow_tap.path/".git/shallow", :exist?, + "A shallow clone should have been created." ensure formula_file.unlink (core_tap.path/".git").rmtree - (core_tap.path.dirname/"homebrew-core-clone").rmtree + shallow_tap.path.rmtree end def test_leaves |
