diff options
| author | Alyssa Ross | 2017-01-22 20:54:37 +0000 |
|---|---|---|
| committer | Alyssa Ross | 2017-01-22 20:54:37 +0000 |
| commit | 19e61355b38b8ba96db0ca71849bb536af0490bf (patch) | |
| tree | 09e345fcde85263b2635a1e670f953abe2dc4a92 /Library/Homebrew/test | |
| parent | b53ce62ffb193748266c63d7b13fd023c0764ff0 (diff) | |
| download | brew-19e61355b38b8ba96db0ca71849bb536af0490bf.tar.bz2 | |
tests: remove with_git_env method
A common git environment is now used in all tests, so this is no longer
required.
Diffstat (limited to 'Library/Homebrew/test')
| -rw-r--r-- | Library/Homebrew/test/download_strategies_test.rb | 40 | ||||
| -rw-r--r-- | Library/Homebrew/test/formula_test.rb | 28 | ||||
| -rw-r--r-- | Library/Homebrew/test/install_test.rb | 18 | ||||
| -rw-r--r-- | Library/Homebrew/test/support/helper/env.rb | 12 | ||||
| -rw-r--r-- | Library/Homebrew/test/tap_test.rb | 14 |
5 files changed, 43 insertions, 69 deletions
diff --git a/Library/Homebrew/test/download_strategies_test.rb b/Library/Homebrew/test/download_strategies_test.rb index 3c4272c74..40236b420 100644 --- a/Library/Homebrew/test/download_strategies_test.rb +++ b/Library/Homebrew/test/download_strategies_test.rb @@ -158,15 +158,13 @@ class GitDownloadStrategyTests < Homebrew::TestCase end def setup_git_repo - using_git_env do - @cached_location.cd do - shutup do - system "git", "init" - system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" - end - touch "README" - git_commit_all + @cached_location.cd do + shutup do + system "git", "init" + system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" end + touch "README" + git_commit_all end end @@ -185,11 +183,9 @@ class GitDownloadStrategyTests < Homebrew::TestCase def test_last_commit setup_git_repo - using_git_env do - @cached_location.cd do - touch "LICENSE" - git_commit_all - end + @cached_location.cd do + touch "LICENSE" + git_commit_all end assert_equal "f68266e", @strategy.last_commit end @@ -202,17 +198,15 @@ class GitDownloadStrategyTests < Homebrew::TestCase resource.instance_variable_set(:@version, Version.create("HEAD")) @strategy = GitDownloadStrategy.new("baz", resource) - using_git_env do - remote_repo.cd do - shutup do - system "git", "init" - system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" - end - touch "README" - git_commit_all - touch "LICENSE" - git_commit_all + remote_repo.cd do + shutup do + system "git", "init" + system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" end + touch "README" + git_commit_all + touch "LICENSE" + git_commit_all end @strategy.shutup! diff --git a/Library/Homebrew/test/formula_test.rb b/Library/Homebrew/test/formula_test.rb index b06111370..ecdd1847b 100644 --- a/Library/Homebrew/test/formula_test.rb +++ b/Library/Homebrew/test/formula_test.rb @@ -533,14 +533,12 @@ class FormulaTests < Homebrew::TestCase cached_location = f.head.downloader.cached_location cached_location.mkpath - using_git_env do - cached_location.cd do - FileUtils.touch "LICENSE" - shutup do - system "git", "init" - system "git", "add", "--all" - system "git", "commit", "-m", "Initial commit" - end + cached_location.cd do + FileUtils.touch "LICENSE" + shutup do + system "git", "init" + system "git", "add", "--all" + system "git", "commit", "-m", "Initial commit" end end @@ -1105,14 +1103,12 @@ class OutdatedVersionsTests < Homebrew::TestCase head "file://#{testball_repo}", using: :git end - using_git_env do - testball_repo.cd do - FileUtils.touch "LICENSE" - shutup do - system "git", "init" - system "git", "add", "--all" - system "git", "commit", "-m", "Initial commit" - end + testball_repo.cd do + FileUtils.touch "LICENSE" + shutup do + system "git", "init" + system "git", "add", "--all" + system "git", "commit", "-m", "Initial commit" end end diff --git a/Library/Homebrew/test/install_test.rb b/Library/Homebrew/test/install_test.rb index 3f3df6099..da6c1863f 100644 --- a/Library/Homebrew/test/install_test.rb +++ b/Library/Homebrew/test/install_test.rb @@ -76,16 +76,14 @@ class IntegrationCommandTestInstall < IntegrationCommandTestCase repo_path = HOMEBREW_CACHE.join("repo") repo_path.join("bin").mkpath - using_git_env do - repo_path.cd do - shutup do - system "git", "init" - system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" - FileUtils.touch "bin/something.bin" - FileUtils.touch "README" - system "git", "add", "--all" - system "git", "commit", "-m", "Initial repo commit" - end + repo_path.cd do + shutup do + system "git", "init" + system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" + FileUtils.touch "bin/something.bin" + FileUtils.touch "README" + system "git", "add", "--all" + system "git", "commit", "-m", "Initial repo commit" end end diff --git a/Library/Homebrew/test/support/helper/env.rb b/Library/Homebrew/test/support/helper/env.rb index 7958a041e..88b25e237 100644 --- a/Library/Homebrew/test/support/helper/env.rb +++ b/Library/Homebrew/test/support/helper/env.rb @@ -16,18 +16,6 @@ module Test ensure restore_env old end - - def using_git_env - git_env = ["AUTHOR", "COMMITTER"].each_with_object({}) do |role, env| - env["GIT_#{role}_NAME"] = "brew tests" - env["GIT_#{role}_EMAIL"] = "brew-tests@localhost" - env["GIT_#{role}_DATE"] = "Sun Jan 22 19:59:13 2017 +0000" - end - - with_environment(git_env) do - yield - end - end end end end diff --git a/Library/Homebrew/test/tap_test.rb b/Library/Homebrew/test/tap_test.rb index a268ab0ae..9979be43d 100644 --- a/Library/Homebrew/test/tap_test.rb +++ b/Library/Homebrew/test/tap_test.rb @@ -66,14 +66,12 @@ class TapTest < Homebrew::TestCase end def setup_git_repo - using_git_env do - @path.cd do - shutup do - system "git", "init" - system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" - system "git", "add", "--all" - system "git", "commit", "-m", "init" - end + @path.cd do + shutup do + system "git", "init" + system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo" + system "git", "add", "--all" + system "git", "commit", "-m", "init" end end end |
