Skip to content

Commit 5bb2fe7

Browse files
author
Chris Hunt
committed
Update Cli acceptance test to match new syntax
1 parent 7c3ad62 commit 5bb2fe7

1 file changed

Lines changed: 13 additions & 22 deletions

File tree

spec/acceptance/github/auth/cli_spec.rb

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,64 +11,55 @@
1111

1212
after { keys_file.unlink }
1313

14-
def cli
15-
described_class.new.tap do |cli|
16-
cli.stub(
17-
github_hostname: hostname,
18-
keys_file_path: keys_file.path
19-
)
20-
end
14+
def cli(args = [])
15+
described_class.start \
16+
args + [
17+
"--path=#{keys_file.path}",
18+
"--host=#{hostname}"
19+
]
2120
end
2221

2322
it 'adds and removes keys from the keys file' do
24-
cli.execute %w(--add chrishunt)
23+
cli %w(add --users=chrishunt)
2524

2625
keys_file.read.tap do |keys_file_content|
2726
keys.each { |key| expect(keys_file_content).to include key.to_s }
2827
end
2928

30-
cli.execute %w(--remove chrishunt)
29+
cli %w(remove --users=chrishunt)
3130

3231
expect(keys_file.read).to be_empty
3332

3433
keys_file.unlink
3534
end
3635

3736
it 'lists users from the keys file' do
38-
cli.execute %w(--add chrishunt)
37+
cli %w(add --users=chrishunt)
3938

4039
output = capture_stdout do
41-
cli.execute %w(--list)
40+
cli %w(list)
4241
end
4342

4443
expect(output).to include('chrishunt')
4544
end
4645

4746
it 'supports ssh commands' do
48-
cli.execute %w(--add chrishunt --command) << "tmux attach"
47+
cli %w(add --users=chrishunt) << '--command=tmux attach'
4948

5049
expect(keys_file.read).to include 'command="tmux attach"'
5150

5251
keys_file.rewind
53-
cli.execute %w(--remove chrishunt)
52+
cli %w(remove --users=chrishunt)
5453

5554
expect(keys_file.read.strip).to be_empty
5655
end
5756

5857
it 'prints version information' do
5958
output = capture_stdout do
60-
cli.execute %w(--version)
59+
cli %w(version)
6160
end
6261

6362
expect(output).to include Github::Auth::VERSION
6463
end
65-
66-
it 'prints usage for invalid arguments' do
67-
[[], %w(invalid), %w(--add)].each do |invalid_arguments|
68-
expect(
69-
capture_stdout { cli.execute invalid_arguments }
70-
).to include 'usage: gh-auth'
71-
end
72-
end
7364
end
7465
end

0 commit comments

Comments
 (0)