-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test to check cli help and messages
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
module Tapioca | ||
class HelpSpec < SpecWithProject | ||
describe("cli::help") do | ||
before(:all) do | ||
project.bundle_install | ||
end | ||
|
||
it "must display the help when passing --help" do | ||
result = @project.tapioca("--help") | ||
stdout_lines = result.out.strip.split("\n") | ||
assert_equal("Commands:", stdout_lines.first) | ||
assert_empty_stderr(result) | ||
assert_success_status(result) | ||
end | ||
|
||
it "must display the help when passing -h" do | ||
result = @project.tapioca("-h") | ||
stdout_lines = result.out.strip.split("\n") | ||
assert_equal("Commands:", stdout_lines.first) | ||
assert_empty_stderr(result) | ||
assert_success_status(result) | ||
end | ||
|
||
it "must begin every command description of help text with a capital letter" do | ||
result = @project.tapioca("--help") | ||
stdout_lines = result.out.strip.split("\n") | ||
assert_equal(stdout_lines.reject { / # [a-z]/.match?(_1) }.size, stdout_lines.size) | ||
assert_empty_stderr(result) | ||
assert_success_status(result) | ||
end | ||
end | ||
end | ||
end |