summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRyan Davis <ryand-ruby@zenspider.com>2022-08-17 23:10:10 -0800
committerRyan Davis <ryand-ruby@zenspider.com>2022-08-17 23:10:10 -0800
commit696fd98ffb3eeae166d11c24396ef8c3367ad966 (patch)
treec051c7b0258df082966bb329d819c690112a672b /test
parent365edd63a3eb85b74f003d0a5f12286ab2d4d97d (diff)
downloadhoe-696fd98ffb3eeae166d11c24396ef8c3367ad966.tar.gz
+ Added otp_command config option for OTP auth on gem push.
This sets $GEM_HOST_OTP_CODE to the output of the command. eg: otp_command: "op item get rubygems.org --otp" This will be used by rake release if defined. [git-p4: depot-paths = "//src/hoe/dev/": change = 13514]
Diffstat (limited to 'test')
-rw-r--r--test/test_hoe_gemcutter.rb25
1 files changed, 24 insertions, 1 deletions
diff --git a/test/test_hoe_gemcutter.rb b/test/test_hoe_gemcutter.rb
index 82d2b7c..f7ca4c7 100644
--- a/test/test_hoe_gemcutter.rb
+++ b/test/test_hoe_gemcutter.rb
@@ -11,5 +11,28 @@ class TestHoeGemcutter < Minitest::Test
assert Rake::Task[:release_to].prerequisites.include?("release_to_gemcutter")
end
- # TODO add tests for push once using Gem::Commands::Push (waiting on rubygems release)
+ def sh *cmd_args
+ @cmd_args = cmd_args
+ end
+
+ def with_config
+ yield({ "otp_command" => "echo my_otp_code"}, "~/.hoerc")
+ end
+
+ def save_env
+ orig_env = ENV.to_h
+ yield
+ ensure
+ ENV.replace orig_env
+ end
+
+ def test_gem_push
+ save_env do
+ gem_push %w[pkg/blah-123.gem]
+
+ exp = %W[#{Gem.ruby} -S gem push pkg/blah-123.gem]
+ assert_equal exp, @cmd_args
+ assert_equal "my_otp_code", ENV["GEM_HOST_OTP_CODE"]
+ end
+ end
end