-
-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathspell_checker_spec.rb
More file actions
45 lines (38 loc) · 1.82 KB
/
Copy pathspell_checker_spec.rb
File metadata and controls
45 lines (38 loc) · 1.82 KB
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
# frozen_string_literal: true
require "open3"
RSpec.describe "Spell checker" do
it "print similar command when there is a command with a typo" do
_, stderr, = Open3.capture3("foo routs")
expected = <<~DESC
I don't know how to 'routs'. Did you mean: 'routes' ?
Commands:
foo -c PREFIX # Help you to build a shell completion script by searching commands based on a prefix
foo assets [SUBCOMMAND]
foo callbacks DIR # Command with callbacks
foo console # Starts Foo console
foo db [SUBCOMMAND]
foo destroy [SUBCOMMAND]
foo exec TASK [DIRS] # Execute a task
foo generate [SUBCOMMAND]
foo greeting [RESPONSE]
foo hello # Print a greeting
foo new PROJECT # Generate a new Foo project
foo root-command [ARGUMENT|SUBCOMMAND] # Root command with arguments and subcommands
foo routes # Print routes
foo server # Start Foo server (only for development)
foo sub [SUBCOMMAND]
foo variadic [SUBCOMMAND]
foo version # Print Foo version
DESC
expect(stderr).to eq(expected)
end
it "handles typos in subcommands" do
_, stderr, = Open3.capture3("foo sub comand")
expected = <<~DESC
I don't know how to 'comand'. Did you mean: 'command' ?
Commands:
foo sub command # Override a subcommand
DESC
expect(stderr).to eq(expected)
end
end