11require 'spec_helper'
2- require 'support/capture_stdout'
32require 'support/mock_github_server'
43require 'github/auth'
54
@@ -20,42 +19,53 @@ def cli(args = [])
2019 end
2120
2221 it 'adds and removes keys from the keys file' do
23- cli %w( add --users=chrishunt )
22+ Mute ::IO . capture_stdout do
23+ cli %w( add --users=chrishunt )
24+ end
2425
2526 keys_file . read . tap do |keys_file_content |
2627 keys . each { |key | expect ( keys_file_content ) . to include key . to_s }
2728 end
2829
29- cli %w( remove --users=chrishunt )
30+ Mute ::IO . capture_stdout do
31+ cli %w( remove --users=chrishunt )
32+ end
3033
3134 expect ( keys_file . read ) . to be_empty
3235
3336 keys_file . unlink
3437 end
3538
3639 it 'lists users from the keys file' do
37- cli %w( add --users=chrishunt )
40+ Mute ::IO . capture_stdout do
41+ cli %w( add --users=chrishunt )
42+ end
3843
39- output = capture_stdout do
44+ output = Mute :: IO . capture_stdout do
4045 cli %w( list )
4146 end
4247
4348 expect ( output ) . to include ( 'chrishunt' )
4449 end
4550
4651 it 'supports ssh commands' do
47- cli %w( add --users=chrishunt ) << '--command=tmux attach'
52+ Mute ::IO . capture_stdout do
53+ cli %w( add --users=chrishunt ) << '--command=tmux attach'
54+ end
4855
4956 expect ( keys_file . read ) . to include 'command="tmux attach"'
5057
5158 keys_file . rewind
52- cli %w( remove --users=chrishunt )
59+
60+ Mute ::IO . capture_stdout do
61+ cli %w( remove --users=chrishunt )
62+ end
5363
5464 expect ( keys_file . read . strip ) . to be_empty
5565 end
5666
5767 it 'prints version information' do
58- output = capture_stdout do
68+ output = Mute :: IO . capture_stdout do
5969 cli %w( version )
6070 end
6171
0 commit comments