File tree Expand file tree Collapse file tree
spec/acceptance/github/auth Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ module Github::Auth
33 class CLI
44 attr_reader :command , :usernames
55
6- COMMANDS = %w( add remove )
6+ COMMANDS = %w( add remove list )
77
88 def initialize ( argv )
99 @command = argv . shift
@@ -42,6 +42,10 @@ def remove
4242 "Removing #{ keys . count } key(s) from '#{ keys_file . path } '"
4343 end
4444
45+ def list
46+ puts "Added users: #{ keys_file . github_users . join ( ', ' ) } "
47+ end
48+
4549 def on_keys_file ( action , message )
4650 puts message
4751 rescue_keys_file_errors { keys_file . send action , keys }
Original file line number Diff line number Diff line change 11require 'spec_helper'
2+ require 'support/capture_stdout'
23require 'support/mock_github_server'
34require 'github/auth'
45
@@ -32,5 +33,15 @@ def cli(argv)
3233
3334 keys_file . unlink
3435 end
36+
37+ it 'lists users from the keys file' do
38+ cli ( %w( add chrishunt ) ) . execute
39+
40+ output = capture_stdout do
41+ cli ( %w( list ) ) . execute
42+ end
43+
44+ expect ( output ) . to include ( 'chrishunt' )
45+ end
3546 end
3647end
You can’t perform that action at this time.
0 commit comments