-
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathhelp_spec.rb
50 lines (43 loc) · 1.24 KB
/
help_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# frozen_string_literal: true
require "./test/helper"
clean_describe "help" do
subject { run_cmd("help") }
let(:content) { nil }
describe "with no subcommand passed" do
it "prints overall help message" do
value(subject[:stderr]).must_equal ""
value(subject[:status]).must_equal 0
value(
[
"NAME",
"SYNOPSIS",
"VERSION",
"GLOBAL OPTIONS",
"COMMANDS"
].all? { |msg| subject[:stdout].include? msg }
).must_equal true
end
end
describe "with a subcommand passed" do
subject { run_cmd("help graph") }
it "prints subcommand help message" do
value(subject[:stderr]).must_equal ""
value(subject[:status]).must_equal 0
value(
[
"NAME",
"SYNOPSIS",
"COMMAND OPTIONS"
].all? { |msg| subject[:stdout].include? msg }
).must_equal true
end
end
describe "with an invalid subcommand passed" do
subject { run_cmd("help garbage") }
# FIXME: uncomment!!!
# Waiting for: https://github.com/davetron5000/gli/issues/255
# it "prints an error message" do
# stderr_only "error: Unknown command 'garbage'. Use 'friends help' for a list of commands."
# end
end
end