diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-09 23:21:36 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-09 23:21:36 +0000 |
commit | 47f0248b0858898dd24d1e654cedf174059ca677 (patch) | |
tree | 493e84160f8609db408d88349f0624a3ff92c3c2 /test/rubygems/test_gem_commands_owner_command.rb | |
parent | cd9f9e471977447a991ced4ea38efb2309459ef5 (diff) | |
download | ruby-47f0248b0858898dd24d1e654cedf174059ca677.tar.gz |
* lib/rubygems: Import RubyGems 2.1
* test/rubygems: Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_commands_owner_command.rb')
-rw-r--r-- | test/rubygems/test_gem_commands_owner_command.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_owner_command.rb b/test/rubygems/test_gem_commands_owner_command.rb index dfbc2572dc..5d7b66137e 100644 --- a/test/rubygems/test_gem_commands_owner_command.rb +++ b/test/rubygems/test_gem_commands_owner_command.rb @@ -6,6 +6,7 @@ class TestGemCommandsOwnerCommand < Gem::TestCase def setup super + ENV["RUBYGEMS_HOST"] = nil @fetcher = Gem::FakeFetcher.new Gem::RemoteFetcher.fetcher = @fetcher Gem.configuration.rubygems_api_key = "ed244fbf2b1a52e012da8616c512fa47f9aa5250" @@ -34,6 +35,36 @@ EOF assert_match %r{- user2@example.com}, @ui.output end + def test_show_owners_setting_up_host_through_env_var + response = "- email: user1@example.com\n" + host = "http://rubygems.example" + ENV["RUBYGEMS_HOST"] = host + + @fetcher.data["#{host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, 'OK'] + + use_ui @ui do + @cmd.show_owners("freewill") + end + + assert_match %r{Owners for gem: freewill}, @ui.output + assert_match %r{- user1@example.com}, @ui.output + end + + def test_show_owners_setting_up_host + response = "- email: user1@example.com\n" + host = "http://rubygems.example" + @cmd.host = host + + @fetcher.data["#{host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, 'OK'] + + use_ui @ui do + @cmd.show_owners("freewill") + end + + assert_match %r{Owners for gem: freewill}, @ui.output + assert_match %r{- user1@example.com}, @ui.output + end + def test_show_owners_denied response = "You don't have permission to push to this gem" @fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners.yaml"] = [response, 403, 'Forbidden'] @@ -87,6 +118,24 @@ EOF assert_match response, @ui.output end + def test_add_owner_with_host_option_through_execute + host = "http://rubygems.example" + add_owner_response = "Owner added successfully." + show_owners_response = "- email: user1@example.com\n" + @fetcher.data["#{host}/api/v1/gems/freewill/owners"] = [add_owner_response, 200, 'OK'] + @fetcher.data["#{host}/api/v1/gems/freewill/owners.yaml"] = [show_owners_response, 200, 'OK'] + + @cmd.handle_options %W[--host #{host} --add user-new1@example.com freewill] + + use_ui @ui do + @cmd.execute + end + + assert_match add_owner_response, @ui.output + assert_match %r{Owners for gem: freewill}, @ui.output + assert_match %r{- user1@example.com}, @ui.output + end + def test_add_owners_key response = "Owner added successfully." @fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners"] = [response, 200, 'OK'] |