Testing Command-Line Interface Functionality in MailCatcher
This test suite validates the command-line interface functionality of MailCatcher, focusing on version display and help command behaviors. It ensures proper output and exit handling for essential CLI commands.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
sj26/mailcatcher
spec/command_spec.rb
require "spec_helper"
RSpec.describe "mailcatcher command" do
context "--version" do
it "shows a version then exits" do
expect { system %(mailcatcher --version) }
.to output(a_string_including("MailCatcher v#{MailCatcher::VERSION}"))
.to_stdout_from_any_process
end
end
context "--help" do
it "shows help then exits" do
expect { system %(mailcatcher --help) }
.to output(a_string_including("MailCatcher v#{MailCatcher::VERSION}") & a_string_including("--help") & a_string_including("Display this help information"))
.to_stdout_from_any_process
end
end
end