test/unit/bash_test.rb in hammer_cli-3.7.0 vs test/unit/bash_test.rb in hammer_cli-3.8.0
- old
+ new
@@ -31,108 +31,108 @@
HammerCLI::Bash::Completion.new(JSON.load(dict.to_json))
end
it 'returns options when no input given' do
result = subject.complete('').sort
- result.must_equal ['host ', '--interactive ', '--help ', '-h '].sort
+ _(result).must_equal ['host ', '--interactive ', '--help ', '-h '].sort
end
it 'returns filtered options when partial input is given' do
result = subject.complete('-').sort
- result.must_equal ['--help ', '-h ', '--interactive '].sort
+ _(result).must_equal ['--help ', '-h ', '--interactive '].sort
end
it 'returns filtered options when partial input is given' do
result = subject.complete('host')
- result.must_equal ['host ']
+ _(result).must_equal ['host ']
end
it 'returns options when subcommand is given' do
result = subject.complete('host ').sort
- result.must_equal ['create ', '--help ', '--dry '].sort
+ _(result).must_equal ['create ', '--help ', '--dry '].sort
end
it 'returns no options when subcommand is wrong' do
result = subject.complete('unknown -h')
- result.must_equal []
+ _(result).must_equal []
end
it 'returns no options when there are no other params allowed' do
result = subject.complete('host create /tmp some /tmp extra')
- result.must_equal []
+ _(result).must_equal []
end
it 'return hint for option-value pair without value' do
result = subject.complete('host create -t ')
- result.must_equal ['--->', 'Add option <value>']
+ _(result).must_equal ['--->', 'Add option <value>']
end
it 'return no options for option-value pair without complete value' do
result = subject.complete('host create -t x')
- result.must_equal []
+ _(result).must_equal []
end
# multiple options in one subcommand
it 'allows mutiple options of the same subcommand' do
result = subject.complete('host create --build --he')
- result.must_equal ['--help ']
+ _(result).must_equal ['--help ']
end
# multiple options with values in one subcommand
it 'allows mutiple options with values of the same subcommand' do
result = subject.complete('host create -t value --he')
- result.must_equal ['--help ']
+ _(result).must_equal ['--help ']
end
# subcommand after options
it 'allows subcommand after options' do
result = subject.complete('host --dry crea')
- result.must_equal ['create ']
+ _(result).must_equal ['create ']
end
describe 'completion by type' do
it 'completes :value' do
result = subject.complete('host create -t ')
- result.must_equal ['--->', 'Add option <value>']
+ _(result).must_equal ['--->', 'Add option <value>']
end
it 'completes :flag' do
result = subject.complete('host --h')
- result.must_equal ['--help ']
+ _(result).must_equal ['--help ']
end
it 'completes :schema' do
result = subject.complete('host create --installed-products-attributes ')
- result.must_equal ["--->", 'Add value by following schema: "product_id=string\,product_name=string\,arch=string\,version=string, ... "']
+ _(result).must_equal ["--->", 'Add value by following schema: "product_id=string\,product_name=string\,arch=string\,version=string, ... "']
end
it 'completes :enum' do
result = subject.complete('host create --managed ')
- result.must_equal ['yes ', 'no ']
+ _(result).must_equal ['yes ', 'no ']
end
it 'completes :multienum' do
result = subject.complete('host create --volume ')
- result.must_equal ['first', 'second', 'third']
+ _(result).must_equal ['first', 'second', 'third']
result = subject.complete('host create --volume fir')
- result.must_equal ['first']
+ _(result).must_equal ['first']
result = subject.complete('host create --volume first,')
- result.must_equal ['second', 'third']
+ _(result).must_equal ['second', 'third']
result = subject.complete('host create --volume first,se')
- result.must_equal ['first,second']
+ _(result).must_equal ['first,second']
end
it 'completes :list' do
result = subject.complete('host create --config-group-ids ')
- result.must_equal ['--->', 'Add comma-separated list of values']
+ _(result).must_equal ['--->', 'Add comma-separated list of values']
end
it 'completes :key_value_list' do
result = subject.complete('host create --params ')
- result.must_equal ['--->', 'Add comma-separated list of key=value']
+ _(result).must_equal ['--->', 'Add comma-separated list of key=value']
end
end
end
end