From 6e0f1366b014b285799c9bb9c311c6345bcd666b Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sat, 21 Jan 2017 14:56:58 +0000 Subject: tests: extract a common using_git_env method --- Library/Homebrew/test/install_test.rb | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'Library/Homebrew/test/install_test.rb') diff --git a/Library/Homebrew/test/install_test.rb b/Library/Homebrew/test/install_test.rb index fa0ef5ffe..2ca5bf4ca 100644 --- a/Library/Homebrew/test/install_test.rb +++ b/Library/Homebrew/test/install_test.rb @@ -73,24 +73,19 @@ class IntegrationCommandTestInstall < IntegrationCommandTestCase end def test_install_head_installed - initial_env = ENV.to_hash - %w[AUTHOR COMMITTER].each do |role| - ENV["GIT_#{role}_NAME"] = "brew tests" - ENV["GIT_#{role}_EMAIL"] = "brew-tests@localhost" - ENV["GIT_#{role}_DATE"] = "Thu May 21 00:04:11 2009 +0100" - end - repo_path = HOMEBREW_CACHE.join("repo") repo_path.join("bin").mkpath - 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" + 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 end end @@ -110,9 +105,6 @@ class IntegrationCommandTestInstall < IntegrationCommandTestCase cmd("install", "testball1", "--HEAD", "--ignore-dependencies") assert_match "#{HOMEBREW_CELLAR}/testball1/HEAD-2ccdf4f", cmd("unlink", "testball1") assert_match "#{HOMEBREW_CELLAR}/testball1/1.0", cmd("install", "testball1") - - ensure - ENV.replace(initial_env) end def test_install_with_invalid_option -- cgit v1.2.3 From b53ce62ffb193748266c63d7b13fd023c0764ff0 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 22 Jan 2017 20:45:15 +0000 Subject: tests: use more recent git committer date This will allow the `brew bundle` test to use the default git environment. --- Library/Homebrew/test/install_test.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Library/Homebrew/test/install_test.rb') diff --git a/Library/Homebrew/test/install_test.rb b/Library/Homebrew/test/install_test.rb index 2ca5bf4ca..3f3df6099 100644 --- a/Library/Homebrew/test/install_test.rb +++ b/Library/Homebrew/test/install_test.rb @@ -100,10 +100,10 @@ class IntegrationCommandTestInstall < IntegrationCommandTestCase # Ignore dependencies, because we'll try to resolve requirements in build.rb # and there will be the git requirement, but we cannot instantiate git # formula since we only have testball1 formula. - assert_match "#{HOMEBREW_CELLAR}/testball1/HEAD-2ccdf4f", cmd("install", "testball1", "--HEAD", "--ignore-dependencies") - assert_match "testball1-HEAD-2ccdf4f already installed", + assert_match "#{HOMEBREW_CELLAR}/testball1/HEAD-d5eb689", cmd("install", "testball1", "--HEAD", "--ignore-dependencies") + assert_match "testball1-HEAD-d5eb689 already installed", cmd("install", "testball1", "--HEAD", "--ignore-dependencies") - assert_match "#{HOMEBREW_CELLAR}/testball1/HEAD-2ccdf4f", cmd("unlink", "testball1") + assert_match "#{HOMEBREW_CELLAR}/testball1/HEAD-d5eb689", cmd("unlink", "testball1") assert_match "#{HOMEBREW_CELLAR}/testball1/1.0", cmd("install", "testball1") end -- cgit v1.2.3 From 19e61355b38b8ba96db0ca71849bb536af0490bf Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 22 Jan 2017 20:54:37 +0000 Subject: tests: remove with_git_env method A common git environment is now used in all tests, so this is no longer required. --- Library/Homebrew/test/install_test.rb | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'Library/Homebrew/test/install_test.rb') 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 -- cgit v1.2.3