|
109 | 109 | end
|
110 | 110 | end
|
111 | 111 |
|
112 |
| - describe '#public_commands_aliases' do |
| 112 | + describe '#public_command_aliases' do |
113 | 113 | let(:fixture) { :private_commands }
|
114 | 114 |
|
115 | 115 | it 'returns an array of command aliases of public subcommands' do
|
116 | 116 | expect(subject.public_command_aliases).to eq %w[connect c]
|
117 | 117 | end
|
118 | 118 | end
|
| 119 | + |
| 120 | + describe '#visible_commands' do |
| 121 | + let(:fixture) { :private_commands } |
| 122 | + |
| 123 | + it 'returns public commands only (same as #public_commands)' do |
| 124 | + expect(subject.visible_commands.size).to eq 1 |
| 125 | + expect(subject.visible_commands.first.name).to eq 'connect' |
| 126 | + end |
| 127 | + |
| 128 | + context 'when Settings.private_reveal_key is set' do |
| 129 | + before { Settings.private_reveal_key = 'SHOW' } |
| 130 | + after { Settings.private_reveal_key = nil } |
| 131 | + |
| 132 | + it 'returns all commands (same as #commands)' do |
| 133 | + expect(subject.visible_commands.size).to eq 3 |
| 134 | + expect(subject.visible_commands[1].name).to eq 'connect-ftp' |
| 135 | + end |
| 136 | + end |
| 137 | + end |
| 138 | + |
| 139 | + describe '#visible_command_aliases' do |
| 140 | + let(:fixture) { :private_commands } |
| 141 | + |
| 142 | + it 'returns an array of command aliases of public subcommands' do |
| 143 | + expect(subject.visible_command_aliases).to eq %w[connect c] |
| 144 | + end |
| 145 | + |
| 146 | + context 'when Settings.private_reveal_key is set' do |
| 147 | + before { Settings.private_reveal_key = 'SHOW' } |
| 148 | + after { Settings.private_reveal_key = nil } |
| 149 | + |
| 150 | + it 'returns an array of command aliases of all subcommands' do |
| 151 | + expect(subject.visible_command_aliases).to eq %w[ |
| 152 | + connect c connect-ftp cf connect-ssh cs |
| 153 | + ] |
| 154 | + end |
| 155 | + end |
| 156 | + end |
119 | 157 | end
|
0 commit comments