keycutter 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,3 @@
1
- @fakeweb
2
-
3
1
  Feature: Adding keys
4
2
  As a developer
5
3
  I want to add an API key
@@ -10,9 +8,9 @@ Feature: Adding keys
10
8
  When I run "gem keys <command> <key>" interactively
11
9
  And I type "josh@vitamin-j.com"
12
10
  And I type "12345"
13
- Then the output should contain "Added <key> rubygems API key"
14
- And I should have a "<key>" rubygems key
15
- And the "<key>" rubygems key should be the response body
11
+ Then the output should contain "Added <key> API key"
12
+ And I should have a "<key>" api key
13
+ And the "<key>" api key should be the response body
16
14
 
17
15
  Examples:
18
16
  |command|key |
@@ -25,4 +23,14 @@ Feature: Adding keys
25
23
  And I type "josh@vitamin-j.com"
26
24
  And I type "12345"
27
25
  Then the output should contain "Access denied"
28
- And I should not have a "bogus" rubygems key
26
+ And I should not have a "bogus" api key
27
+
28
+ @1.4
29
+ Scenario: Adding a key from a compatible host
30
+ Given a gemcutter host at "https://nubygems.org"
31
+ And a valid gemcutter account
32
+ When I run "gem keys --add personal --host https://nubygems.org" interactively
33
+ And I type "josh@vitamin-j.com"
34
+ And I type "12345"
35
+ Then the output should contain "Enter your nubygems.org credentials"
36
+ And the "personal" api key should be the response body
@@ -1,47 +1,29 @@
1
- Feature: Default commands
2
- As a new user
3
- I want to find out what my options are
4
- So I can put keycutter to best use
1
+ Feature: Using gem keys
2
+ As an open source developer
3
+ I want to switch between rubygems API keys
4
+ In order to push all of my sweet gems
5
5
 
6
- Scenario: Installing the gem
7
- When I run "gem q"
8
- Then the output should contain "keycutter"
9
-
10
- Scenario: Calling the plugin with no options
11
- Given I have the following rubygems keys:
6
+ Background:
7
+ Given I have the following api keys:
12
8
  |name |key |
13
9
  |personal|11111111111111111111111111111111|
14
10
  |work |22222222222222222222222222222222|
15
- |oss_1 |33333333333333333333333333333333|
16
- |oss_2 |44444444444444444444444444444444|
17
- And my current rubygems key is "personal"
18
- When I run "gem keys"
19
- Then the output should contain:
20
- """
21
- *** CURRENT KEYS ***
22
11
 
23
- oss_1
24
- oss_2
25
- * personal
26
- work
27
- """
28
-
29
- Scenario Outline: Using the list option
30
- Given I have the following rubygems keys:
31
- |name |key |
32
- |personal|11111111111111111111111111111111|
33
- |work |22222222222222222222222222222222|
34
- And my current rubygems key is "work"
35
- When I run "gem keys <option>"
36
- Then the output should contain:
37
- """
38
- *** CURRENT KEYS ***
39
-
40
- personal
41
- * work
42
- """
12
+ Scenario Outline: Using a different key
13
+ Given my current rubygems key is "work"
14
+ When I run "gem keys <command> <key>"
15
+ Then the output should contain "Now using <key> API key"
16
+ And my current rubygems key should be "<key>"
43
17
 
44
18
  Examples:
45
- |option |
46
- |-l |
47
- |--list |
19
+ |command|key |
20
+ |-d |personal|
21
+ |--default |personal|
22
+ |-d |work |
23
+
24
+ Scenario: Using a bogus key
25
+ Given my current rubygems key is "personal"
26
+ When I run "gem keys -d bogus"
27
+ Then the output should contain "No such API key. You can add it with: gem keys -a bogus"
28
+ And the exit status should be 1
29
+ And my current rubygems key should be "personal"
@@ -0,0 +1,47 @@
1
+ Feature: Default commands
2
+ As a new user
3
+ I want to find out what my options are
4
+ So I can put keycutter to best use
5
+
6
+ Scenario: Installing the gem
7
+ When I run "gem q"
8
+ Then the output should contain "keycutter"
9
+
10
+ Scenario: Calling the plugin with no options
11
+ Given I have the following api keys:
12
+ |name |key |
13
+ |rubygems|11111111111111111111111111111111|
14
+ |work |22222222222222222222222222222222|
15
+ |oss_1 |33333333333333333333333333333333|
16
+ |oss_2 |44444444444444444444444444444444|
17
+ And my current rubygems key is "rubygems"
18
+ When I run "gem keys"
19
+ Then the output should contain:
20
+ """
21
+ *** CURRENT KEYS ***
22
+
23
+ oss_1
24
+ oss_2
25
+ * rubygems
26
+ work
27
+ """
28
+
29
+ Scenario Outline: Using the list option
30
+ Given I have the following api keys:
31
+ |name |key |
32
+ |rubygems|11111111111111111111111111111111|
33
+ |work |22222222222222222222222222222222|
34
+ And my current rubygems key is "work"
35
+ When I run "gem keys <option>"
36
+ Then the output should contain:
37
+ """
38
+ *** CURRENT KEYS ***
39
+
40
+ rubygems
41
+ * work
42
+ """
43
+
44
+ Examples:
45
+ |option |
46
+ |-l |
47
+ |--list |
@@ -4,15 +4,15 @@ Feature: Remove API keys
4
4
  So I can get rid of cruft
5
5
 
6
6
  Background:
7
- Given I have the following rubygems keys:
7
+ Given I have the following api keys:
8
8
  |name |key |
9
9
  |personal|11111111111111111111111111111111|
10
10
  |work |22222222222222222222222222222222|
11
11
 
12
12
  Scenario Outline:
13
13
  When I run "gem keys <command> <key>"
14
- Then the output should contain "Removed <key> rubygems API key"
15
- And I should not have a "<key>" rubygems key
14
+ Then the output should contain "Removed <key> API key"
15
+ And I should not have a "<key>" api key
16
16
 
17
17
  Examples:
18
18
  |command |key |
@@ -21,5 +21,4 @@ Feature: Remove API keys
21
21
 
22
22
  Scenario: Removing a bogus key
23
23
  When I run "gem keys -r bogus"
24
- Then the output should contain "No such rubygems API key"
25
- And the exit status should be 1
24
+ Then the output should contain "No such API key"
@@ -1,41 +1,48 @@
1
- Given /^I have the following rubygems keys:$/ do |table|
2
- accounts = table.hashes.inject({}) do |hash,row|
3
- hash[row[:name]] = row[:key]
1
+ Given /^I have the following api keys:$/ do |table|
2
+ keys = table.hashes.inject({}) do |hash,row|
3
+ hash[row[:name].to_sym] = row[:key]
4
4
  hash
5
5
  end
6
- Gem.configuration.rubygems_accounts = accounts
6
+ Gem.configuration.api_keys = keys
7
7
  end
8
8
 
9
9
  Given /^my current rubygems key is "([^"]*)"$/ do |key|
10
- Gem.configuration.rubygems_api_key = Gem.configuration.rubygems_accounts[key]
10
+ Gem.configuration.rubygems_api_key = Gem.configuration.api_keys[key.to_sym]
11
11
  end
12
12
 
13
13
  Given /^a valid gemcutter account$/ do
14
- @response = {:body => '3'*32}
15
- DRb.start_service "druby://localhost:3333", [:get, "https://rubygems.org/api/v1/api_key", @response]
14
+ set_env 'FAKEWEB_BODY', '3'*32
15
+ set_env 'FAKEWEB_STATUS', '200'
16
+ set_env 'FAKEWEB_MESSAGE', 'OK'
16
17
  end
17
18
 
18
19
  Given /^an invalid gemcutter account$/ do
19
- @response = {:body => "HTTP Basic: Access denied", :status => ["401", "Not Authorized"]}
20
- DRb.start_service "druby://localhost:3333", [:get, "https://rubygems.org/api/v1/api_key", @response]
20
+ set_env 'FAKEWEB_BODY', 'HTTP Basic: Access denied.'
21
+ set_env 'FAKEWEB_STATUS', '401'
22
+ set_env 'FAKEWEB_MESSAGE', 'Unauthorized'
21
23
  end
22
24
 
25
+ Given /^a gemcutter host at "([^"]*)"$/ do |host|
26
+ set_env 'FAKEWEB_HOST', host
27
+ end
28
+
29
+
23
30
  Then /^my current rubygems key should be "([^"]*)"$/ do |key|
24
31
  Gem.configuration.load_rubygems_api_key
25
- Gem.configuration.rubygems_api_key.should == Gem.configuration.rubygems_accounts[key]
32
+ Gem.configuration.rubygems_api_key.should == Gem.configuration.api_keys[key.to_sym]
26
33
  end
27
34
 
28
- Then /^I should have a "([^"]*)" rubygems key$/ do |key|
29
- Gem.configuration.load_rubygems_accounts
30
- Gem.configuration.rubygems_accounts.should have_key(key)
35
+ Then /^I should have a "([^"]*)" api key$/ do |key|
36
+ Gem.configuration.load_api_keys
37
+ Gem.configuration.api_keys.should have_key(key.to_sym)
31
38
  end
32
39
 
33
- Then /^I should not have a "([^"]*)" rubygems key$/ do |key|
34
- Gem.configuration.load_rubygems_accounts
35
- Gem.configuration.rubygems_accounts.should_not have_key(key)
40
+ Then /^I should not have a "([^"]*)" api key$/ do |key|
41
+ Gem.configuration.load_api_keys
42
+ Gem.configuration.api_keys.should_not have_key(key.to_sym)
36
43
  end
37
44
 
38
- Then /^the "([^"]*)" rubygems key should be the response body$/ do |key|
39
- Gem.configuration.load_rubygems_accounts
40
- Gem.configuration.rubygems_accounts[key].should == @response[:body]
45
+ Then /^the "([^"]*)" api key should be the response body$/ do |key|
46
+ Gem.configuration.load_api_keys
47
+ Gem.configuration.api_keys[key.to_sym].should == ENV['FAKEWEB_BODY']
41
48
  end
@@ -5,12 +5,12 @@ end
5
5
 
6
6
  Before do
7
7
  @original_api_key = Gem.configuration.rubygems_api_key
8
- @original_accounts = Gem.configuration.rubygems_accounts
8
+ @original_accounts = Gem.configuration.api_keys
9
9
  end
10
10
 
11
11
  After do
12
12
  Gem.configuration.rubygems_api_key = @original_api_key
13
- Gem.configuration.rubygems_accounts = @original_accounts
13
+ Gem.configuration.api_keys = @original_accounts
14
14
  end
15
15
 
16
16
  at_exit do
@@ -1,6 +1,6 @@
1
1
  require 'keycutter/version'
2
2
  require 'keycutter/configuration'
3
- require 'keycutter/testing' if ENV['FAKEWEB']
3
+ require 'keycutter/testing' if ENV['FAKEWEB_BODY'] && ENV['FAKEWEB_STATUS'] && ENV['FAKEWEB_MESSAGE']
4
4
 
5
5
  module Keycutter
6
6
 
@@ -1,12 +1,12 @@
1
1
  require 'rubygems/config_file'
2
2
 
3
3
  class Gem::ConfigFile
4
- def rubygems_accounts
5
- @rubygems_accounts || load_rubygems_accounts
4
+ def api_keys
5
+ @api_keys || load_api_keys
6
6
  end
7
7
 
8
- def rubygems_accounts=(accounts)
9
- config = load_file(credentials_path).merge(:rubygems_accounts => accounts)
8
+ def api_keys=(keys)
9
+ keys.merge!(:rubygems_api_key => @rubygems_api_key) if defined? @rubygems_api_key
10
10
 
11
11
  dirname = File.dirname(credentials_path)
12
12
  Dir.mkdir(dirname) unless File.exists?(dirname)
@@ -14,14 +14,18 @@ class Gem::ConfigFile
14
14
  require 'yaml'
15
15
 
16
16
  File.open(credentials_path, 'w') do |f|
17
- f.write config.to_yaml
17
+ f.write keys.to_yaml
18
18
  end
19
19
 
20
- @rubygems_accounts = accounts
20
+ @api_keys = keys
21
21
  end
22
22
 
23
- def load_rubygems_accounts
24
- credentials_hash = File.exists?(credentials_path) ? load_file(credentials_path) : @hash
25
- @rubygems_accounts = credentials_hash[:rubygems_accounts] || {}
23
+ def load_api_keys
24
+ @api_keys = File.exists?(credentials_path) ? load_file(credentials_path) : @hash
25
+ if @api_keys.key?(:rubygems_api_key)
26
+ rubygems_api_key = @api_keys.delete(:rubygems_api_key)
27
+ @api_keys[:rubygems] = rubygems_api_key unless @api_keys.key?(:rubygems)
28
+ end
29
+ @api_keys
26
30
  end
27
31
  end
@@ -1,8 +1,8 @@
1
- require 'drb'
2
1
  require 'fakeweb'
3
2
 
4
- DRb.start_service
5
- remote = DRbObject.new(nil, "druby://localhost:3333")
6
-
7
3
  FakeWeb.allow_net_connect = false
8
- FakeWeb.register_uri *remote
4
+ fakeweb_host = ENV['FAKEWEB_HOST'] || 'https://rubygems.org'
5
+ FakeWeb.register_uri :get, "#{fakeweb_host}/api/v1/api_key", {
6
+ :body => ENV['FAKEWEB_BODY'],
7
+ :status => [ENV['FAKEWEB_STATUS'], ENV['FAKEWEB_MESSAGE']]
8
+ }
@@ -1,3 +1,3 @@
1
1
  module Keycutter
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -3,6 +3,10 @@ require 'rubygems/gemcutter_utilities'
3
3
  class Gem::Commands::KeysCommand < Gem::Command
4
4
  include Gem::GemcutterUtilities
5
5
 
6
+ OptionParser.accept Symbol do |value|
7
+ value.to_sym
8
+ end
9
+
6
10
  def initialize
7
11
  super 'keys', "Adds management for multiple gemcutter accounts"
8
12
 
@@ -10,17 +14,23 @@ class Gem::Commands::KeysCommand < Gem::Command
10
14
  options[:list] = value
11
15
  end
12
16
 
13
- add_option '-u', '--use KEYNAME', 'Use the given API key' do |value,options|
14
- options[:use] = value
17
+ add_option '-d', '--default KEYNAME', Symbol, 'Set the default API key' do |value,options|
18
+ options[:default] = value
15
19
  end
16
20
 
17
- add_option '-r', '--remove KEYNAME', 'Remove the given API key' do |value,options|
21
+ add_option '-r', '--remove KEYNAME', Symbol, 'Remove the given API key' do |value,options|
18
22
  options[:remove] = value
19
23
  end
20
24
 
21
- add_option '-a', '--add KEYNAME', 'Add an API key with the given name' do |value,options|
25
+ add_option '-a', '--add KEYNAME', Symbol, 'Add an API key with the given name' do |value,options|
22
26
  options[:add] = value
23
27
  end
28
+
29
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.4.0')
30
+ add_option '--host HOST', 'Use another gemcutter-compatible host' do |value,options|
31
+ options[:host] = value
32
+ end
33
+ end
24
34
  end
25
35
 
26
36
  def arguments
@@ -38,45 +48,53 @@ class Gem::Commands::KeysCommand < Gem::Command
38
48
  def execute
39
49
  require 'keycutter'
40
50
 
41
- options[:list] = !(options[:use] || options[:remove] || options[:add])
51
+ options[:list] = !(options[:default] || options[:remove] || options[:add])
42
52
 
43
53
  if options[:add] then
44
- say "Enter your RubyGems.org credentials."
54
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.4.0')
55
+ gem_host = URI.parse(options[:host] || Gem.host).host
56
+ else
57
+ gem_host = 'Rubygems.org'
58
+ end
59
+
60
+ say "Enter your #{gem_host} credentials."
45
61
  say "Don't have an account yet? Create one at http://rubygems.org/sign_up"
46
62
 
47
63
  email = ask " Email: "
48
64
  password = ask_for_password "Password: "
49
65
  say
50
66
 
51
- response = rubygems_api_request :get, "api/v1/api_key" do |request|
67
+ args = [:get, 'api/v1/api_key']
68
+ args << options[:host] if options[:host]
69
+
70
+ response = rubygems_api_request(*args) do |request|
52
71
  request.basic_auth email, password
53
72
  end
54
73
 
55
74
  with_response response do |resp|
56
- accounts = Gem.configuration.rubygems_accounts.merge(options[:add] => resp.body)
57
- Gem.configuration.rubygems_accounts = accounts
58
- say "Added #{options[:add]} rubygems API key"
75
+ accounts = Gem.configuration.api_keys.merge(options[:add] => resp.body)
76
+ Gem.configuration.api_keys = accounts
77
+ say "Added #{options[:add]} API key"
59
78
  end
60
79
  end
61
80
 
62
81
  if options[:remove] then
63
- accounts = Gem.configuration.rubygems_accounts
82
+ accounts = Gem.configuration.api_keys
64
83
  if accounts.has_key? options[:remove]
65
84
  accounts.delete(options[:remove])
66
- Gem.configuration.rubygems_accounts = accounts
67
- say "Removed #{options[:remove]} rubygems API key"
85
+ Gem.configuration.api_keys = accounts
86
+ say "Removed #{options[:remove]} API key"
68
87
  else
69
- say "No such rubygems API key"
70
- terminate_interaction 1
88
+ say "No such API key"
71
89
  end
72
90
  end
73
91
 
74
- if options[:use] then
75
- if Gem.configuration.rubygems_accounts.has_key? options[:use]
76
- Gem.configuration.rubygems_api_key = Gem.configuration.rubygems_accounts[options[:use]]
77
- say "Now using #{options[:use]} rubygems API key"
92
+ if options[:default] then
93
+ if Gem.configuration.api_keys.has_key? options[:default]
94
+ Gem.configuration.rubygems_api_key = Gem.configuration.api_keys[options[:default]]
95
+ say "Now using #{options[:default]} API key"
78
96
  else
79
- say "No such rubygems API key. You can add it with: gem keys -a #{options[:use]}"
97
+ say "No such API key. You can add it with: gem keys -a #{options[:default]}"
80
98
  terminate_interaction 1
81
99
  end
82
100
  end
@@ -84,10 +102,10 @@ class Gem::Commands::KeysCommand < Gem::Command
84
102
  if options[:list] then
85
103
  say "*** CURRENT KEYS ***"
86
104
  say
87
- accounts = Gem.configuration.rubygems_accounts.sort
88
- accounts.each do |account|
89
- name, key = account
90
- say "%2s %s" % [Gem.configuration.rubygems_api_key[key] && '*', name]
105
+ api_keys = Gem.configuration.api_keys.sort_by {|k,v| k.to_s}
106
+ api_keys.each do |api_key|
107
+ name, key = api_key
108
+ say " #{Gem.configuration.rubygems_api_key == key ? '*' : ' '} #{name}"
91
109
  end
92
110
  end
93
111
  end
@@ -7,29 +7,32 @@ describe Gem::ConfigFile do
7
7
  @config.stub(:credentials_path) { @credentials }
8
8
  end
9
9
 
10
- describe "#rubygems_accounts" do
10
+ describe "#api_keys" do
11
11
  it "should load from credentials file" do
12
- credentials = {:rubygems_accounts => {'personal' => '1'*32, 'work' => '2'*32}}
12
+ credentials = {:personal => '1'*32, :work => '2'*32}
13
13
  File.open(@credentials, 'w') { |f| f.write credentials.to_yaml }
14
- @config.rubygems_accounts.should == credentials[:rubygems_accounts]
14
+ @config.api_keys.should == credentials
15
+ end
16
+
17
+ it "should add existing rubygems key to the hash" do
18
+ credentials = {:rubygems_api_key => '0'*32}
19
+ File.open(@credentials, 'w') { |f| f.write credentials.to_yaml }
20
+ @config.api_keys.should == {:rubygems => '0'*32}
15
21
  end
16
22
  end
17
23
 
18
- describe "#rubygems_accounts=" do
24
+ describe "#api_keys=" do
19
25
  it "should write to credentials file" do
20
26
  File.open(@credentials, 'w') { |f| f.write '' }
21
- accounts = {'personal' => '1'*32, 'work' => '2'*32}
22
- @config.rubygems_accounts = accounts
27
+ accounts = {:personal => '1'*32, :work => '2'*32}
28
+ @config.api_keys = accounts
23
29
 
24
- File.read(@credentials).should == {:rubygems_accounts => accounts}.to_yaml
30
+ File.read(@credentials).should == accounts.to_yaml
25
31
  end
26
32
 
27
33
  it "should preserve existing credentials" do
28
- api_key = {:rubygems_api_key => '0'*32}
29
- File.open(@credentials, 'w') { |f| f.write api_key.to_yaml }
30
-
31
- accounts = {'personal' => '1'*32, 'work' => '2'*32}
32
- @config.rubygems_accounts = accounts
34
+ @config.rubygems_api_key = '0'*32
35
+ @config.api_keys = {:personal => '1'*32, :work => '2'*32}
33
36
 
34
37
  credentials = YAML.load_file(@credentials)
35
38
  credentials[:rubygems_api_key].should == '0'*32
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keycutter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Josh French
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-12-19 00:00:00 -05:00
17
+ date: 2011-01-04 00:00:00 -05:00
19
18
  default_executable:
20
19
  dependencies: []
21
20
 
@@ -38,12 +37,11 @@ files:
38
37
  - Rakefile
39
38
  - features/add.feature
40
39
  - features/default.feature
40
+ - features/list.feature
41
41
  - features/remove.feature
42
42
  - features/step_definitions/keycutter_steps.rb
43
43
  - features/support/env.rb
44
- - features/support/fakeweb.rb
45
44
  - features/support/hooks.rb
46
- - features/use.feature
47
45
  - keycutter.gemspec
48
46
  - lib/keycutter.rb
49
47
  - lib/keycutter/configuration.rb
@@ -63,38 +61,33 @@ rdoc_options: []
63
61
  require_paths:
64
62
  - lib
65
63
  required_ruby_version: !ruby/object:Gem::Requirement
66
- none: false
67
64
  requirements:
68
65
  - - ">="
69
66
  - !ruby/object:Gem::Version
70
- hash: 3
71
67
  segments:
72
68
  - 0
73
69
  version: "0"
74
70
  required_rubygems_version: !ruby/object:Gem::Requirement
75
- none: false
76
71
  requirements:
77
72
  - - ">="
78
73
  - !ruby/object:Gem::Version
79
- hash: 3
80
74
  segments:
81
75
  - 0
82
76
  version: "0"
83
77
  requirements: []
84
78
 
85
79
  rubyforge_project: keycutter
86
- rubygems_version: 1.3.7
80
+ rubygems_version: 1.3.6
87
81
  signing_key:
88
82
  specification_version: 3
89
83
  summary: Gemcutter key management
90
84
  test_files:
91
85
  - features/add.feature
92
86
  - features/default.feature
87
+ - features/list.feature
93
88
  - features/remove.feature
94
89
  - features/step_definitions/keycutter_steps.rb
95
90
  - features/support/env.rb
96
- - features/support/fakeweb.rb
97
91
  - features/support/hooks.rb
98
- - features/use.feature
99
92
  - spec/configuration_spec.rb
100
93
  - spec/spec_helper.rb
@@ -1,8 +0,0 @@
1
- Before '@fakeweb' do
2
- require 'drb'
3
- set_env 'FAKEWEB', 'test'
4
- end
5
-
6
- After '@fakeweb' do
7
- DRb.stop_service
8
- end
@@ -1,29 +0,0 @@
1
- Feature: Using gem keys
2
- As an open source developer
3
- I want to switch between rubygems API keys
4
- In order to push all of my sweet gems
5
-
6
- Background:
7
- Given I have the following rubygems keys:
8
- |name |key |
9
- |personal|11111111111111111111111111111111|
10
- |work |22222222222222222222222222222222|
11
-
12
- Scenario Outline: Using a different key
13
- Given my current rubygems key is "work"
14
- When I run "gem keys <command> <key>"
15
- Then the output should contain "Now using <key> rubygems API key"
16
- And my current rubygems key should be "<key>"
17
-
18
- Examples:
19
- |command|key |
20
- |-u |personal|
21
- |--use |personal|
22
- |-u |work |
23
-
24
- Scenario: Using a bogus key
25
- Given my current rubygems key is "personal"
26
- When I run "gem keys -u bogus"
27
- Then the output should contain "No such rubygems API key. You can add it with: gem keys -a bogus"
28
- And the exit status should be 1
29
- And my current rubygems key should be "personal"