/
help_spec.rb
80 lines (64 loc) · 2.47 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
require 'spec_helper'
require 'texdoc_helper'
RSpec.configure do |c|
c.include Helplers
end
RSpec.describe 'The "help" action', :type => :aruba do
let(:stdout) { last_command_started.stdout.gsub("\r", "") }
let(:help_text) do
<<~EXPECTED
Usage: texdoc [OPTION...] NAME...
or: texdoc ACTION
Try to find appropriate TeX documentation for the specified NAME(s).
Alternatively, perform the given ACTION and exit.
Options:
-w, --view Use view mode: start a viewer. (default)
-m, --mixed Use mixed mode (view or list).
-l, --list Use list mode: show a list of results.
-s, --showall Use showall mode: show also "bad" results.
-i, --interact Use interactive menus. (default)
-I, --nointeract Use plain lists, no interaction required.
-M, --machine Machine-readable output for lists (implies -I).
-q, --quiet Suppress warnings and most error messages.
-v, --verbose Print additional information (e.g., viewer command).
-D, --debug Activate all debug output (equal to "--debug=all").
-d LIST, --debug=LIST
Activate debug output restricted to LIST.
-c NAME=VALUE Set configuration item NAME to VALUE.
Actions:
-h, --help Print this help message.
-V, --version Print the version number.
-f, --files Print the list of configuration files used.
--just-view FILE Display FILE, given with full path (no searching).
Full manual available via `texdoc texdoc'.
Website: <https://tug.org/texdoc/>
Repository: <https://github.com/TeX-Live/texdoc>
Please email bugs to <texdoc@tug.org>.
EXPECTED
end
before(:all) { set_default_env }
context "with --help" do
before(:each) { run_texdoc "--help" }
before(:each) { stop_all_commands }
it do
expect(stdout).to eq help_text
expect(last_command_started).to be_successfully_executed
end
end
context "with -h" do
before(:each) { run_texdoc "-h" }
before(:each) { stop_all_commands }
it do
expect(stdout).to eq help_text
expect(last_command_started).to be_successfully_executed
end
end
context "with -h -l" do
before(:each) { run_texdoc "-h -l" }
before(:each) { stop_all_commands }
it do
expect(stdout).to eq help_text
expect(last_command_started).to be_successfully_executed
end
end
end